Skip to content

Commit 1a3c6bb

Browse files
committed
UCX osc: re-use value returned by cswap to save additional get
Signed-off-by: Joseph Schuchart <[email protected]>
1 parent 8606a02 commit 1a3c6bb

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

ompi/mca/osc/ucx/osc_ucx_comm.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -417,21 +417,22 @@ static int atomic_op_cswap(
417417
for (int i = 0; i < origin_count; ++i) {
418418

419419
uint64_t tmp_val;
420-
do {
421-
uint64_t target_val = 0;
420+
uint64_t target_val = 0;
422421

423-
// get the value from the origin
424-
ret = opal_common_ucx_wpmem_putget(module->mem, OPAL_COMMON_UCX_GET,
425-
target, &target_val, origin_dt_bytes,
426-
remote_addr);
427-
if (ret != OMPI_SUCCESS) {
428-
return ret;
429-
}
422+
// get the value from the origin
423+
ret = opal_common_ucx_wpmem_putget(module->mem, OPAL_COMMON_UCX_GET,
424+
target, &target_val, origin_dt_bytes,
425+
remote_addr);
426+
if (ret != OMPI_SUCCESS) {
427+
return ret;
428+
}
430429

431-
ret = opal_common_ucx_wpmem_flush(module->mem, OPAL_COMMON_UCX_SCOPE_EP, target);
432-
if (ret != OMPI_SUCCESS) {
433-
return ret;
434-
}
430+
ret = opal_common_ucx_wpmem_flush(module->mem, OPAL_COMMON_UCX_SCOPE_EP, target);
431+
if (ret != OMPI_SUCCESS) {
432+
return ret;
433+
}
434+
435+
do {
435436

436437
tmp_val = target_val;
437438
// compute the result value

0 commit comments

Comments
 (0)