@@ -18,7 +18,12 @@ int mca_coll_solo_reduce_intra(const void *sbuf, void *rbuf, int count,
1818 struct ompi_communicator_t * comm ,
1919 mca_coll_base_module_t * module )
2020{
21- return mca_coll_solo_reduce_ring_intra_memcpy (sbuf , rbuf , count , dtype , op , root , comm , module );
21+ if (ompi_op_is_commute (op )) {
22+ return mca_coll_solo_reduce_ring_intra_memcpy (sbuf , rbuf , count , dtype , op , root , comm , module );
23+ }
24+ else {
25+ return ompi_coll_base_reduce_intra_basic_linear (sbuf , rbuf , count , dtype , op , root , comm , module );
26+ }
2227}
2328
2429/**
@@ -46,6 +51,7 @@ int mca_coll_solo_reduce_ring_intra_memcpy(const void *sbuf, void *rbuf,
4651 int size = ompi_comm_size (comm );
4752 int rank = ompi_comm_rank (comm );
4853 int i ;
54+
4955 ptrdiff_t extent , lower_bound ;
5056 ompi_datatype_get_extent (dtype , & lower_bound , & extent );
5157
@@ -89,7 +95,11 @@ int mca_coll_solo_reduce_ring_intra_memcpy(const void *sbuf, void *rbuf,
8995 int num_segments = (count + seg_count - 1 ) / seg_count ;
9096 int last_count = count - seg_count * (num_segments - 1 );
9197 for (int i = 0 ; i < num_segments ; i ++ ) {
92- char * temp_sbuf = (char * )sbuf + seg_count * extent * i ;
98+ char * temp_sbuf ;
99+ if (sbuf == MPI_IN_PLACE )
100+ temp_sbuf = MPI_IN_PLACE ;
101+ else
102+ temp_sbuf = (char * )sbuf + seg_count * extent * i ;
93103 char * temp_rbuf = (char * )rbuf + seg_count * extent * i ;
94104 int temp_count = seg_count ;
95105 if (i == num_segments - 1 ) {
@@ -101,6 +111,11 @@ int mca_coll_solo_reduce_ring_intra_memcpy(const void *sbuf, void *rbuf,
101111 return MPI_SUCCESS ;
102112 }
103113
114+ char * sbuf_temp = (char * )sbuf ;
115+ if ( sbuf == MPI_IN_PLACE ) {
116+ sbuf_temp = (char * )rbuf ;
117+ }
118+
104119 * (int * ) (solo_module -> ctrl_bufs [rank ]) = rank ;
105120 mac_coll_solo_barrier_intra (comm , module );
106121
@@ -113,12 +128,13 @@ int mca_coll_solo_reduce_ring_intra_memcpy(const void *sbuf, void *rbuf,
113128 }
114129 /* At first iteration, copy local data to the shared data buffer */
115130 if (cur == rank ) {
116- mca_coll_solo_copy ((void * ) ((char * ) sbuf + cur * l_seg_count * extent ), (void * ) data_bufs [cur ], dtype , seg_count , extent );
131+ mca_coll_solo_copy ((void * ) ((char * ) sbuf_temp + cur * l_seg_count * extent ),
132+ (void * ) data_bufs [cur ], dtype , seg_count , extent );
117133 mac_coll_solo_barrier_intra (comm , module );
118134 }
119135 /* For other iterations, do operations on the shared data buffer */
120136 else {
121- ompi_op_reduce (op , (char * ) sbuf + cur * l_seg_count * extent ,
137+ ompi_op_reduce (op , (char * ) sbuf_temp + cur * l_seg_count * extent ,
122138 data_bufs [cur ], seg_count , dtype );
123139 mac_coll_solo_barrier_intra (comm , module );
124140 }
0 commit comments