Skip to content

Commit ba594de

Browse files
committed
osc/rdma: use extent of the appropriate datatype in ompi_osc_rdma_rget_accumulate_internal()
origin_datatype and target_datatype might be different and hence have different extent, so use either origin_extent or target_extent when appropriate. Refs #3569 Signed-off-by: Gilles Gouaillardet <[email protected]> (back-ported from commit 0f79259)
1 parent 58c6b3c commit ba594de

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

ompi/mca/osc/rdma/osc_rdma_accumulate.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ int ompi_osc_rdma_rget_accumulate_internal (ompi_osc_rdma_sync_t *sync, const vo
10161016
ompi_osc_rdma_module_t *module = sync->module;
10171017
mca_btl_base_registration_handle_t *target_handle;
10181018
uint64_t target_address;
1019-
ptrdiff_t lb, extent;
1019+
ptrdiff_t lb, origin_extent, target_extent;
10201020
int ret;
10211021

10221022
/* short-circuit case. note that origin_count may be 0 if op is MPI_NO_OP */
@@ -1068,20 +1068,22 @@ int ompi_osc_rdma_rget_accumulate_internal (ompi_osc_rdma_sync_t *sync, const vo
10681068
}
10691069
}
10701070

1071-
(void) ompi_datatype_get_extent (origin_datatype, &lb, &extent);
1071+
(void) ompi_datatype_get_extent (target_datatype, &lb, &target_extent);
10721072

1073-
ret = osc_rdma_get_remote_segment (module, peer, target_disp, extent * target_count, &target_address, &target_handle);
1073+
ret = osc_rdma_get_remote_segment (module, peer, target_disp, target_extent * target_count, &target_address, &target_handle);
10741074
if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) {
10751075
return ret;
10761076
}
10771077

1078-
if (module->acc_single_intrinsic && extent <= 8) {
1078+
(void) ompi_datatype_get_extent (origin_datatype, &lb, &origin_extent);
1079+
1080+
if (module->acc_single_intrinsic && origin_extent <= 8) {
10791081
if (module->acc_use_amo && ompi_datatype_is_predefined (origin_datatype)) {
10801082
if (NULL == result_addr) {
1081-
ret = ompi_osc_rdma_acc_single_atomic (sync, origin_addr, origin_datatype, extent, peer, target_address,
1083+
ret = ompi_osc_rdma_acc_single_atomic (sync, origin_addr, origin_datatype, origin_extent, peer, target_address,
10821084
target_handle, op, request);
10831085
} else {
1084-
ret = ompi_osc_rdma_fetch_and_op_atomic (sync, origin_addr, result_addr, origin_datatype, extent, peer, target_address,
1086+
ret = ompi_osc_rdma_fetch_and_op_atomic (sync, origin_addr, result_addr, origin_datatype, origin_extent, peer, target_address,
10851087
target_handle, op, request);
10861088
}
10871089

@@ -1090,7 +1092,7 @@ int ompi_osc_rdma_rget_accumulate_internal (ompi_osc_rdma_sync_t *sync, const vo
10901092
}
10911093
}
10921094

1093-
ret = ompi_osc_rdma_fetch_and_op_cas (sync, origin_addr, result_addr, origin_datatype, extent, peer, target_address,
1095+
ret = ompi_osc_rdma_fetch_and_op_cas (sync, origin_addr, result_addr, origin_datatype, origin_extent, peer, target_address,
10941096
target_handle, op, request);
10951097
if (OMPI_SUCCESS == ret) {
10961098
return OMPI_SUCCESS;

0 commit comments

Comments
 (0)