File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,18 @@ int ompi_comm_init(void)
157
157
OBJ_RETAIN ( & ompi_mpi_errors_are_fatal .eh );
158
158
opal_pointer_array_set_item (& ompi_mpi_communicators , 2 , & ompi_mpi_comm_null );
159
159
160
+ /*
161
+ * first three places in ompi_mpi_communicators are reserved for
162
+ * MPI world model communicators MPI_COMM_WORLD, MPI_COMM_SELF, in addition to
163
+ * MPI_COMM_NULL which is needed both for world and sessions models.
164
+ * We conditionally insert ompi_mpi_comm_null into slots 0 and 1. If MPI_Init was
165
+ * already called then these two slots are already occupied. If
166
+ * MPI_Init is called after one or more MPI_Session_init, then
167
+ * slots 0 and 1 will be filled in with MPI_COMM_WORLD and MPI_COMM_SELF.
168
+ */
169
+ (void )opal_pointer_array_test_and_set_item (& ompi_mpi_communicators , 0 , & ompi_mpi_comm_null );
170
+ (void )opal_pointer_array_test_and_set_item (& ompi_mpi_communicators , 1 , & ompi_mpi_comm_null );
171
+
160
172
opal_string_copy (ompi_mpi_comm_null .comm .c_name , "MPI_COMM_NULL" ,
161
173
sizeof (ompi_mpi_comm_null .comm .c_name ));
162
174
ompi_mpi_comm_null .comm .c_flags |= OMPI_COMM_NAMEISSET | OMPI_COMM_INTRINSIC |
You can’t perform that action at this time.
0 commit comments