@@ -48,7 +48,7 @@ mca_coll_inter_allreduce_inter(const void *sbuf, void *rbuf, int count,
48
48
mca_coll_base_module_t * module )
49
49
{
50
50
int err , rank , root = 0 ;
51
- char * tmpbuf = NULL , * pml_buffer = NULL ;
51
+ char * tmpbuf = NULL , * pml_buffer = NULL , * source ;
52
52
ptrdiff_t gap , span ;
53
53
54
54
rank = ompi_comm_rank (comm );
@@ -58,20 +58,21 @@ mca_coll_inter_allreduce_inter(const void *sbuf, void *rbuf, int count,
58
58
59
59
tmpbuf = (char * ) malloc (span );
60
60
if (NULL == tmpbuf ) {
61
- return OMPI_ERR_OUT_OF_RESOURCE ;
61
+ return OMPI_ERR_OUT_OF_RESOURCE ;
62
62
}
63
63
pml_buffer = tmpbuf - gap ;
64
+ source = (MPI_IN_PLACE == sbuf ) ? rbuf : sbuf ;
64
65
65
- err = comm -> c_local_comm -> c_coll -> coll_reduce (sbuf , pml_buffer , count ,
66
- dtype , op , root ,
67
- comm -> c_local_comm ,
68
- comm -> c_local_comm -> c_coll -> coll_reduce_module );
66
+ err = comm -> c_local_comm -> c_coll -> coll_reduce (source , pml_buffer , count ,
67
+ dtype , op , root ,
68
+ comm -> c_local_comm ,
69
+ comm -> c_local_comm -> c_coll -> coll_reduce_module );
69
70
if (OMPI_SUCCESS != err ) {
70
- goto exit ;
71
+ goto exit ;
71
72
}
72
73
73
74
if (rank == root ) {
74
- /* Do a send-recv between the two root procs. to avoid deadlock */
75
+ /* Do a send-recv between the two root procs. to avoid deadlock */
75
76
err = ompi_coll_base_sendrecv_actual (pml_buffer , count , dtype , 0 ,
76
77
MCA_COLL_BASE_TAG_ALLREDUCE ,
77
78
rbuf , count , dtype , 0 ,
@@ -84,8 +85,8 @@ mca_coll_inter_allreduce_inter(const void *sbuf, void *rbuf, int count,
84
85
85
86
/* bcast the message to all the local processes */
86
87
err = comm -> c_local_comm -> c_coll -> coll_bcast (rbuf , count , dtype ,
87
- root , comm -> c_local_comm ,
88
- comm -> c_local_comm -> c_coll -> coll_bcast_module );
88
+ root , comm -> c_local_comm ,
89
+ comm -> c_local_comm -> c_coll -> coll_bcast_module );
89
90
if (OMPI_SUCCESS != err ) {
90
91
goto exit ;
91
92
}
0 commit comments