Skip to content

Commit a79f8b5

Browse files
committed
implement MPI_Comm_idup_with_info
Signed-off-by: Howard Pritchard <howardp@lanl.gov>
1 parent b74c84f commit a79f8b5

17 files changed

+824
-0
lines changed

ompi/include/mpi.h.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,8 @@ OMPI_DECLSPEC int MPI_Comm_disconnect(MPI_Comm *comm);
14251425
OMPI_DECLSPEC int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm);
14261426
OMPI_DECLSPEC int MPI_Comm_idup(MPI_Comm comm, MPI_Comm *newcomm, MPI_Request *request);
14271427
OMPI_DECLSPEC int MPI_Comm_dup_with_info(MPI_Comm comm, MPI_Info info, MPI_Comm *newcomm);
1428+
OMPI_DECLSPEC int MPI_Comm_idup_with_info(MPI_Comm comm, MPI_Info info, MPI_Comm *newcomm,
1429+
MPI_Request *request);
14281430
OMPI_DECLSPEC MPI_Comm MPI_Comm_f2c(MPI_Fint comm);
14291431
OMPI_DECLSPEC int MPI_Comm_free_keyval(int *comm_keyval);
14301432
OMPI_DECLSPEC int MPI_Comm_free(MPI_Comm *comm);
@@ -2178,6 +2180,8 @@ OMPI_DECLSPEC int PMPI_Comm_disconnect(MPI_Comm *comm);
21782180
OMPI_DECLSPEC int PMPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm);
21792181
OMPI_DECLSPEC int PMPI_Comm_idup(MPI_Comm comm, MPI_Comm *newcomm, MPI_Request *request);
21802182
OMPI_DECLSPEC int PMPI_Comm_dup_with_info(MPI_Comm comm, MPI_Info info, MPI_Comm *newcomm);
2183+
OMPI_DECLSPEC int PMPI_Comm_idup_with_info(MPI_Comm comm, MPI_Info info, MPI_Comm *newcomm,
2184+
MPI_Request *request);
21812185
OMPI_DECLSPEC MPI_Comm PMPI_Comm_f2c(MPI_Fint comm);
21822186
OMPI_DECLSPEC int PMPI_Comm_free_keyval(int *comm_keyval);
21832187
OMPI_DECLSPEC int PMPI_Comm_free(MPI_Comm *comm);

ompi/mpi/c/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ interface_profile_sources = \
120120
comm_dup.c \
121121
comm_dup_with_info.c \
122122
comm_idup.c \
123+
comm_idup_with_info.c \
123124
comm_f2c.c \
124125
comm_free.c \
125126
comm_free_keyval.c \

ompi/mpi/c/comm_idup_with_info.c

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2+
/*
3+
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
4+
* University Research and Technology
5+
* Corporation. All rights reserved.
6+
* Copyright (c) 2004-2020 The University of Tennessee and The University
7+
* of Tennessee Research Foundation. All rights
8+
* reserved.
9+
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
10+
* University of Stuttgart. All rights reserved.
11+
* Copyright (c) 2004-2005 The Regents of the University of California.
12+
* All rights reserved.
13+
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
14+
* Copyright (c) 2006-2008 University of Houston. All rights reserved.
15+
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
16+
* reserved.
17+
* Copyright (c) 2015 Research Organization for Information Science
18+
* and Technology (RIST). All rights reserved.
19+
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
20+
* Copyright (c) 2021 Triad National Security, LLC. All rights
21+
* reserved.
22+
*
23+
* $COPYRIGHT$
24+
*
25+
* Additional copyrights may follow
26+
*
27+
* $HEADER$
28+
*/
29+
#include "ompi_config.h"
30+
#include <stdio.h>
31+
32+
#include "ompi/mpi/c/bindings.h"
33+
#include "ompi/runtime/params.h"
34+
#include "ompi/communicator/communicator.h"
35+
#include "ompi/errhandler/errhandler.h"
36+
#include "ompi/memchecker.h"
37+
38+
#if OMPI_BUILD_MPI_PROFILING
39+
#if OPAL_HAVE_WEAK_SYMBOLS
40+
#pragma weak MPI_Comm_idup_with_info = PMPI_Comm_idup_with_info
41+
#endif
42+
#define MPI_Comm_idup_with_info PMPI_Comm_idup_with_info
43+
#endif
44+
45+
static const char FUNC_NAME[] = "MPI_Comm_idup_with_info";
46+
47+
int MPI_Comm_idup_with_info(MPI_Comm comm, MPI_Info info, MPI_Comm *newcomm, MPI_Request *request)
48+
{
49+
int rc;
50+
51+
MEMCHECKER(
52+
memchecker_comm(comm);
53+
);
54+
55+
/* argument checking */
56+
if ( MPI_PARAM_CHECK ) {
57+
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
58+
59+
if (ompi_comm_invalid (comm))
60+
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_COMM,
61+
FUNC_NAME);
62+
if (NULL == info || ompi_info_is_freed(info)) {
63+
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_INFO,
64+
FUNC_NAME);
65+
}
66+
67+
if ( NULL == newcomm )
68+
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
69+
FUNC_NAME);
70+
}
71+
72+
#if OPAL_ENABLE_FT_MPI
73+
/*
74+
* An early check, so as to return early if we are using a broken
75+
* communicator. This is not absolutely necessary since we will
76+
* check for this, and other, error conditions during the operation.
77+
*/
78+
if( OPAL_UNLIKELY(!ompi_comm_iface_create_check(comm, &rc)) ) {
79+
OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME);
80+
}
81+
#endif
82+
83+
rc = ompi_comm_idup_with_info (comm, &info->super, newcomm, request);
84+
OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME);
85+
}
86+

0 commit comments

Comments
 (0)