This source file includes following definitions.
- MPI_Comm_connect
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #include "ompi_config.h"
27 #include <stdio.h>
28
29 #include "opal/util/show_help.h"
30
31 #include "ompi/mpi/c/bindings.h"
32 #include "ompi/runtime/params.h"
33 #include "ompi/runtime/mpiruntime.h"
34 #include "ompi/communicator/communicator.h"
35 #include "ompi/errhandler/errhandler.h"
36 #include "ompi/info/info.h"
37 #include "ompi/dpm/dpm.h"
38 #include "ompi/memchecker.h"
39
40 #if OMPI_BUILD_MPI_PROFILING
41 #if OPAL_HAVE_WEAK_SYMBOLS
42 #pragma weak MPI_Comm_connect = PMPI_Comm_connect
43 #endif
44 #define MPI_Comm_connect PMPI_Comm_connect
45 #endif
46
47 static const char FUNC_NAME[] = "MPI_Comm_connect";
48
49
50 int MPI_Comm_connect(const char *port_name, MPI_Info info, int root,
51 MPI_Comm comm, MPI_Comm *newcomm)
52 {
53 int rank, rc;
54 bool send_first=true;
55 ompi_communicator_t *newcomp=MPI_COMM_NULL;
56
57 MEMCHECKER(
58 memchecker_comm(comm);
59 );
60
61 if ( MPI_PARAM_CHECK ) {
62 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
63
64 if (ompi_comm_invalid (comm)) {
65 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
66 FUNC_NAME);
67 }
68 if ( OMPI_COMM_IS_INTER(comm)) {
69 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COMM,
70 FUNC_NAME);
71 }
72 if ( (0 > root) || (ompi_comm_size(comm) <= root) ) {
73 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
74 FUNC_NAME);
75 }
76 if ( NULL == newcomm ) {
77 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
78 FUNC_NAME);
79 }
80 if (NULL == info || ompi_info_is_freed(info)) {
81 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INFO,
82 FUNC_NAME);
83 }
84 }
85
86 rank = ompi_comm_rank ( comm );
87 if ( MPI_PARAM_CHECK ) {
88 if ( rank == root ) {
89 if ( NULL == port_name )
90 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
91 FUNC_NAME);
92 }
93 }
94
95 if (!ompi_mpi_dynamics_is_enabled(FUNC_NAME)) {
96 return OMPI_ERRHANDLER_INVOKE(comm, OMPI_ERR_NOT_SUPPORTED, FUNC_NAME);
97 }
98
99
100
101
102
103
104
105
106 OPAL_CR_ENTER_LIBRARY();
107
108 if ( rank == root ) {
109 rc = ompi_dpm_connect_accept (comm, root, port_name, send_first,
110 &newcomp);
111 }
112 else {
113 rc = ompi_dpm_connect_accept (comm, root, NULL, send_first,
114 &newcomp);
115 }
116
117 OPAL_CR_EXIT_LIBRARY();
118
119 if (OPAL_ERR_NOT_SUPPORTED == rc) {
120 opal_show_help("help-mpi-api.txt",
121 "MPI function not supported",
122 true,
123 FUNC_NAME,
124 "Underlying runtime environment does not support accept/connect functionality");
125 }
126
127 *newcomm = newcomp;
128 OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME);
129 }