Skip to content

Commit

Permalink
Merge pull request #4673 from ggouaillardet/topic/ompi_comm_split
Browse files Browse the repository at this point in the history
ompi/communicator: optimize ompi_comm_split()
  • Loading branch information
ggouaillardet authored Dec 28, 2017
2 parents 70a2098 + 2dd3454 commit e2808c9
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions ompi/communicator/comm.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2012-2016 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2014-2016 Research Organization for Information Science
* Copyright (c) 2014-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies. All rights reserved.
Expand Down Expand Up @@ -592,6 +592,14 @@ int ompi_comm_split( ompi_communicator_t* comm, int color, int key,
}
}

/* set the rank to MPI_UNDEFINED. This prevents this process from interfering
* in ompi_comm_nextcid() and the collective module selection in ompi_comm_activate()
* for a communicator that will be freed anyway.
*/
if ( MPI_UNDEFINED == color || (inter && my_rsize==0)) {
newcomp->c_local_group->grp_my_rank = MPI_UNDEFINED;
}

/* Determine context id. It is identical to f_2_c_handle */
rc = ompi_comm_nextcid (newcomp, comm, NULL, NULL, NULL, false, mode);
if ( OMPI_SUCCESS != rc ) {
Expand All @@ -602,13 +610,6 @@ int ompi_comm_split( ompi_communicator_t* comm, int color, int key,
snprintf(newcomp->c_name, MPI_MAX_OBJECT_NAME, "MPI COMMUNICATOR %d SPLIT FROM %d",
newcomp->c_contextid, comm->c_contextid );

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


/* Activate the communicator and init coll-component */
Expand Down

0 comments on commit e2808c9

Please sign in to comment.