1
1
openmpi/oshmem/mca/atomic/mxm/atomic_mxm_cswap.c
Ralph Castain 1e2019ce2a Revert "Update to sync with OMPI master and cleanup to build"
This reverts commit cb55c88a8b7817d5891ff06a447ea190b0e77479.
2016-11-22 15:03:20 -08:00

53 строки
1.3 KiB
C

/*
* Copyright (c) 2013 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "oshmem_config.h"
#include <stdio.h>
#include <stdlib.h>
#include "oshmem/constants.h"
#include "oshmem/mca/spml/spml.h"
#include "oshmem/mca/atomic/atomic.h"
#include "oshmem/mca/atomic/base/base.h"
#include "oshmem/mca/memheap/memheap.h"
#include "oshmem/mca/memheap/base/base.h"
#include "oshmem/runtime/runtime.h"
#include "atomic_mxm.h"
int mca_atomic_mxm_cswap(void *target,
void *prev,
const void *cond,
const void *value,
size_t nlong,
int pe)
{
mxm_send_req_t sreq;
mca_atomic_mxm_req_init(&sreq, pe, target, nlong);
sreq.base.data.buffer.ptr = (void *) value;
if (NULL == cond) {
sreq.opcode = MXM_REQ_OP_ATOMIC_SWAP;
} else {
memcpy(&sreq.op.atomic.value, cond, nlong);
sreq.opcode = MXM_REQ_OP_ATOMIC_CSWAP;
}
mca_atomic_mxm_post(&sreq);
memcpy(prev, value, nlong);
return OSHMEM_SUCCESS;
}