2013-09-10 15:34:09 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Mellanox Technologies, Inc.
|
|
|
|
* All rights reserved.
|
2016-08-29 10:43:39 +09:00
|
|
|
* Copyright (c) 2016 Research Organization for Information Science
|
|
|
|
* and Technology (RIST). All rights reserved.
|
2013-09-10 15:34:09 +00:00
|
|
|
* $COPYRIGHT$
|
2015-06-23 20:59:57 -07:00
|
|
|
*
|
2013-09-10 15:34:09 +00:00
|
|
|
* Additional copyrights may follow
|
2015-06-23 20:59:57 -07:00
|
|
|
*
|
2013-09-10 15:34:09 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "oshmem_config.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "oshmem/constants.h"
|
|
|
|
#include "oshmem/op/op.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"
|
2015-07-06 16:46:12 +03:00
|
|
|
#include "oshmem/mca/memheap/base/base.h"
|
2013-09-10 15:34:09 +00:00
|
|
|
#include "oshmem/runtime/runtime.h"
|
|
|
|
|
|
|
|
#include "atomic_mxm.h"
|
|
|
|
|
|
|
|
int mca_atomic_mxm_fadd(void *target,
|
|
|
|
void *prev,
|
|
|
|
const void *value,
|
|
|
|
size_t nlong,
|
|
|
|
int pe,
|
|
|
|
struct oshmem_op_t *op)
|
|
|
|
{
|
|
|
|
mxm_send_req_t sreq;
|
2014-01-07 11:56:36 +00:00
|
|
|
static char dummy_buf[8];
|
2013-09-10 15:34:09 +00:00
|
|
|
|
2016-11-02 18:59:06 +02:00
|
|
|
mca_atomic_mxm_req_init(&sreq, pe, target, nlong);
|
2013-09-10 15:34:09 +00:00
|
|
|
|
2013-10-02 08:32:26 +00:00
|
|
|
memcpy(&sreq.op.atomic.value, value, nlong);
|
2016-11-02 18:59:06 +02:00
|
|
|
sreq.opcode = MXM_REQ_OP_ATOMIC_FADD;
|
2013-09-10 15:34:09 +00:00
|
|
|
if (NULL == prev) {
|
2014-01-07 11:56:36 +00:00
|
|
|
sreq.base.data.buffer.ptr = dummy_buf;
|
2013-09-10 15:34:09 +00:00
|
|
|
} else {
|
|
|
|
sreq.base.data.buffer.ptr = prev;
|
|
|
|
}
|
|
|
|
|
2016-11-02 18:59:06 +02:00
|
|
|
mca_atomic_mxm_post(&sreq);
|
2013-09-10 15:34:09 +00:00
|
|
|
|
|
|
|
return OSHMEM_SUCCESS;
|
|
|
|
}
|