diff --git a/ompi/mca/osc/ucx/osc_ucx_passive_target.c b/ompi/mca/osc/ucx/osc_ucx_passive_target.c index 38a7dccb27..89920a2991 100644 --- a/ompi/mca/osc/ucx/osc_ucx_passive_target.c +++ b/ompi/mca/osc/ucx/osc_ucx_passive_target.c @@ -90,21 +90,19 @@ static inline int start_exclusive(ompi_osc_ucx_module_t *module, int target) { } static inline int end_exclusive(ompi_osc_ucx_module_t *module, int target) { - uint64_t result_value = 0; ucp_ep_h ep = OSC_UCX_GET_EP(module->comm, target); ucp_rkey_h rkey = (module->state_info_array)[target].rkey; uint64_t remote_addr = (module->state_info_array)[target].addr + OSC_UCX_STATE_LOCK_OFFSET; - int ret; + ucs_status_t status; - ret = opal_common_ucx_atomic_fetch(ep, UCP_ATOMIC_FETCH_OP_SWAP, TARGET_LOCK_UNLOCKED, - &result_value, sizeof(result_value), - remote_addr, rkey, mca_osc_ucx_component.ucp_worker); - if (OMPI_SUCCESS != ret) { - return ret; + status = ucp_atomic_post(ep, UCP_ATOMIC_POST_OP_ADD, + -((int64_t)TARGET_LOCK_EXCLUSIVE), sizeof(uint64_t), + remote_addr, rkey); + if (UCS_OK != status) { + OSC_UCX_VERBOSE(1, "ucp_atomic_post(OP_ADD) failed: %d", status); + return OMPI_ERROR; } - assert(result_value >= TARGET_LOCK_EXCLUSIVE); - return OMPI_SUCCESS; }