Skip to content

Commit 60bf641

Browse files
authored
Merge pull request #3599 from ggouaillardet/topic/v2.x/ompi_osc_rdma_rget_accumulate_internal
v2.x: osc/rdma: use extent of the appropriate datatype in ompi_osc_rdma_rge…
2 parents a0fb112 + 4ad8c07 commit 60bf641

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

ompi/mca/osc/rdma/osc_rdma_accumulate.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,7 @@ int ompi_osc_rdma_compare_and_swap (const void *origin_addr, const void *compare
968968
mca_btl_base_registration_handle_t *target_handle;
969969
ompi_osc_rdma_sync_t *sync;
970970
uint64_t target_address;
971+
ptrdiff_t true_lb, true_extent;
971972
int ret;
972973

973974
OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "cswap: 0x%lx, 0x%lx, 0x%lx, %s, %d, %d, %s",
@@ -979,7 +980,12 @@ int ompi_osc_rdma_compare_and_swap (const void *origin_addr, const void *compare
979980
return OMPI_ERR_RMA_SYNC;
980981
}
981982

982-
ret = osc_rdma_get_remote_segment (module, peer, target_disp, dt->super.size, &target_address, &target_handle);
983+
ret = ompi_datatype_get_true_extent(dt, &true_lb, &true_extent);
984+
if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) {
985+
return ret;
986+
}
987+
988+
ret = osc_rdma_get_remote_segment (module, peer, target_disp, true_lb+true_extent, &target_address, &target_handle);
983989
if (OPAL_UNLIKELY(OPAL_SUCCESS != ret)) {
984990
return ret;
985991
}
@@ -1016,7 +1022,7 @@ int ompi_osc_rdma_rget_accumulate_internal (ompi_osc_rdma_sync_t *sync, const vo
10161022
ompi_osc_rdma_module_t *module = sync->module;
10171023
mca_btl_base_registration_handle_t *target_handle;
10181024
uint64_t target_address;
1019-
ptrdiff_t lb, extent;
1025+
ptrdiff_t lb, origin_extent, target_span;
10201026
int ret;
10211027

10221028
/* short-circuit case. note that origin_count may be 0 if op is MPI_NO_OP */
@@ -1068,20 +1074,24 @@ int ompi_osc_rdma_rget_accumulate_internal (ompi_osc_rdma_sync_t *sync, const vo
10681074
}
10691075
}
10701076

1071-
(void) ompi_datatype_get_extent (origin_datatype, &lb, &extent);
1077+
target_span = opal_datatype_span(&target_datatype->super, target_count, &lb);
10721078

1073-
ret = osc_rdma_get_remote_segment (module, peer, target_disp, extent * target_count, &target_address, &target_handle);
1079+
// a buffer defined by (buf, count, dt)
1080+
// will have data starting at buf+offset and ending len bytes later:
1081+
ret = osc_rdma_get_remote_segment (module, peer, target_disp, target_span+lb, &target_address, &target_handle);
10741082
if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) {
10751083
return ret;
10761084
}
10771085

1078-
if (module->acc_single_intrinsic && extent <= 8) {
1086+
(void) ompi_datatype_get_extent (origin_datatype, &lb, &origin_extent);
1087+
1088+
if (module->acc_single_intrinsic && origin_extent <= 8) {
10791089
if (module->acc_use_amo && ompi_datatype_is_predefined (origin_datatype)) {
10801090
if (NULL == result_addr) {
1081-
ret = ompi_osc_rdma_acc_single_atomic (sync, origin_addr, origin_datatype, extent, peer, target_address,
1091+
ret = ompi_osc_rdma_acc_single_atomic (sync, origin_addr, origin_datatype, origin_extent, peer, target_address,
10821092
target_handle, op, request);
10831093
} else {
1084-
ret = ompi_osc_rdma_fetch_and_op_atomic (sync, origin_addr, result_addr, origin_datatype, extent, peer, target_address,
1094+
ret = ompi_osc_rdma_fetch_and_op_atomic (sync, origin_addr, result_addr, origin_datatype, origin_extent, peer, target_address,
10851095
target_handle, op, request);
10861096
}
10871097

@@ -1090,7 +1100,7 @@ int ompi_osc_rdma_rget_accumulate_internal (ompi_osc_rdma_sync_t *sync, const vo
10901100
}
10911101
}
10921102

1093-
ret = ompi_osc_rdma_fetch_and_op_cas (sync, origin_addr, result_addr, origin_datatype, extent, peer, target_address,
1103+
ret = ompi_osc_rdma_fetch_and_op_cas (sync, origin_addr, result_addr, origin_datatype, origin_extent, peer, target_address,
10941104
target_handle, op, request);
10951105
if (OMPI_SUCCESS == ret) {
10961106
return OMPI_SUCCESS;

ompi/mca/osc/rdma/osc_rdma_comm.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,7 @@ static inline int ompi_osc_rdma_get_w_req (ompi_osc_rdma_sync_t *sync, void *ori
814814
ompi_osc_rdma_module_t *module = sync->module;
815815
mca_btl_base_registration_handle_t *source_handle;
816816
uint64_t source_address;
817+
ptrdiff_t source_span, source_lb;
817818
int ret;
818819

819820
/* short-circuit case */
@@ -825,7 +826,11 @@ static inline int ompi_osc_rdma_get_w_req (ompi_osc_rdma_sync_t *sync, void *ori
825826
return OMPI_SUCCESS;
826827
}
827828

828-
ret = osc_rdma_get_remote_segment (module, peer, source_disp, source_datatype->super.size * source_count,
829+
// a buffer defined by (buf, count, dt)
830+
// will have data starting at buf+offset and ending len bytes later:
831+
source_span = opal_datatype_span(&source_datatype->super, source_count, &source_lb);
832+
833+
ret = osc_rdma_get_remote_segment (module, peer, source_disp, source_span+source_lb,
829834
&source_address, &source_handle);
830835
if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) {
831836
return ret;

0 commit comments

Comments
 (0)