@@ -65,9 +65,9 @@ opal_atomic_int64_t ompi_comm_next_base_cid = 1;
65
65
66
66
struct ompi_comm_cid_context_t ;
67
67
68
- typedef int (* ompi_comm_allreduce_impl_fn_t ) (int * inbuf , int * outbuf , int count , struct ompi_op_t * op ,
69
- struct ompi_comm_cid_context_t * cid_context ,
70
- ompi_request_t * * req );
68
+ typedef int (* ompi_comm_iallreduce_impl_fn_t ) (int * inbuf , int * outbuf , int count , struct ompi_op_t * op ,
69
+ struct ompi_comm_cid_context_t * cid_context ,
70
+ ompi_request_t * * req );
71
71
72
72
73
73
struct ompi_comm_cid_context_t {
@@ -78,7 +78,7 @@ struct ompi_comm_cid_context_t {
78
78
ompi_communicator_t * comm ;
79
79
ompi_communicator_t * bridgecomm ;
80
80
81
- ompi_comm_allreduce_impl_fn_t allreduce_fn ;
81
+ ompi_comm_iallreduce_impl_fn_t iallreduce_fn ;
82
82
83
83
int nextcid ;
84
84
int nextlocal_cid ;
@@ -225,38 +225,38 @@ static ompi_comm_cid_context_t *mca_comm_cid_context_alloc (ompi_communicator_t
225
225
* for the current mode. */
226
226
switch (mode ) {
227
227
case OMPI_COMM_CID_INTRA :
228
- context -> allreduce_fn = ompi_comm_allreduce_intra_nb ;
228
+ context -> iallreduce_fn = ompi_comm_allreduce_intra_nb ;
229
229
break ;
230
230
case OMPI_COMM_CID_INTER :
231
- context -> allreduce_fn = ompi_comm_allreduce_inter_nb ;
231
+ context -> iallreduce_fn = ompi_comm_allreduce_inter_nb ;
232
232
break ;
233
233
case OMPI_COMM_CID_GROUP :
234
234
case OMPI_COMM_CID_GROUP_NEW :
235
- context -> allreduce_fn = ompi_comm_allreduce_group_nb ;
235
+ context -> iallreduce_fn = ompi_comm_allreduce_group_nb ;
236
236
context -> pml_tag = ((int * ) arg0 )[0 ];
237
237
break ;
238
238
case OMPI_COMM_CID_INTRA_PMIX :
239
- context -> allreduce_fn = ompi_comm_allreduce_intra_pmix_nb ;
239
+ context -> iallreduce_fn = ompi_comm_allreduce_intra_pmix_nb ;
240
240
context -> local_leader = ((int * ) arg0 )[0 ];
241
241
if (arg1 ) {
242
242
context -> port_string = strdup ((char * ) arg1 );
243
243
}
244
244
context -> pmix_tag = strdup ((char * ) pmix_tag );
245
245
break ;
246
246
case OMPI_COMM_CID_INTRA_BRIDGE :
247
- context -> allreduce_fn = ompi_comm_allreduce_intra_bridge_nb ;
247
+ context -> iallreduce_fn = ompi_comm_allreduce_intra_bridge_nb ;
248
248
context -> local_leader = ((int * ) arg0 )[0 ];
249
249
context -> remote_leader = ((int * ) arg1 )[0 ];
250
250
break ;
251
251
#if OPAL_ENABLE_FT_MPI
252
252
case OMPI_COMM_CID_INTRA_FT :
253
- context -> allreduce_fn = ompi_comm_ft_allreduce_intra_nb ;
253
+ context -> iallreduce_fn = ompi_comm_ft_allreduce_intra_nb ;
254
254
break ;
255
255
case OMPI_COMM_CID_INTER_FT :
256
- context -> allreduce_fn = ompi_comm_ft_allreduce_inter_nb ;
256
+ context -> iallreduce_fn = ompi_comm_ft_allreduce_inter_nb ;
257
257
break ;
258
258
case OMPI_COMM_CID_INTRA_PMIX_FT :
259
- context -> allreduce_fn = ompi_comm_ft_allreduce_intra_pmix_nb ;
259
+ context -> iallreduce_fn = ompi_comm_ft_allreduce_intra_pmix_nb ;
260
260
break ;
261
261
#endif /* OPAL_ENABLE_FT_MPI */
262
262
default :
@@ -600,8 +600,8 @@ static int ompi_comm_allreduce_getnextcid (ompi_comm_request_t *request)
600
600
#endif /* OPAL_ENABLE_FT_MPI */
601
601
}
602
602
603
- ret = context -> allreduce_fn (& context -> nextlocal_cid , & context -> nextcid , 1 , MPI_MAX ,
604
- context , & subreq );
603
+ ret = context -> iallreduce_fn (& context -> nextlocal_cid , & context -> nextcid , 1 , MPI_MAX ,
604
+ context , & subreq );
605
605
/* there was a failure during non-blocking collective
606
606
* all we can do is abort
607
607
*/
@@ -666,7 +666,7 @@ static int ompi_comm_checkcid (ompi_comm_request_t *request)
666
666
667
667
++ context -> iter ;
668
668
669
- ret = context -> allreduce_fn (& context -> flag , & context -> rflag , 1 , MPI_MIN , context , & subreq );
669
+ ret = context -> iallreduce_fn (& context -> flag , & context -> rflag , 1 , MPI_MIN , context , & subreq );
670
670
if (OMPI_SUCCESS == ret ) {
671
671
ompi_comm_request_schedule_append (request , ompi_comm_nextcid_check_flag , & subreq , 1 );
672
672
} else {
@@ -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 -> allreduce_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