@@ -774,6 +774,11 @@ static int ompi_comm_activate_nb_complete (ompi_comm_request_t *request);
774
774
/* Callback function to set communicator disjointness flags */
775
775
static inline void ompi_comm_set_disjointness_nb_complete (ompi_comm_cid_context_t * context )
776
776
{
777
+ /* Only set the disjoint flags when it is intra-communicator */
778
+ if (OMPI_COMM_IS_INTER (* context -> newcommp )) {
779
+ return ;
780
+ }
781
+
777
782
if (OMPI_COMM_IS_DISJOINT_SET (* context -> newcommp )) {
778
783
opal_show_help ("help-comm.txt" , "disjointness-set-again" , true);
779
784
return ;
@@ -870,7 +875,7 @@ int ompi_comm_activate_nb (ompi_communicator_t **newcomm, ompi_communicator_t *c
870
875
ompi_comm_cid_context_t * context ;
871
876
ompi_comm_request_t * request ;
872
877
ompi_request_t * subreq ;
873
- int ret = 0 , local_peers = -1 ;
878
+ int ret = 0 ;
874
879
875
880
/* the caller should not pass NULL for comm (it may be the same as *newcomm) */
876
881
assert (NULL != comm );
@@ -902,20 +907,19 @@ int ompi_comm_activate_nb (ompi_communicator_t **newcomm, ompi_communicator_t *c
902
907
OMPI_COMM_SET_PML_ADDED (* newcomm );
903
908
}
904
909
905
- /**
906
- * Dual-purpose barrier:
907
- * 1. The communicator's disjointness is inferred from max_local_peers.
908
- * 2. After the operation it is allowed to send messages over the new communicator.
909
- */
910
- local_peers = context -> max_local_peers ;
911
- ret = context -> iallreduce_fn ( & local_peers , & context -> max_local_peers , 1 , MPI_MAX , context ,
912
- & subreq );
913
- if ( OMPI_SUCCESS != ret ) {
914
- ompi_comm_request_return ( request );
915
- return ret ;
910
+ if ( OMPI_COMM_IS_INTRA ( * newcomm )) {
911
+ /* The communicator's disjointness is inferred from max_local_peers. */
912
+ ret = context -> iallreduce_fn ( MPI_IN_PLACE , & context -> max_local_peers , 1 , MPI_MAX , context ,
913
+ & subreq );
914
+ if ( OMPI_SUCCESS != ret ) {
915
+ ompi_comm_request_return ( request ) ;
916
+ return ret ;
917
+ }
918
+ ompi_comm_request_schedule_append ( request , ompi_comm_activate_nb_complete , & subreq , 1 );
919
+ } else {
920
+ ompi_comm_request_schedule_append ( request , ompi_comm_activate_nb_complete , NULL , 0 ) ;
916
921
}
917
-
918
- ompi_comm_request_schedule_append (request , ompi_comm_activate_nb_complete , & subreq , 1 );
922
+
919
923
ompi_comm_request_start (request );
920
924
921
925
* req = & request -> super ;
0 commit comments