Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config/ompi_check_ucx.m4
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ AC_DEFUN([OMPI_CHECK_UCX],[
ucp_request_check_status, ucp_put_nb, ucp_get_nb],
[], [],
[#include <ucp/api/ucp.h>])
AC_CHECK_DECLS([UCP_ATOMIC_POST_OP_AND,
UCP_ATOMIC_POST_OP_OR,
UCP_ATOMIC_POST_OP_XOR,
UCP_ATOMIC_FETCH_OP_FAND,
UCP_ATOMIC_FETCH_OP_FOR,
UCP_ATOMIC_FETCH_OP_FXOR],
[], [],
[#include <ucp/api/ucp.h>])
CPPFLAGS=$old_CPPFLAGS

OPAL_SUMMARY_ADD([[Transports]],[[Open UCX]],[$1],[$ompi_check_ucx_happy])])])
Expand Down
74 changes: 73 additions & 1 deletion oshmem/include/pshmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,42 @@ OSHMEM_DECLSPEC long long pshmem_longlong_fadd(long long *target, long long valu
long long*: pshmem_longlong_fadd)(dst, val, pe)
#endif

/* Atomic Fetch&And */
OSHMEM_DECLSPEC int pshmem_int_atomic_fand(int *target, int value, int pe);
OSHMEM_DECLSPEC long pshmem_long_atomic_fand(long *target, long value, int pe);
OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fand(long long *target, long long value, int pe);
#if OSHMEMP_HAVE_C11
#define pshmem_atomic_fand(dst, val, pe) \
_Generic(&*(dst), \
int*: pshmem_int_atomic_fand, \
long*: pshmem_long_atomic_fand, \
long long*: pshmem_longlong_atomic_fand)(dst, val, pe)
#endif

/* Atomic Fetch&Or */
OSHMEM_DECLSPEC int pshmem_int_atomic_for(int *target, int value, int pe);
OSHMEM_DECLSPEC long pshmem_long_atomic_for(long *target, long value, int pe);
OSHMEM_DECLSPEC long long pshmem_longlong_atomic_for(long long *target, long long value, int pe);
#if OSHMEMP_HAVE_C11
#define pshmem_atomic_for(dst, val, pe) \
_Generic(&*(dst), \
int*: pshmem_int_atomic_for, \
long*: pshmem_long_atomic_for, \
long long*: pshmem_longlong_atomic_for)(dst, val, pe)
#endif

/* Atomic Fetch&Xor */
OSHMEM_DECLSPEC int pshmem_int_atomic_fxor(int *target, int value, int pe);
OSHMEM_DECLSPEC long pshmem_long_atomic_fxor(long *target, long value, int pe);
OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fxor(long long *target, long long value, int pe);
#if OSHMEMP_HAVE_C11
#define pshmem_atomic_fxor(dst, val, pe) \
_Generic(&*(dst), \
int*: pshmem_int_atomic_fxor, \
long*: pshmem_long_atomic_fxor, \
long long*: pshmem_longlong_atomic_fxor)(dst, val, pe)
#endif

/* Atomic Fetch */
OSHMEM_DECLSPEC int pshmem_int_fetch(const int *target, int pe);
OSHMEM_DECLSPEC long pshmem_long_fetch(const long *target, int pe);
Expand Down Expand Up @@ -406,7 +442,7 @@ OSHMEM_DECLSPEC long long pshmem_longlong_finc(long long *target, int pe);
long long*: pshmem_longlong_finc)(dst, val, pe)
#endif

/* Atomic Add*/
/* Atomic Add */
OSHMEM_DECLSPEC void pshmem_int_add(int *target, int value, int pe);
OSHMEM_DECLSPEC void pshmem_long_add(long *target, long value, int pe);
OSHMEM_DECLSPEC void pshmem_longlong_add(long long *target, long long value, int pe);
Expand All @@ -418,6 +454,42 @@ OSHMEM_DECLSPEC void pshmem_longlong_add(long long *target, long long value, int
long long*: pshmem_longlong_add)(dst, val, pe)
#endif

/* Atomic And */
OSHMEM_DECLSPEC void pshmem_int_atomic_and(int *target, int value, int pe);
OSHMEM_DECLSPEC void pshmem_long_atomic_and(long *target, long value, int pe);
OSHMEM_DECLSPEC void pshmem_longlong_atomic_and(long long *target, long long value, int pe);
#if OSHMEMP_HAVE_C11
#define pshmem_atomic_and(dst, val, pe) \
_Generic(&*(dst), \
int*: pshmem_int_atomic_and, \
long*: pshmem_long_atomic_and, \
long long*: pshmem_longlong_atomic_and)(dst, val, pe)
#endif

/* Atomic Or */
OSHMEM_DECLSPEC void pshmem_int_atomic_or(int *target, int value, int pe);
OSHMEM_DECLSPEC void pshmem_long_atomic_or(long *target, long value, int pe);
OSHMEM_DECLSPEC void pshmem_longlong_atomic_or(long long *target, long long value, int pe);
#if OSHMEMP_HAVE_C11
#define pshmem_atomic_or(dst, val, pe) \
_Generic(&*(dst), \
int*: pshmem_int_atomic_or, \
long*: pshmem_long_atomic_or, \
long long*: pshmem_longlong_atomic_or)(dst, val, pe)
#endif

/* Atomic Xor */
OSHMEM_DECLSPEC void pshmem_int_atomic_xor(int *target, int value, int pe);
OSHMEM_DECLSPEC void pshmem_long_atomic_xor(long *target, long value, int pe);
OSHMEM_DECLSPEC void pshmem_longlong_atomic_xor(long long *target, long long value, int pe);
#if OSHMEMP_HAVE_C11
#define pshmem_atomic_xor(dst, val, pe) \
_Generic(&*(dst), \
int*: pshmem_int_atomic_xor, \
long*: pshmem_long_atomic_xor, \
long long*: pshmem_longlong_atomic_xor)(dst, val, pe)
#endif

/* Atomic Inc */
OSHMEM_DECLSPEC void pshmem_int_inc(int *target, int pe);
OSHMEM_DECLSPEC void pshmem_long_inc(long *target, int pe);
Expand Down
26 changes: 25 additions & 1 deletion oshmem/include/pshmemx.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ OSHMEM_DECLSPEC int64_t pshmemx_int64_cswap(int64_t *target, int64_t cond, int64
OSHMEM_DECLSPEC int32_t pshmemx_int32_fadd(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t pshmemx_int64_fadd(int64_t *target, int64_t value, int pe);

/* Atomic Fetch&And */
OSHMEM_DECLSPEC int32_t pshmemx_int32_atomic_fand(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t pshmemx_int64_atomic_fand(int64_t *target, int64_t value, int pe);

/* Atomic Fetch&Or */
OSHMEM_DECLSPEC int32_t pshmemx_int32_atomic_for(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t pshmemx_int64_atomic_for(int64_t *target, int64_t value, int pe);

/* Atomic Fetch&Xor */
OSHMEM_DECLSPEC int32_t pshmemx_int32_atomic_fxor(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t pshmemx_int64_atomic_fxor(int64_t *target, int64_t value, int pe);

/* Atomic Fetch */
OSHMEM_DECLSPEC int32_t pshmemx_int32_fetch(const int32_t *target, int pe);
OSHMEM_DECLSPEC int64_t pshmemx_int64_fetch(const int64_t *target, int pe);
Expand All @@ -97,10 +109,22 @@ OSHMEM_DECLSPEC int64_t pshmemx_int64_fetch(const int64_t *target, int pe);
OSHMEM_DECLSPEC int32_t pshmemx_int32_finc(int32_t *target, int pe);
OSHMEM_DECLSPEC int64_t pshmemx_int64_finc(int64_t *target, int pe);

/* Atomic Add*/
/* Atomic Add */
OSHMEM_DECLSPEC void pshmemx_int32_add(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void pshmemx_int64_add(int64_t *target, int64_t value, int pe);

/* Atomic And */
OSHMEM_DECLSPEC void pshmemx_int32_atomic_and(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void pshmemx_int64_atomic_and(int64_t *target, int64_t value, int pe);

/* Atomic Or */
OSHMEM_DECLSPEC void pshmemx_int32_atomic_or(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void pshmemx_int64_atomic_or(int64_t *target, int64_t value, int pe);

/* Atomic Xor */
OSHMEM_DECLSPEC void pshmemx_int32_atomic_xor(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void pshmemx_int64_atomic_xor(int64_t *target, int64_t value, int pe);

/* Atomic Inc */
OSHMEM_DECLSPEC void pshmemx_int32_inc(int32_t *target, int pe);
OSHMEM_DECLSPEC void pshmemx_int64_inc(int64_t *target, int pe);
Expand Down
74 changes: 73 additions & 1 deletion oshmem/include/shmem.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,42 @@ OSHMEM_DECLSPEC long long shmem_longlong_fadd(long long *target, long long value
long long*: shmem_longlong_fadd)(dst, val, pe)
#endif

/* Atomic Fetch&And */
OSHMEM_DECLSPEC int shmem_int_atomic_fand(int *target, int value, int pe);
OSHMEM_DECLSPEC long shmem_long_atomic_fand(long *target, long value, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_atomic_fand(long long *target, long long value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_atomic_fand(dst, val, pe) \
_Generic(&*(dst), \
int*: shmem_int_atomic_fand, \
long*: shmem_long_atomic_fand, \
long long*: shmem_longlong_atomic_fand)(dst, val, pe)
#endif

/* Atomic Fetch&Or */
OSHMEM_DECLSPEC int shmem_int_atomic_for(int *target, int value, int pe);
OSHMEM_DECLSPEC long shmem_long_atomic_for(long *target, long value, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_atomic_for(long long *target, long long value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_atomic_for(dst, val, pe) \
_Generic(&*(dst), \
int*: shmem_int_atomic_for, \
long*: shmem_long_atomic_for, \
long long*: shmem_longlong_atomic_for)(dst, val, pe)
#endif

/* Atomic Fetch&Xor */
OSHMEM_DECLSPEC int shmem_int_atomic_fxor(int *target, int value, int pe);
OSHMEM_DECLSPEC long shmem_long_atomic_fxor(long *target, long value, int pe);
OSHMEM_DECLSPEC long long shmem_longlong_atomic_fxor(long long *target, long long value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_atomic_fxor(dst, val, pe) \
_Generic(&*(dst), \
int*: shmem_int_atomic_fxor, \
long*: shmem_long_atomic_fxor, \
long long*: shmem_longlong_atomic_fxor)(dst, val, pe)
#endif

/* Atomic Fetch */
OSHMEM_DECLSPEC int shmem_int_fetch(const int *target, int pe);
OSHMEM_DECLSPEC long shmem_long_fetch(const long *target, int pe);
Expand Down Expand Up @@ -491,7 +527,7 @@ OSHMEM_DECLSPEC long long shmem_longlong_finc(long long *target, int pe);
long long*: shmem_longlong_finc)(dst, pe)
#endif

/* Atomic Add*/
/* Atomic Add */
OSHMEM_DECLSPEC void shmem_int_add(int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_long_add(long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_longlong_add(long long *target, long long value, int pe);
Expand All @@ -503,6 +539,42 @@ OSHMEM_DECLSPEC void shmem_longlong_add(long long *target, long long value, int
long long*: shmem_longlong_add)(dst, val, pe)
#endif

/* Atomic And */
OSHMEM_DECLSPEC void shmem_int_atomic_and(int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_long_atomic_and(long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_longlong_atomic_and(long long *target, long long value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_atomic_and(dst, val, pe) \
_Generic(&*(dst), \
int*: shmem_int_atomic_and, \
long*: shmem_long_atomic_and, \
long long*: shmem_longlong_atomic_and)(dst, val, pe)
#endif

/* Atomic Or */
OSHMEM_DECLSPEC void shmem_int_atomic_or(int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_long_atomic_or(long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_longlong_atomic_or(long long *target, long long value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_atomic_or(dst, val, pe) \
_Generic(&*(dst), \
int*: shmem_int_atomic_or, \
long*: shmem_long_atomic_or, \
long long*: shmem_longlong_atomic_or)(dst, val, pe)
#endif

/* Atomic Xor */
OSHMEM_DECLSPEC void shmem_int_atomic_xor(int *target, int value, int pe);
OSHMEM_DECLSPEC void shmem_long_atomic_xor(long *target, long value, int pe);
OSHMEM_DECLSPEC void shmem_longlong_atomic_xor(long long *target, long long value, int pe);
#if OSHMEM_HAVE_C11
#define shmem_atomic_xor(dst, val, pe) \
_Generic(&*(dst), \
int*: shmem_int_atomic_xor, \
long*: shmem_long_atomic_xor, \
long long*: shmem_longlong_atomic_xor)(dst, val, pe)
#endif

/* Atomic Inc */
OSHMEM_DECLSPEC void shmem_int_inc(int *target, int pe);
OSHMEM_DECLSPEC void shmem_long_inc(long *target, int pe);
Expand Down
26 changes: 25 additions & 1 deletion oshmem/include/shmemx.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ OSHMEM_DECLSPEC int64_t shmemx_int64_cswap(int64_t *target, int64_t cond, int64_
OSHMEM_DECLSPEC int32_t shmemx_int32_fadd(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmemx_int64_fadd(int64_t *target, int64_t value, int pe);

/* Atomic Fetch&And */
OSHMEM_DECLSPEC int32_t shmemx_int32_atomic_fand(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmemx_int64_atomic_fand(int64_t *target, int64_t value, int pe);

/* Atomic Fetch&Or */
OSHMEM_DECLSPEC int32_t shmemx_int32_atomic_for(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmemx_int64_atomic_for(int64_t *target, int64_t value, int pe);

/* Atomic Fetch&Xor */
OSHMEM_DECLSPEC int32_t shmemx_int32_atomic_fxor(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC int64_t shmemx_int64_atomic_fxor(int64_t *target, int64_t value, int pe);

/* Atomic Fetch */
OSHMEM_DECLSPEC int32_t shmemx_int32_fetch(const int32_t *target, int pe);
OSHMEM_DECLSPEC int64_t shmemx_int64_fetch(const int64_t *target, int pe);
Expand All @@ -84,10 +96,22 @@ OSHMEM_DECLSPEC int64_t shmemx_int64_fetch(const int64_t *target, int pe);
OSHMEM_DECLSPEC int32_t shmemx_int32_finc(int32_t *target, int pe);
OSHMEM_DECLSPEC int64_t shmemx_int64_finc(int64_t *target, int pe);

/* Atomic Add*/
/* Atomic Add */
OSHMEM_DECLSPEC void shmemx_int32_add(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmemx_int64_add(int64_t *target, int64_t value, int pe);

/* Atomic And */
OSHMEM_DECLSPEC void shmemx_int32_atomic_and(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmemx_int64_atomic_and(int64_t *target, int64_t value, int pe);

/* Atomic Or */
OSHMEM_DECLSPEC void shmemx_int32_atomic_or(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmemx_int64_atomic_or(int64_t *target, int64_t value, int pe);

/* Atomic Xor */
OSHMEM_DECLSPEC void shmemx_int32_atomic_xor(int32_t *target, int32_t value, int pe);
OSHMEM_DECLSPEC void shmemx_int64_atomic_xor(int64_t *target, int64_t value, int pe);

/* Atomic Inc */
OSHMEM_DECLSPEC void shmemx_int32_inc(int32_t *target, int pe);
OSHMEM_DECLSPEC void shmemx_int64_inc(int64_t *target, int pe);
Expand Down
70 changes: 70 additions & 0 deletions oshmem/mca/atomic/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,49 @@ BEGIN_C_DECLS

#define OSHMEM_ATOMIC_PTR_2_INT(ptr, size) ((size) == 8 ? *(uint64_t*)(ptr) : *(uint32_t*)(ptr))

#define OSHMEM_TYPE_OP(type_name, type, prefix, op) \
void prefix##type_name##_atomic_##op(type *target, type value, int pe) \
{ \
int rc = OSHMEM_SUCCESS; \
size_t size = 0; \
\
RUNTIME_CHECK_INIT(); \
RUNTIME_CHECK_PE(pe); \
RUNTIME_CHECK_ADDR(target); \
\
size = sizeof(value); \
rc = MCA_ATOMIC_CALL(op( \
(void*)target, \
value, \
size, \
pe)); \
RUNTIME_CHECK_RC(rc); \
\
return; \
}

#define OSHMEM_TYPE_FOP(type_name, type, prefix, op) \
type prefix##type_name##_atomic_##op(type *target, type value, int pe) \
{ \
int rc = OSHMEM_SUCCESS; \
size_t size = 0; \
type out_value; \
\
RUNTIME_CHECK_INIT(); \
RUNTIME_CHECK_PE(pe); \
RUNTIME_CHECK_ADDR(target); \
\
size = sizeof(out_value); \
rc = MCA_ATOMIC_CALL(op( \
(void*)target, \
(void*)&out_value, \
value, \
size, \
pe)); \
RUNTIME_CHECK_RC(rc); \
\
return out_value; \
}
/* ******************************************************************** */

struct oshmem_op_t;
Expand Down Expand Up @@ -92,11 +135,38 @@ struct mca_atomic_base_module_1_0_0_t {
uint64_t value,
size_t size,
int pe);
int (*atomic_and)(void *target,
uint64_t value,
size_t size,
int pe);
int (*atomic_or)(void *target,
uint64_t value,
size_t size,
int pe);
int (*atomic_xor)(void *target,
uint64_t value,
size_t size,
int pe);
int (*atomic_fadd)(void *target,
void *prev,
uint64_t value,
size_t size,
int pe);
int (*atomic_fand)(void *target,
void *prev,
uint64_t value,
size_t size,
int pe);
int (*atomic_for)(void *target,
void *prev,
uint64_t value,
size_t size,
int pe);
int (*atomic_fxor)(void *target,
void *prev,
uint64_t value,
size_t size,
int pe);
int (*atomic_swap)(void *target,
void *prev,
uint64_t value,
Expand Down
Loading