Skip to content

Commit 4db2a50

Browse files
authored
Merge pull request #8469 from hjelmn/fix_some_errors_in_osc_rdma_that_cause_mtt_failures
osc/rdma: fix amo-based accumulate
2 parents 9c374e1 + d55504f commit 4db2a50

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

ompi/mca/osc/rdma/osc_rdma_accumulate.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,16 +260,14 @@ static inline int ompi_osc_rdma_gacc_amo (ompi_osc_rdma_module_t *module, ompi_o
260260
{
261261
const bool use_amo = module->acc_use_amo;
262262
const size_t dt_size = datatype->super.size;
263+
void *to_free = NULL;
263264
uint64_t offset = 0;
264265
int ret;
265266

266267
OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "using network atomics for accumulate operation with count %d", count);
267268

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);
273271
if (OPAL_UNLIKELY(NULL == result)) {
274272
return OMPI_ERR_OUT_OF_RESOURCE;
275273
}
@@ -316,6 +314,8 @@ static inline int ompi_osc_rdma_gacc_amo (ompi_osc_rdma_module_t *module, ompi_o
316314
ompi_osc_rdma_request_complete (request, MPI_SUCCESS);
317315
}
318316

317+
free (to_free);
318+
319319
return OMPI_SUCCESS;
320320
}
321321

@@ -331,6 +331,8 @@ static inline int ompi_osc_rdma_gacc_contig (ompi_osc_rdma_sync_t *sync, const v
331331
char *ptr = NULL;
332332
int ret;
333333

334+
request->len = target_datatype->super.size * module->network_amo_max_count;
335+
334336
OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "initiating accumulate on contiguous region of %lu bytes to remote address %" PRIx64
335337
", sync %p", len, target_address, (void *) sync);
336338

@@ -582,7 +584,7 @@ static inline int ompi_osc_rdma_gacc_master (ompi_osc_rdma_sync_t *sync, const v
582584
}
583585

584586
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,
586588
(uint64_t) (intptr_t) target_iovec[target_iov_index].iov_base, target_handle,
587589
acc_len / target_primitive->super.size, target_primitive, op, subreq);
588590
if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) {

0 commit comments

Comments
 (0)