Skip to content

Commit e2808c9

Browse files
Merge pull request #4673 from ggouaillardet/topic/ompi_comm_split
ompi/communicator: optimize ompi_comm_split()
2 parents 70a2098 + 2dd3454 commit e2808c9

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

ompi/communicator/comm.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
1919
* Copyright (c) 2012-2016 Los Alamos National Security, LLC.
2020
* All rights reserved.
21-
* Copyright (c) 2014-2016 Research Organization for Information Science
21+
* Copyright (c) 2014-2017 Research Organization for Information Science
2222
* and Technology (RIST). All rights reserved.
2323
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
2424
* Copyright (c) 2015 Mellanox Technologies. All rights reserved.
@@ -592,6 +592,14 @@ int ompi_comm_split( ompi_communicator_t* comm, int color, int key,
592592
}
593593
}
594594

595+
/* set the rank to MPI_UNDEFINED. This prevents this process from interfering
596+
* in ompi_comm_nextcid() and the collective module selection in ompi_comm_activate()
597+
* for a communicator that will be freed anyway.
598+
*/
599+
if ( MPI_UNDEFINED == color || (inter && my_rsize==0)) {
600+
newcomp->c_local_group->grp_my_rank = MPI_UNDEFINED;
601+
}
602+
595603
/* Determine context id. It is identical to f_2_c_handle */
596604
rc = ompi_comm_nextcid (newcomp, comm, NULL, NULL, NULL, false, mode);
597605
if ( OMPI_SUCCESS != rc ) {
@@ -602,13 +610,6 @@ int ompi_comm_split( ompi_communicator_t* comm, int color, int key,
602610
snprintf(newcomp->c_name, MPI_MAX_OBJECT_NAME, "MPI COMMUNICATOR %d SPLIT FROM %d",
603611
newcomp->c_contextid, comm->c_contextid );
604612

605-
/* set the rank to MPI_UNDEFINED. This prevents in comm_activate
606-
* the collective module selection for a communicator that will
607-
* be freed anyway.
608-
*/
609-
if ( MPI_UNDEFINED == color || (inter && my_rsize==0)) {
610-
newcomp->c_local_group->grp_my_rank = MPI_UNDEFINED;
611-
}
612613

613614

614615
/* Activate the communicator and init coll-component */

0 commit comments

Comments
 (0)