@@ -260,16 +260,14 @@ static inline int ompi_osc_rdma_gacc_amo (ompi_osc_rdma_module_t *module, ompi_o
260
260
{
261
261
const bool use_amo = module -> acc_use_amo ;
262
262
const size_t dt_size = datatype -> super .size ;
263
+ void * to_free = NULL ;
263
264
uint64_t offset = 0 ;
264
265
int ret ;
265
266
266
267
OSC_RDMA_VERBOSE (MCA_BASE_VERBOSE_TRACE , "using network atomics for accumulate operation with count %d" , count );
267
268
268
- /* only one can be non-NULL */
269
- assert (NULL == result || NULL == result_convertor );
270
-
271
- if (NULL == result && NULL != result_convertor ) {
272
- result = malloc (request -> len );
269
+ if (NULL == result ) {
270
+ to_free = result = malloc (request -> len );
273
271
if (OPAL_UNLIKELY (NULL == result )) {
274
272
return OMPI_ERR_OUT_OF_RESOURCE ;
275
273
}
@@ -316,6 +314,8 @@ static inline int ompi_osc_rdma_gacc_amo (ompi_osc_rdma_module_t *module, ompi_o
316
314
ompi_osc_rdma_request_complete (request , MPI_SUCCESS );
317
315
}
318
316
317
+ free (to_free );
318
+
319
319
return OMPI_SUCCESS ;
320
320
}
321
321
@@ -331,6 +331,8 @@ static inline int ompi_osc_rdma_gacc_contig (ompi_osc_rdma_sync_t *sync, const v
331
331
char * ptr = NULL ;
332
332
int ret ;
333
333
334
+ request -> len = target_datatype -> super .size * module -> network_amo_max_count ;
335
+
334
336
OSC_RDMA_VERBOSE (MCA_BASE_VERBOSE_TRACE , "initiating accumulate on contiguous region of %lu bytes to remote address %" PRIx64
335
337
", sync %p" , len , target_address , (void * ) sync );
336
338
@@ -582,7 +584,7 @@ static inline int ompi_osc_rdma_gacc_master (ompi_osc_rdma_sync_t *sync, const v
582
584
}
583
585
584
586
ret = ompi_osc_rdma_gacc_contig (sync , source_iovec [source_iov_index ].iov_base , acc_len / target_primitive -> super .size ,
585
- target_primitive , NULL , 0 , NULL , & result_convertor , peer ,
587
+ target_primitive , NULL , 0 , NULL , result_datatype ? & result_convertor : NULL , peer ,
586
588
(uint64_t ) (intptr_t ) target_iovec [target_iov_index ].iov_base , target_handle ,
587
589
acc_len / target_primitive -> super .size , target_primitive , op , subreq );
588
590
if (OPAL_UNLIKELY (OMPI_SUCCESS != ret )) {
0 commit comments