This source file includes following definitions.
- mca_atomic_ucx_cswap
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 #include "oshmem_config.h"
  12 #include <stdio.h>
  13 #include <stdlib.h>
  14 
  15 #include "oshmem/constants.h"
  16 #include "oshmem/mca/atomic/atomic.h"
  17 #include "oshmem/mca/atomic/base/base.h"
  18 #include "oshmem/runtime/runtime.h"
  19 
  20 #include "atomic_ucx.h"
  21 
  22 int mca_atomic_ucx_cswap(shmem_ctx_t ctx,
  23                          void *target,
  24                          uint64_t *prev,
  25                          uint64_t cond,
  26                          uint64_t value,
  27                          size_t size,
  28                          int pe)
  29 {
  30     ucs_status_ptr_t status_ptr;
  31     spml_ucx_mkey_t *ucx_mkey;
  32     uint64_t rva;
  33     mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx;
  34 
  35     if ((8 != size) && (4 != size)) {
  36         ATOMIC_ERROR("[#%d] Type size must be 4 or 8 bytes.", my_pe);
  37         return OSHMEM_ERROR;
  38     }
  39 
  40     assert(NULL != prev);
  41 
  42     *prev      = value;
  43     ucx_mkey   = mca_spml_ucx_get_mkey(ctx, pe, target, (void *)&rva, mca_spml_self);
  44     status_ptr = ucp_atomic_fetch_nb(ucx_ctx->ucp_peers[pe].ucp_conn,
  45                                      UCP_ATOMIC_FETCH_OP_CSWAP, cond, prev, size,
  46                                      rva, ucx_mkey->rkey,
  47                                      opal_common_ucx_empty_complete_cb);
  48     return opal_common_ucx_wait_request(status_ptr, ucx_ctx->ucp_worker,
  49                                         "ucp_atomic_fetch_nb");
  50 }