From 3a034352feb26ef68d5f2f366ab5faaed800954c Mon Sep 17 00:00:00 2001 From: Alex Mikheev Date: Thu, 22 Sep 2016 10:19:57 +0300 Subject: [PATCH] OSHMEM: v1.3: adds shmem_fetch and shmem_set AMOs The commit adds atomic set and fetch functions as described in oshmem 1.3 spec. --- oshmem/include/pshmem.h | 15 ++++ oshmem/include/pshmemx.h | 18 ++++ oshmem/include/shmem.h.in | 14 ++++ oshmem/include/shmemx.h | 17 ++++ oshmem/shmem/c/Makefile.am | 2 + oshmem/shmem/c/profile/Makefile.am | 2 + oshmem/shmem/c/profile/defines.h | 17 ++++ oshmem/shmem/c/shmem_fetch.c | 71 ++++++++++++++++ oshmem/shmem/c/shmem_set.c | 66 +++++++++++++++ oshmem/shmem/fortran/Makefile.am | 8 ++ oshmem/shmem/fortran/profile/Makefile.am | 8 ++ oshmem/shmem/fortran/profile/defines.h | 32 +++++++ .../shmem/fortran/profile/prototypes_pshmem.h | 14 ++++ oshmem/shmem/fortran/prototypes_shmem.h | 13 +++ oshmem/shmem/fortran/shmem_int4_fetch_f.c | 51 ++++++++++++ oshmem/shmem/fortran/shmem_int4_set_f.c | 46 ++++++++++ oshmem/shmem/fortran/shmem_int8_fetch_f.c | 51 ++++++++++++ oshmem/shmem/fortran/shmem_int8_set_f.c | 46 ++++++++++ oshmem/shmem/fortran/shmem_real4_fetch_f.c | 51 ++++++++++++ oshmem/shmem/fortran/shmem_real4_set_f.c | 47 +++++++++++ oshmem/shmem/fortran/shmem_real8_fetch_f.c | 51 ++++++++++++ oshmem/shmem/fortran/shmem_real8_set_f.c | 46 ++++++++++ oshmem/shmem/man/man3/Makefile.extra | 14 ++++ oshmem/shmem/man/man3/shmem_double_fetch.3in | 1 + oshmem/shmem/man/man3/shmem_double_set.3in | 1 + oshmem/shmem/man/man3/shmem_float_fetch.3in | 1 + oshmem/shmem/man/man3/shmem_float_set.3in | 1 + oshmem/shmem/man/man3/shmem_int_fetch.3in | 83 +++++++++++++++++++ oshmem/shmem/man/man3/shmem_int_set.3in | 77 +++++++++++++++++ oshmem/shmem/man/man3/shmem_long_fetch.3in | 1 + oshmem/shmem/man/man3/shmem_long_set.3in | 1 + .../shmem/man/man3/shmem_longlong_fetch.3in | 1 + oshmem/shmem/man/man3/shmem_longlong_set.3in | 1 + 33 files changed, 868 insertions(+) create mode 100644 oshmem/shmem/c/shmem_fetch.c create mode 100644 oshmem/shmem/c/shmem_set.c create mode 100644 oshmem/shmem/fortran/shmem_int4_fetch_f.c create mode 100644 oshmem/shmem/fortran/shmem_int4_set_f.c create mode 100644 oshmem/shmem/fortran/shmem_int8_fetch_f.c create mode 100644 oshmem/shmem/fortran/shmem_int8_set_f.c create mode 100644 oshmem/shmem/fortran/shmem_real4_fetch_f.c create mode 100644 oshmem/shmem/fortran/shmem_real4_set_f.c create mode 100644 oshmem/shmem/fortran/shmem_real8_fetch_f.c create mode 100644 oshmem/shmem/fortran/shmem_real8_set_f.c create mode 100644 oshmem/shmem/man/man3/shmem_double_fetch.3in create mode 100644 oshmem/shmem/man/man3/shmem_double_set.3in create mode 100644 oshmem/shmem/man/man3/shmem_float_fetch.3in create mode 100644 oshmem/shmem/man/man3/shmem_float_set.3in create mode 100644 oshmem/shmem/man/man3/shmem_int_fetch.3in create mode 100644 oshmem/shmem/man/man3/shmem_int_set.3in create mode 100644 oshmem/shmem/man/man3/shmem_long_fetch.3in create mode 100644 oshmem/shmem/man/man3/shmem_long_set.3in create mode 100644 oshmem/shmem/man/man3/shmem_longlong_fetch.3in create mode 100644 oshmem/shmem/man/man3/shmem_longlong_set.3in diff --git a/oshmem/include/pshmem.h b/oshmem/include/pshmem.h index f24f751644..3076552a5e 100644 --- a/oshmem/include/pshmem.h +++ b/oshmem/include/pshmem.h @@ -210,6 +210,13 @@ OSHMEM_DECLSPEC int pshmem_int_swap(int *target, int value, int pe); OSHMEM_DECLSPEC long pshmem_long_swap(long *target, long value, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_swap(long long*target, long long value, int pe); +/* Atomic set */ +OSHMEM_DECLSPEC void pshmem_int_set(int *target, int value, int pe); +OSHMEM_DECLSPEC void pshmem_long_set(long *target, long value, int pe); +OSHMEM_DECLSPEC void pshmem_longlong_set(long long*target, long long value, int pe); +OSHMEM_DECLSPEC void pshmem_float_set(float *target, float value, int pe); +OSHMEM_DECLSPEC void pshmem_double_set(double *target, double value, int pe); + /* Atomic conditional swap */ OSHMEM_DECLSPEC int pshmem_int_cswap(int *target, int cond, int value, int pe); OSHMEM_DECLSPEC long pshmem_long_cswap(long *target, long cond, long value, int pe); @@ -220,6 +227,14 @@ OSHMEM_DECLSPEC int pshmem_int_fadd(int *target, int value, int pe); OSHMEM_DECLSPEC long pshmem_long_fadd(long *target, long value, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_fadd(long long *target, long long value, int pe); +/* Atomic Fetch */ +OSHMEM_DECLSPEC int pshmem_int_fetch(const int *target, int pe); +OSHMEM_DECLSPEC long pshmem_long_fetch(const long *target, int pe); +OSHMEM_DECLSPEC long long pshmem_longlong_fetch(const long long *target, int pe); +OSHMEM_DECLSPEC float pshmem_float_fetch(const float *target, int pe); +OSHMEM_DECLSPEC double pshmem_double_fetch(const double *target, int pe); + + /* Atomic Fetch&Inc */ OSHMEM_DECLSPEC int pshmem_int_finc(int *target, int pe); OSHMEM_DECLSPEC long pshmem_long_finc(long *target, int pe); diff --git a/oshmem/include/pshmemx.h b/oshmem/include/pshmemx.h index 28644b5835..d316486827 100644 --- a/oshmem/include/pshmemx.h +++ b/oshmem/include/pshmemx.h @@ -81,6 +81,10 @@ OSHMEM_DECLSPEC void pshmemx_iget16(void* target, const void* source, ptrdiff_t OSHMEM_DECLSPEC int32_t pshmemx_int32_swap(int32_t *target, int32_t value, int pe); OSHMEM_DECLSPEC int64_t pshmemx_int64_swap(int64_t *target, int64_t value, int pe); +/*Atomic set */ +OSHMEM_DECLSPEC void pshmemx_int32_set(int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC void pshmemx_int64_set(int64_t *target, int64_t value, int pe); + /* Atomic conditional swap */ OSHMEM_DECLSPEC int32_t pshmemx_int32_cswap(int32_t *target, int32_t cond, int32_t value, int pe); OSHMEM_DECLSPEC int64_t pshmemx_int64_cswap(int64_t *target, int64_t cond, int64_t value, int pe); @@ -89,6 +93,10 @@ 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 */ +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); + /* Atomic Fetch&Inc */ OSHMEM_DECLSPEC int32_t pshmemx_int32_finc(int32_t *target, int pe); OSHMEM_DECLSPEC int64_t pshmemx_int64_finc(int64_t *target, int pe); @@ -160,15 +168,25 @@ OSHMEM_DECLSPEC void pshmemx_int64_prod_to_all(int64_t *target, const int64_t *s #define pshmem_int32_swap pshmemx_int32_swap #define pshmem_int64_swap pshmemx_int64_swap + +#define pshmem_int32_set pshmemx_int32_set +#define pshmem_int64_set pshmemx_int64_set + #define pshmem_int32_cswap pshmemx_int32_cswap #define pshmem_int64_cswap pshmemx_int64_cswap #define pshmem_int32_fadd pshmemx_int32_fadd #define pshmem_int64_fadd pshmemx_int64_fadd + +#define pshmem_int32_fetch pshmemx_int32_fetch +#define pshmem_int64_fetch pshmemx_int64_fetch + #define pshmem_int32_finc pshmemx_int32_finc #define pshmem_int64_finc pshmemx_int64_finc + #define pshmem_int32_add pshmemx_int32_add #define pshmem_int64_add pshmemx_int64_add + #define pshmem_int32_inc pshmemx_int32_inc #define pshmem_int64_inc pshmemx_int64_inc diff --git a/oshmem/include/shmem.h.in b/oshmem/include/shmem.h.in index a078fd6580..aba55d50ef 100644 --- a/oshmem/include/shmem.h.in +++ b/oshmem/include/shmem.h.in @@ -275,6 +275,13 @@ OSHMEM_DECLSPEC int shmem_int_swap(int *target, int value, int pe); OSHMEM_DECLSPEC long shmem_long_swap(long *target, long value, int pe); OSHMEM_DECLSPEC long long shmem_longlong_swap(long long*target, long long value, int pe); +/* Atomic set */ +OSHMEM_DECLSPEC void shmem_int_set(int *target, int value, int pe); +OSHMEM_DECLSPEC void shmem_long_set(long *target, long value, int pe); +OSHMEM_DECLSPEC void shmem_longlong_set(long long*target, long long value, int pe); +OSHMEM_DECLSPEC void shmem_float_set(float *target, float value, int pe); +OSHMEM_DECLSPEC void shmem_double_set(double *target, double value, int pe); + /* Atomic conditional swap */ OSHMEM_DECLSPEC int shmem_int_cswap(int *target, int cond, int value, int pe); OSHMEM_DECLSPEC long shmem_long_cswap(long *target, long cond, long value, int pe); @@ -285,6 +292,13 @@ OSHMEM_DECLSPEC int shmem_int_fadd(int *target, int value, int pe); OSHMEM_DECLSPEC long shmem_long_fadd(long *target, long value, int pe); OSHMEM_DECLSPEC long long shmem_longlong_fadd(long long *target, long long value, int pe); +/* Atomic Fetch */ +OSHMEM_DECLSPEC int shmem_int_fetch(const int *target, int pe); +OSHMEM_DECLSPEC long shmem_long_fetch(const long *target, int pe); +OSHMEM_DECLSPEC long long shmem_longlong_fetch(const long long *target, int pe); +OSHMEM_DECLSPEC float shmem_float_fetch(const float *target, int pe); +OSHMEM_DECLSPEC double shmem_double_fetch(const double *target, int pe); + /* Atomic Fetch&Inc */ OSHMEM_DECLSPEC int shmem_int_finc(int *target, int pe); OSHMEM_DECLSPEC long shmem_long_finc(long *target, int pe); diff --git a/oshmem/include/shmemx.h b/oshmem/include/shmemx.h index 7f4352db7a..353bbc84a6 100644 --- a/oshmem/include/shmemx.h +++ b/oshmem/include/shmemx.h @@ -66,6 +66,10 @@ OSHMEM_DECLSPEC void shmemx_iget16(void* target, const void* source, ptrdiff_t t OSHMEM_DECLSPEC int32_t shmemx_int32_swap(int32_t *target, int32_t value, int pe); OSHMEM_DECLSPEC int64_t shmemx_int64_swap(int64_t *target, int64_t value, int pe); +/* Atomic set */ +OSHMEM_DECLSPEC void shmemx_int32_set(int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC void shmemx_int64_set(int64_t *target, int64_t value, int pe); + /* Atomic conditional swap */ OSHMEM_DECLSPEC int32_t shmemx_int32_cswap(int32_t *target, int32_t cond, int32_t value, int pe); OSHMEM_DECLSPEC int64_t shmemx_int64_cswap(int64_t *target, int64_t cond, int64_t value, int pe); @@ -74,6 +78,10 @@ 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 */ +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); + /* Atomic Fetch&Inc */ OSHMEM_DECLSPEC int32_t shmemx_int32_finc(int32_t *target, int pe); OSHMEM_DECLSPEC int64_t shmemx_int64_finc(int64_t *target, int pe); @@ -145,13 +153,22 @@ OSHMEM_DECLSPEC void shmemx_int64_prod_to_all(int64_t *target, const int64_t *so #define shmem_int32_swap shmemx_int32_swap #define shmem_int64_swap shmemx_int64_swap + +#define shmem_int32_set shmemx_int32_set +#define shmem_int64_set shmemx_int64_set + #define shmem_int32_cswap shmemx_int32_cswap #define shmem_int64_cswap shmemx_int64_cswap #define shmem_int32_fadd shmemx_int32_fadd #define shmem_int64_fadd shmemx_int64_fadd + +#define shmem_int32_fetch shmemx_int32_fetch +#define shmem_int64_fetch shmemx_int64_fetch + #define shmem_int32_finc shmemx_int32_finc #define shmem_int64_finc shmemx_int64_finc + #define shmem_int32_add shmemx_int32_add #define shmem_int64_add shmemx_int64_add #define shmem_int32_inc shmemx_int32_inc diff --git a/oshmem/shmem/c/Makefile.am b/oshmem/shmem/c/Makefile.am index 1a8820fd3f..c60ba29bcc 100644 --- a/oshmem/shmem/c/Makefile.am +++ b/oshmem/shmem/c/Makefile.am @@ -51,8 +51,10 @@ OSHMEM_API_SOURCES = \ shmem_clear_cache_line_inv.c \ shmem_reduce.c \ shmem_swap.c \ + shmem_set.c \ shmem_cswap.c \ shmem_fadd.c \ + shmem_fetch.c \ shmem_finc.c \ shmem_add.c \ shmem_inc.c \ diff --git a/oshmem/shmem/c/profile/Makefile.am b/oshmem/shmem/c/profile/Makefile.am index fe0af74b52..d7fdb187f0 100644 --- a/oshmem/shmem/c/profile/Makefile.am +++ b/oshmem/shmem/c/profile/Makefile.am @@ -63,8 +63,10 @@ OSHMEM_API_SOURCES = \ pshmem_clear_cache_line_inv.c \ pshmem_reduce.c \ pshmem_swap.c \ + pshmem_set.c \ pshmem_cswap.c \ pshmem_fadd.c \ + pshmem_fetch.c \ pshmem_finc.c \ pshmem_add.c \ pshmem_inc.c \ diff --git a/oshmem/shmem/c/profile/defines.h b/oshmem/shmem/c/profile/defines.h index d0f0bb3432..3ef6ec6031 100644 --- a/oshmem/shmem/c/profile/defines.h +++ b/oshmem/shmem/c/profile/defines.h @@ -203,6 +203,14 @@ #define shmemx_int32_swap pshmemx_int32_swap #define shmemx_int64_swap pshmemx_int64_swap +/* Atomic set */ +#define shmem_double_set pshmem_double_set +#define shmem_float_set pshmem_float_set +#define shmem_int_set pshmem_int_set +#define shmem_long_set pshmem_long_set +#define shmem_longlong_set pshmem_longlong_set +#define shmemx_int32_set pshmemx_int32_set +#define shmemx_int64_set pshmemx_int64_set /* Atomic conditional swap */ #define shmem_int_cswap pshmem_int_cswap @@ -219,6 +227,15 @@ #define shmemx_int32_fadd pshmemx_int32_fadd #define shmemx_int64_fadd pshmemx_int64_fadd +/* Atomic Fetch */ +#define shmem_double_fetch pshmem_double_fetch +#define shmem_float_fetch pshmem_float_fetch +#define shmem_int_fetch pshmem_int_fetch +#define shmem_long_fetch pshmem_long_fetch +#define shmem_longlong_fetch pshmem_longlong_fetch +#define shmemx_int32_fetch pshmemx_int32_fetch +#define shmemx_int64_fetch pshmemx_int64_fetch + /* Atomic Fetch&Inc */ #define shmem_int_finc pshmem_int_finc #define shmem_long_finc pshmem_long_finc diff --git a/oshmem/shmem/c/shmem_fetch.c b/oshmem/shmem/c/shmem_fetch.c new file mode 100644 index 0000000000..264b31143f --- /dev/null +++ b/oshmem/shmem/c/shmem_fetch.c @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016 Mellanox Technologies, Inc. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include "oshmem_config.h" + +#include "oshmem/constants.h" +#include "oshmem/include/shmem.h" + +#include "oshmem/runtime/runtime.h" + +#include "oshmem/op/op.h" +#include "oshmem/mca/atomic/atomic.h" + +/* + * These routines perform an atomic fetch operation. + * The fetch routines retrieve the value at address target on PE pe. + * The operation must be completed without the possibility of another process + * updating target during the fetch. + */ +#define SHMEM_TYPE_FETCH(type_name, type, prefix) \ + type prefix##type_name##_fetch(const type *target, int pe) \ + { \ + int rc = OSHMEM_SUCCESS; \ + size_t size = 0; \ + type out_value; \ + type value = 0; \ + oshmem_op_t* op = oshmem_op_sum##type_name; \ + \ + RUNTIME_CHECK_INIT(); \ + RUNTIME_CHECK_PE(pe); \ + RUNTIME_CHECK_ADDR(target); \ + \ + size = sizeof(out_value); \ + rc = MCA_ATOMIC_CALL(fadd( \ + (void*)target, \ + (void*)&out_value, \ + (const void*)&value, \ + size, \ + pe, \ + op)); \ + RUNTIME_CHECK_RC(rc); \ + \ + return out_value; \ + } + +#if OSHMEM_PROFILING +#include "oshmem/include/pshmem.h" +#pragma weak shmem_int_fetch = pshmem_int_fetch +#pragma weak shmem_long_fetch = pshmem_long_fetch +#pragma weak shmem_longlong_fetch = pshmem_longlong_fetch +#pragma weak shmem_double_fetch = pshmem_double_fetch +#pragma weak shmem_float_fetch = pshmem_float_fetch +#pragma weak shmemx_int32_fetch = pshmemx_int32_fetch +#pragma weak shmemx_int64_fetch = pshmemx_int64_fetch +#include "oshmem/shmem/c/profile/defines.h" +#endif + +SHMEM_TYPE_FETCH(_int, int, shmem) +SHMEM_TYPE_FETCH(_long, long, shmem) +SHMEM_TYPE_FETCH(_longlong, long long, shmem) +SHMEM_TYPE_FETCH(_double, double, shmem) +SHMEM_TYPE_FETCH(_float, float, shmem) +SHMEM_TYPE_FETCH(_int32, int32_t, shmemx) +SHMEM_TYPE_FETCH(_int64, int64_t, shmemx) + diff --git a/oshmem/shmem/c/shmem_set.c b/oshmem/shmem/c/shmem_set.c new file mode 100644 index 0000000000..ce7193affa --- /dev/null +++ b/oshmem/shmem/c/shmem_set.c @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2016 Mellanox Technologies, Inc. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include "oshmem_config.h" + +#include "oshmem/constants.h" +#include "oshmem/include/shmem.h" + +#include "oshmem/runtime/runtime.h" + +#include "oshmem/mca/atomic/atomic.h" + +/* + * shmem_set performs an atomic set operation. + * The atomic set routines write value to address target on PE pe. + * The operation must be completed without the possibility of another + * process updating the target during the set. + */ +#define SHMEM_TYPE_SET(type_name, type, prefix) \ + void prefix##type_name##_set(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(cswap( \ + (void*)target, \ + (void*)&out_value, \ + NULL, \ + (const void*)&value, \ + size, \ + pe)); \ + RUNTIME_CHECK_RC(rc); \ + } + +#if OSHMEM_PROFILING +#include "oshmem/include/pshmem.h" +#pragma weak shmem_int_set = pshmem_int_set +#pragma weak shmem_long_set = pshmem_long_set +#pragma weak shmem_longlong_set = pshmem_longlong_set +#pragma weak shmem_float_set = pshmem_float_set +#pragma weak shmem_double_set = pshmem_double_set +#pragma weak shmemx_int32_set = pshmemx_int32_set +#pragma weak shmemx_int64_set = pshmemx_int64_set +#include "oshmem/shmem/c/profile/defines.h" +#endif + +SHMEM_TYPE_SET(_int, int, shmem) +SHMEM_TYPE_SET(_long, long, shmem) +SHMEM_TYPE_SET(_longlong, long long, shmem) +SHMEM_TYPE_SET(_float, float, shmem) +SHMEM_TYPE_SET(_double, double, shmem) +SHMEM_TYPE_SET(_int32, int32_t, shmemx) +SHMEM_TYPE_SET(_int64, int64_t, shmemx) + diff --git a/oshmem/shmem/fortran/Makefile.am b/oshmem/shmem/fortran/Makefile.am index f9fb6918f4..d4ba15d682 100644 --- a/oshmem/shmem/fortran/Makefile.am +++ b/oshmem/shmem/fortran/Makefile.am @@ -98,10 +98,18 @@ liboshmem_fortran_la_SOURCES += \ shmem_int8_swap_f.c \ shmem_real4_swap_f.c \ shmem_real8_swap_f.c \ + shmem_int4_set_f.c \ + shmem_int8_set_f.c \ + shmem_real4_set_f.c \ + shmem_real8_set_f.c \ shmem_int4_cswap_f.c \ shmem_int8_cswap_f.c \ shmem_int4_fadd_f.c \ shmem_int8_fadd_f.c \ + shmem_int4_fetch_f.c \ + shmem_int8_fetch_f.c \ + shmem_real4_fetch_f.c \ + shmem_real8_fetch_f.c \ shmem_int4_finc_f.c \ shmem_int8_finc_f.c \ shmem_int4_add_f.c \ diff --git a/oshmem/shmem/fortran/profile/Makefile.am b/oshmem/shmem/fortran/profile/Makefile.am index 8faaec12f0..7ac6d99fec 100644 --- a/oshmem/shmem/fortran/profile/Makefile.am +++ b/oshmem/shmem/fortran/profile/Makefile.am @@ -90,10 +90,18 @@ nodist_liboshmem_fortran_pshmem_la_SOURCES = \ pshmem_int8_swap_f.c \ pshmem_real4_swap_f.c \ pshmem_real8_swap_f.c \ + pshmem_int4_set_f.c \ + pshmem_int8_set_f.c \ + pshmem_real4_set_f.c \ + pshmem_real8_set_f.c \ pshmem_int4_cswap_f.c \ pshmem_int8_cswap_f.c \ pshmem_int4_fadd_f.c \ pshmem_int8_fadd_f.c \ + pshmem_int4_fetch_f.c \ + pshmem_int8_fetch_f.c \ + pshmem_real4_fetch_f.c \ + pshmem_real8_fetch_f.c \ pshmem_int4_finc_f.c \ pshmem_int8_finc_f.c \ pshmem_int4_add_f.c \ diff --git a/oshmem/shmem/fortran/profile/defines.h b/oshmem/shmem/fortran/profile/defines.h index c926d3d6b2..64b866902c 100644 --- a/oshmem/shmem/fortran/profile/defines.h +++ b/oshmem/shmem/fortran/profile/defines.h @@ -366,6 +366,10 @@ #define shmem_int4_fadd_ pshmem_int4_fadd_ #define shmem_int4_fadd__ pshmem_int4_fadd__ +#define SHMEM_INT4_FETCH PSHMEM_INT4_FETCH +#define shmem_int4_fetch_ pshmem_int4_fetch_ +#define shmem_int4_fetch__ pshmem_int4_fetch__ + #define SHMEM_INT4_FINC PSHMEM_INT4_FINC #define shmem_int4_finc_ pshmem_int4_finc_ #define shmem_int4_finc__ pshmem_int4_finc__ @@ -378,6 +382,10 @@ #define shmem_int4_swap_ pshmem_int4_swap_ #define shmem_int4_swap__ pshmem_int4_swap__ +#define SHMEM_INT4_SET PSHMEM_INT4_SET +#define shmem_int4_set_ pshmem_int4_set_ +#define shmem_int4_set__ pshmem_int4_set__ + #define SHMEM_INT4_WAIT PSHMEM_INT4_WAIT #define shmem_int4_wait_ pshmem_int4_wait_ #define shmem_int4_wait__ pshmem_int4_wait__ @@ -398,6 +406,10 @@ #define shmem_int8_fadd_ pshmem_int8_fadd_ #define shmem_int8_fadd__ pshmem_int8_fadd__ +#define SHMEM_INT8_FETCH PSHMEM_INT8_FETCH +#define shmem_int8_fetch_ pshmem_int8_fetch_ +#define shmem_int8_fetch__ pshmem_int8_fetch__ + #define SHMEM_INT8_FINC PSHMEM_INT8_FINC #define shmem_int8_finc_ pshmem_int8_finc_ #define shmem_int8_finc__ pshmem_int8_finc__ @@ -410,6 +422,10 @@ #define shmem_int8_swap_ pshmem_int8_swap_ #define shmem_int8_swap__ pshmem_int8_swap__ +#define SHMEM_INT8_SET PSHMEM_INT8_SET +#define shmem_int8_set_ pshmem_int8_set_ +#define shmem_int8_set__ pshmem_int8_set__ + #define SHMEM_INT8_WAIT PSHMEM_INT8_WAIT #define shmem_int8_wait_ pshmem_int8_wait_ #define shmem_int8_wait__ pshmem_int8_wait__ @@ -622,6 +638,22 @@ #define shmem_real8_swap_ pshmem_real8_swap_ #define shmem_real8_swap__ pshmem_real8_swap__ +#define SHMEM_REAL4_SET PSHMEM_REAL4_SET +#define shmem_real4_set_ pshmem_real4_set_ +#define shmem_real4_set__ pshmem_real4_set__ + +#define SHMEM_REAL8_SET PSHMEM_REAL8_SET +#define shmem_real8_set_ pshmem_real8_set_ +#define shmem_real8_set__ pshmem_real8_set__ + +#define SHMEM_REAL4_FETCH PSHMEM_REAL4_FETCH +#define shmem_real4_fetch_ pshmem_real4_fetch_ +#define shmem_real4_fetch__ pshmem_real4_fetch__ + +#define SHMEM_REAL8_FETCH PSHMEM_REAL8_FETCH +#define shmem_real8_fetch_ pshmem_real8_fetch_ +#define shmem_real8_fetch__ pshmem_real8_fetch__ + #define SHMEM_REAL_GET PSHMEM_REAL_GET #define shmem_real_get_ pshmem_real_get_ #define shmem_real_get__ pshmem_real_get__ diff --git a/oshmem/shmem/fortran/profile/prototypes_pshmem.h b/oshmem/shmem/fortran/profile/prototypes_pshmem.h index 30634de142..3a673103a6 100644 --- a/oshmem/shmem/fortran/profile/prototypes_pshmem.h +++ b/oshmem/shmem/fortran/profile/prototypes_pshmem.h @@ -117,10 +117,24 @@ PN (ompi_fortran_integer4_t, pshmem_int4_swap, PSHMEM_INT4_SWAP, (FORTRAN_POINTE PN (ompi_fortran_integer8_t, pshmem_int8_swap, PSHMEM_INT8_SWAP, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); PN (ompi_fortran_real4_t, pshmem_real4_swap, PSHMEM_REAL4_SWAP, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); PN (ompi_fortran_real8_t, pshmem_real8_swap, PSHMEM_REAL8_SWAP, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); + +PN (void, pshmem_int4_set, PSHMEM_INT4_SET, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); +PN (void, pshmem_int8_set, PSHMEM_INT8_SET, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); +PN (void, pshmem_real4_set, PSHMEM_REAL4_SET, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); +PN (void, pshmem_real8_set, PSHMEM_REAL8_SET, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); + + PN (ompi_fortran_integer4_t, pshmem_int4_cswap, PSHMEM_INT4_CSWAP, (FORTRAN_POINTER_T target, MPI_Fint *cond, FORTRAN_POINTER_T value, MPI_Fint *pe)); PN (ompi_fortran_integer8_t, pshmem_int8_cswap, PSHMEM_INT8_CSWAP, (FORTRAN_POINTER_T target, MPI_Fint *cond, FORTRAN_POINTER_T value, MPI_Fint *pe)); + PN (ompi_fortran_integer4_t, pshmem_int4_fadd, PSHMEM_INT4_FADD, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); PN (ompi_fortran_integer8_t, pshmem_int8_fadd, PSHMEM_INT8_FADD, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); + +PN (ompi_fortran_integer4_t, pshmem_int4_fetch, PSHMEM_INT4_FETCH, (FORTRAN_POINTER_T target, MPI_Fint *pe)); +PN (ompi_fortran_integer8_t, pshmem_int8_fetch, PSHMEM_INT8_FETCH, (FORTRAN_POINTER_T target, MPI_Fint *pe)); +PN (ompi_fortran_real4_t, pshmem_real4_fetch, PSHMEM_REAL4_FETCH, (FORTRAN_POINTER_T target, MPI_Fint *pe)); +PN (ompi_fortran_real8_t, pshmem_real8_fetch, PSHMEM_REAL8_FETCH, (FORTRAN_POINTER_T target, MPI_Fint *pe)); + PN (void, pshmem_int4_inc, PSHMEM_INT4_INC, (FORTRAN_POINTER_T target, MPI_Fint *pe)); PN (void, pshmem_int8_inc, PSHMEM_INT8_INC, (FORTRAN_POINTER_T target, MPI_Fint *pe)); PN (ompi_fortran_integer4_t, pshmem_int4_finc, PSHMEM_INT4_FINC, (FORTRAN_POINTER_T target, MPI_Fint *pe)); diff --git a/oshmem/shmem/fortran/prototypes_shmem.h b/oshmem/shmem/fortran/prototypes_shmem.h index 6d4c2f4a68..ebfe3f7fb3 100644 --- a/oshmem/shmem/fortran/prototypes_shmem.h +++ b/oshmem/shmem/fortran/prototypes_shmem.h @@ -121,10 +121,23 @@ PN (ompi_fortran_integer4_t, shmem_int4_swap, SHMEM_INT4_SWAP, (FORTRAN_POINTER_ PN (ompi_fortran_integer8_t, shmem_int8_swap, SHMEM_INT8_SWAP, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); PN (ompi_fortran_real4_t, shmem_real4_swap, SHMEM_REAL4_SWAP, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); PN (ompi_fortran_real8_t, shmem_real8_swap, SHMEM_REAL8_SWAP, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); + +PN (void, shmem_int4_set, SHMEM_INT4_SET, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); +PN (void, shmem_int8_set, SHMEM_INT8_SET, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); +PN (void, shmem_real4_set, SHMEM_REAL4_SET, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); +PN (void, shmem_real8_set, SHMEM_REAL8_SET, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); + PN (ompi_fortran_integer4_t, shmem_int4_cswap, SHMEM_INT4_CSWAP, (FORTRAN_POINTER_T target, MPI_Fint *cond, FORTRAN_POINTER_T value, MPI_Fint *pe)); PN (ompi_fortran_integer8_t, shmem_int8_cswap, SHMEM_INT8_CSWAP, (FORTRAN_POINTER_T target, MPI_Fint *cond, FORTRAN_POINTER_T value, MPI_Fint *pe)); + PN (ompi_fortran_integer4_t, shmem_int4_fadd, SHMEM_INT4_FADD, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); PN (ompi_fortran_integer8_t, shmem_int8_fadd, SHMEM_INT8_FADD, (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe)); + +PN (ompi_fortran_integer4_t, shmem_int4_fetch, SHMEM_INT4_FETCH, (FORTRAN_POINTER_T target, MPI_Fint *pe)); +PN (ompi_fortran_integer8_t, shmem_int8_fetch, SHMEM_INT8_FETCH, (FORTRAN_POINTER_T target, MPI_Fint *pe)); +PN (ompi_fortran_real4_t, shmem_real4_fetch, SHMEM_REAL4_FETCH, (FORTRAN_POINTER_T target, MPI_Fint *pe)); +PN (ompi_fortran_real8_t, shmem_real8_fetch, SHMEM_REAL8_FETCH, (FORTRAN_POINTER_T target, MPI_Fint *pe)); + PN (void, shmem_int4_inc, SHMEM_INT4_INC, (FORTRAN_POINTER_T target, MPI_Fint *pe)); PN (void, shmem_int8_inc, SHMEM_INT8_INC, (FORTRAN_POINTER_T target, MPI_Fint *pe)); PN (ompi_fortran_integer4_t, shmem_int4_finc, SHMEM_INT4_FINC, (FORTRAN_POINTER_T target, MPI_Fint *pe)); diff --git a/oshmem/shmem/fortran/shmem_int4_fetch_f.c b/oshmem/shmem/fortran/shmem_int4_fetch_f.c new file mode 100644 index 0000000000..5eb7cdbaa2 --- /dev/null +++ b/oshmem/shmem/fortran/shmem_int4_fetch_f.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2013 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "oshmem_config.h" +#include "oshmem/shmem/fortran/bindings.h" +#include "oshmem/include/shmem.h" +#include "oshmem/shmem/shmem_api_logger.h" +#include "oshmem/runtime/runtime.h" +#include "oshmem/mca/atomic/atomic.h" +#include "ompi/datatype/ompi_datatype.h" +#include "oshmem/op/op.h" +#include "stdio.h" + +#if OSHMEM_PROFILING +#include "oshmem/shmem/fortran/profile/pbindings.h" +SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_INT4_FETCH, shmem_int4_fetch) +#include "oshmem/shmem/fortran/profile/defines.h" +#endif + +SHMEM_GENERATE_FORTRAN_BINDINGS_FUNCTION (ompi_fortran_integer4_t, + SHMEM_INT4_FETCH, + shmem_int4_fetch_, + shmem_int4_fetch__, + shmem_int4_fetch_f, + (FORTRAN_POINTER_T target, MPI_Fint *pe), + (target,pe) ) + +ompi_fortran_integer4_t shmem_int4_fetch_f(FORTRAN_POINTER_T target, MPI_Fint *pe) +{ + ompi_fortran_integer4_t out_value = 0; + oshmem_op_t* op = oshmem_op_sum_fint4; + int value = 0; + + MCA_ATOMIC_CALL(fadd(FPTR_2_VOID_PTR(target), + (void *)&out_value, + (const void *)&value, + sizeof(out_value), + OMPI_FINT_2_INT(*pe), + op)); + + return out_value; +} + diff --git a/oshmem/shmem/fortran/shmem_int4_set_f.c b/oshmem/shmem/fortran/shmem_int4_set_f.c new file mode 100644 index 0000000000..dec43334fb --- /dev/null +++ b/oshmem/shmem/fortran/shmem_int4_set_f.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2013 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "oshmem_config.h" +#include "oshmem/shmem/fortran/bindings.h" +#include "oshmem/include/shmem.h" +#include "oshmem/shmem/shmem_api_logger.h" +#include "oshmem/runtime/runtime.h" +#include "oshmem/mca/atomic/atomic.h" +#include "ompi/datatype/ompi_datatype.h" +#include "stdio.h" + +#if OSHMEM_PROFILING +#include "oshmem/shmem/fortran/profile/pbindings.h" +SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_INT4_SET, shmem_int4_set) +#include "oshmem/shmem/fortran/profile/defines.h" +#endif + +SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void, + SHMEM_INT4_SET, + shmem_int4_set_, + shmem_int4_set__, + shmem_int4_set_f, + (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe), + (target,value,pe) ) + +void shmem_int4_set_f(FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe) +{ + ompi_fortran_integer4_t out_value = 0; + + MCA_ATOMIC_CALL(cswap(FPTR_2_VOID_PTR(target), + (void *)&out_value, + NULL, + FPTR_2_VOID_PTR(value), + sizeof(out_value), + OMPI_FINT_2_INT(*pe))); +} + diff --git a/oshmem/shmem/fortran/shmem_int8_fetch_f.c b/oshmem/shmem/fortran/shmem_int8_fetch_f.c new file mode 100644 index 0000000000..f008b62264 --- /dev/null +++ b/oshmem/shmem/fortran/shmem_int8_fetch_f.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2013 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "oshmem_config.h" +#include "oshmem/shmem/fortran/bindings.h" +#include "oshmem/include/shmem.h" +#include "oshmem/shmem/shmem_api_logger.h" +#include "oshmem/runtime/runtime.h" +#include "oshmem/mca/atomic/atomic.h" +#include "ompi/datatype/ompi_datatype.h" +#include "oshmem/op/op.h" +#include "stdio.h" + +#if OSHMEM_PROFILING +#include "oshmem/shmem/fortran/profile/pbindings.h" +SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_INT8_FETCH, shmem_int8_fetch) +#include "oshmem/shmem/fortran/profile/defines.h" +#endif + +SHMEM_GENERATE_FORTRAN_BINDINGS_FUNCTION (ompi_fortran_integer8_t, + SHMEM_INT8_FETCH, + shmem_int8_fetch_, + shmem_int8_fetch__, + shmem_int8_fetch_f, + (FORTRAN_POINTER_T target, MPI_Fint *pe), + (target,pe) ) + +ompi_fortran_integer8_t shmem_int8_fetch_f(FORTRAN_POINTER_T target, MPI_Fint *pe) +{ + ompi_fortran_integer8_t out_value = 0; + oshmem_op_t* op = oshmem_op_sum_fint8; + int value = 0; + + MCA_ATOMIC_CALL(fadd(FPTR_2_VOID_PTR(target), + (void *)&out_value, + (const void *)&value, + sizeof(out_value), + OMPI_FINT_2_INT(*pe), + op)); + + return out_value; +} + diff --git a/oshmem/shmem/fortran/shmem_int8_set_f.c b/oshmem/shmem/fortran/shmem_int8_set_f.c new file mode 100644 index 0000000000..33191f0563 --- /dev/null +++ b/oshmem/shmem/fortran/shmem_int8_set_f.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2013 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "oshmem_config.h" +#include "oshmem/shmem/fortran/bindings.h" +#include "oshmem/include/shmem.h" +#include "oshmem/shmem/shmem_api_logger.h" +#include "oshmem/runtime/runtime.h" +#include "oshmem/mca/atomic/atomic.h" +#include "ompi/datatype/ompi_datatype.h" +#include "stdio.h" + +#if OSHMEM_PROFILING +#include "oshmem/shmem/fortran/profile/pbindings.h" +SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_INT8_SET, shmem_int8_set) +#include "oshmem/shmem/fortran/profile/defines.h" +#endif + +SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void, + SHMEM_INT8_SET, + shmem_int8_set_, + shmem_int8_set__, + shmem_int8_set_f, + (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe), + (target,value,pe) ) + +void shmem_int8_set_f(FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe) +{ + ompi_fortran_integer8_t out_value = 0; + + MCA_ATOMIC_CALL(cswap(FPTR_2_VOID_PTR(target), + (void *)&out_value, + NULL, + FPTR_2_VOID_PTR(value), + sizeof(out_value), + OMPI_FINT_2_INT(*pe))); +} + diff --git a/oshmem/shmem/fortran/shmem_real4_fetch_f.c b/oshmem/shmem/fortran/shmem_real4_fetch_f.c new file mode 100644 index 0000000000..3c228dd4da --- /dev/null +++ b/oshmem/shmem/fortran/shmem_real4_fetch_f.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2013 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "oshmem_config.h" +#include "oshmem/shmem/fortran/bindings.h" +#include "oshmem/include/shmem.h" +#include "oshmem/shmem/shmem_api_logger.h" +#include "oshmem/runtime/runtime.h" +#include "oshmem/mca/atomic/atomic.h" +#include "ompi/datatype/ompi_datatype.h" +#include "oshmem/op/op.h" +#include "stdio.h" + +#if OSHMEM_PROFILING +#include "oshmem/shmem/fortran/profile/pbindings.h" +SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_REAL4_FETCH, shmem_real4_fetch) +#include "oshmem/shmem/fortran/profile/defines.h" +#endif + +SHMEM_GENERATE_FORTRAN_BINDINGS_FUNCTION (ompi_fortran_real4_t, + SHMEM_REAL4_FETCH, + shmem_real4_fetch_, + shmem_real4_fetch__, + shmem_real4_fetch_f, + (FORTRAN_POINTER_T target, MPI_Fint *pe), + (target,pe) ) + +ompi_fortran_real4_t shmem_real4_fetch_f(FORTRAN_POINTER_T target, MPI_Fint *pe) +{ + ompi_fortran_real4_t out_value = 0; + oshmem_op_t* op = oshmem_op_sum_freal4; + int value = 0; + + MCA_ATOMIC_CALL(fadd(FPTR_2_VOID_PTR(target), + (void *)&out_value, + (const void *)&value, + sizeof(out_value), + OMPI_FINT_2_INT(*pe), + op)); + + return out_value; +} + diff --git a/oshmem/shmem/fortran/shmem_real4_set_f.c b/oshmem/shmem/fortran/shmem_real4_set_f.c new file mode 100644 index 0000000000..20e8b7626a --- /dev/null +++ b/oshmem/shmem/fortran/shmem_real4_set_f.c @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2013 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "oshmem_config.h" +#include "oshmem/shmem/fortran/bindings.h" +#include "oshmem/include/shmem.h" +#include "oshmem/shmem/shmem_api_logger.h" +#include "oshmem/runtime/runtime.h" +#include "oshmem/mca/atomic/atomic.h" +#include "ompi/datatype/ompi_datatype.h" +#include "stdio.h" + +#if OSHMEM_PROFILING +#include "oshmem/shmem/fortran/profile/pbindings.h" +SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_REAL4_SET, shmem_real4_set) +#include "oshmem/shmem/fortran/profile/defines.h" +#endif + +SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void, + SHMEM_REAL4_SET, + shmem_real4_set_, + shmem_real4_set__, + shmem_real4_set_f, + (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe), + (target,value,pe) ) + +void shmem_real4_set_f(FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe) +{ + ompi_fortran_real4_t out_value = 0; + + MCA_ATOMIC_CALL(cswap(FPTR_2_VOID_PTR(target), + (void *)&out_value, + NULL, + FPTR_2_VOID_PTR(value), + sizeof(out_value), + OMPI_FINT_2_INT(*pe))); + +} + diff --git a/oshmem/shmem/fortran/shmem_real8_fetch_f.c b/oshmem/shmem/fortran/shmem_real8_fetch_f.c new file mode 100644 index 0000000000..9602320fe8 --- /dev/null +++ b/oshmem/shmem/fortran/shmem_real8_fetch_f.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2013 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "oshmem_config.h" +#include "oshmem/shmem/fortran/bindings.h" +#include "oshmem/include/shmem.h" +#include "oshmem/shmem/shmem_api_logger.h" +#include "oshmem/runtime/runtime.h" +#include "oshmem/mca/atomic/atomic.h" +#include "ompi/datatype/ompi_datatype.h" +#include "oshmem/op/op.h" +#include "stdio.h" + +#if OSHMEM_PROFILING +#include "oshmem/shmem/fortran/profile/pbindings.h" +SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_REAL8_FETCH, shmem_real8_fetch) +#include "oshmem/shmem/fortran/profile/defines.h" +#endif + +SHMEM_GENERATE_FORTRAN_BINDINGS_FUNCTION (ompi_fortran_real8_t, + SHMEM_REAL8_FETCH, + shmem_real8_fetch_, + shmem_real8_fetch__, + shmem_real8_fetch_f, + (FORTRAN_POINTER_T target, MPI_Fint *pe), + (target,pe) ) + +ompi_fortran_real8_t shmem_real8_fetch_f(FORTRAN_POINTER_T target, MPI_Fint *pe) +{ + ompi_fortran_real8_t out_value = 0; + oshmem_op_t* op = oshmem_op_sum_freal8; + int value = 0; + + MCA_ATOMIC_CALL(fadd(FPTR_2_VOID_PTR(target), + (void *)&out_value, + (const void *)&value, + sizeof(out_value), + OMPI_FINT_2_INT(*pe), + op)); + + return out_value; +} + diff --git a/oshmem/shmem/fortran/shmem_real8_set_f.c b/oshmem/shmem/fortran/shmem_real8_set_f.c new file mode 100644 index 0000000000..7837db2592 --- /dev/null +++ b/oshmem/shmem/fortran/shmem_real8_set_f.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2013 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "oshmem_config.h" +#include "oshmem/shmem/fortran/bindings.h" +#include "oshmem/include/shmem.h" +#include "oshmem/shmem/shmem_api_logger.h" +#include "oshmem/runtime/runtime.h" +#include "oshmem/mca/atomic/atomic.h" +#include "ompi/datatype/ompi_datatype.h" +#include "stdio.h" + +#if OSHMEM_PROFILING +#include "oshmem/shmem/fortran/profile/pbindings.h" +SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_REAL8_SET, shmem_real8_set) +#include "oshmem/shmem/fortran/profile/defines.h" +#endif + +SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void, + SHMEM_REAL8_SET, + shmem_real8_set_, + shmem_real8_set__, + shmem_real8_set_f, + (FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe), + (target,value,pe) ) + +void shmem_real8_set_f(FORTRAN_POINTER_T target, FORTRAN_POINTER_T value, MPI_Fint *pe) +{ + ompi_fortran_real8_t out_value = 0; + + MCA_ATOMIC_CALL(cswap(FPTR_2_VOID_PTR(target), + (void *)&out_value, + NULL, + FPTR_2_VOID_PTR(value), + sizeof(out_value), + OMPI_FINT_2_INT(*pe))); +} + diff --git a/oshmem/shmem/man/man3/Makefile.extra b/oshmem/shmem/man/man3/Makefile.extra index 0e0126dec9..c47ba2c2fb 100644 --- a/oshmem/shmem/man/man3/Makefile.extra +++ b/oshmem/shmem/man/man3/Makefile.extra @@ -98,12 +98,26 @@ shmem_api_man_pages = \ shmem/man/man3/shmem_longlong_swap.3 \ shmem/man/man3/shmem_float_swap.3 \ shmem/man/man3/shmem_double_swap.3 \ +\ + shmem/man/man3/shmem_double_set.3 \ + shmem/man/man3/shmem_float_set.3 \ + shmem/man/man3/shmem_int_set.3 \ + shmem/man/man3/shmem_longlong_set.3 \ + shmem/man/man3/shmem_long_set.3 \ +\ shmem/man/man3/shmem_int_cswap.3 \ shmem/man/man3/shmem_long_cswap.3 \ shmem/man/man3/shmem_longlong_cswap.3 \ shmem/man/man3/shmem_int_fadd.3 \ shmem/man/man3/shmem_long_fadd.3 \ shmem/man/man3/shmem_longlong_fadd.3 \ +\ + shmem/man/man3/shmem_double_fetch.3 \ + shmem/man/man3/shmem_float_fetch.3 \ + shmem/man/man3/shmem_int_fetch.3 \ + shmem/man/man3/shmem_long_fetch.3 \ + shmem/man/man3/shmem_longlong_fetch.3 \ +\ shmem/man/man3/shmem_int_finc.3 \ shmem/man/man3/shmem_long_finc.3 \ shmem/man/man3/shmem_longlong_finc.3 \ diff --git a/oshmem/shmem/man/man3/shmem_double_fetch.3in b/oshmem/shmem/man/man3/shmem_double_fetch.3in new file mode 100644 index 0000000000..7213c75e53 --- /dev/null +++ b/oshmem/shmem/man/man3/shmem_double_fetch.3in @@ -0,0 +1 @@ +.so man3/shmem_int_fetch.3 diff --git a/oshmem/shmem/man/man3/shmem_double_set.3in b/oshmem/shmem/man/man3/shmem_double_set.3in new file mode 100644 index 0000000000..a02bb7ea5e --- /dev/null +++ b/oshmem/shmem/man/man3/shmem_double_set.3in @@ -0,0 +1 @@ +.so man3/shmem_int_set.3 diff --git a/oshmem/shmem/man/man3/shmem_float_fetch.3in b/oshmem/shmem/man/man3/shmem_float_fetch.3in new file mode 100644 index 0000000000..7213c75e53 --- /dev/null +++ b/oshmem/shmem/man/man3/shmem_float_fetch.3in @@ -0,0 +1 @@ +.so man3/shmem_int_fetch.3 diff --git a/oshmem/shmem/man/man3/shmem_float_set.3in b/oshmem/shmem/man/man3/shmem_float_set.3in new file mode 100644 index 0000000000..a02bb7ea5e --- /dev/null +++ b/oshmem/shmem/man/man3/shmem_float_set.3in @@ -0,0 +1 @@ +.so man3/shmem_int_set.3 diff --git a/oshmem/shmem/man/man3/shmem_int_fetch.3in b/oshmem/shmem/man/man3/shmem_int_fetch.3in new file mode 100644 index 0000000000..e11e131eb6 --- /dev/null +++ b/oshmem/shmem/man/man3/shmem_int_fetch.3in @@ -0,0 +1,83 @@ +.\" -*- nroff -*- +.\" Copyright (c) 2016 Mellanox Technologies, Inc. +.\" $COPYRIGHT$ +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "SHMEM\\_FETCH" "3" "Unreleased developer copy" "gitclone" "Open MPI" +.SH NAME + +\fIshmem_int4_fetch\fP(3), +\fIshmem_int8_fetch\fP(3), +\fIshmem_int_fetch\fP(3), +\fIshmem_long_fetch\fP(3), +\fIshmem_longlong_fetch\fP(3) +\fIshmem_double_fetch\fP(3) +\fIshmem_float_fetch\fP(3) +\- Atomically fetches the value of a remote data object +.SH SYNOPSIS + +C or C++: +.Vb +#include + +int shmem_int_fetch(int *target, int pe); + +long shmem_long_fetch(long *target, int pe); + +long long shmem_longlong_fetch(long long *target, int pe); + +double shmem_double_fetch(long long *target, int pe); + +float shmem_float_fetch(float *target, int pe); +.Ve +Fortran: +.Vb +INCLUDE "mpp/shmem.fh" + +INTEGER pe + +INTEGER(KIND=4) SHMEM_INT4_FETCH, ires, target +ires = SHMEM_INT4_FETCH(target, pe) + +INTEGER(KIND=8) SHMEM_INT8_FETCH, ires, target +ires = SHMEM_INT8_FETCH(target, pe) + + +REAL(KIND=4) SHMEM_INT4_FETCH, ires, target +ires = SHMEM_REAL4_FETCH(target, pe) + +REAL(KIND=8) SHMEM_INT8_FETCH, ires, target +ires = SHMEM_REAL8_FETCH(target, pe) + +.Ve +.SH DESCRIPTION + +The shmem_fetch functions perform an atomic fetch operation. They return the contents of the +\fBtarget\fP as an atomic operation. + +.PP +The arguments are as follows: +.TP +target +The remotely accessible data object to be fetched from the remote PE. +.TP +pe +An integer that indicates the PE number from which \fItarget\fP is to be fetched. If you are +using Fortran, it must be a default integer value. +.PP + +.SH RETURN VALUES +The contents at the \fItarget\fP address on the remote PE. +The data type of the return value is the same as the the +type of the remote data object. + +.SH SEE ALSO + +\fIintro_shmem\fP(3) diff --git a/oshmem/shmem/man/man3/shmem_int_set.3in b/oshmem/shmem/man/man3/shmem_int_set.3in new file mode 100644 index 0000000000..7a68b2eee3 --- /dev/null +++ b/oshmem/shmem/man/man3/shmem_int_set.3in @@ -0,0 +1,77 @@ +.\" -*- nroff -*- +.\" Copyright (c) 2016 Mellanox Technologies, Inc. +.\" $COPYRIGHT$ +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "SHMEM\\_SET" "3" "Unreleased developer copy" "gitclone" "Open MPI" +.SH NAME + +\fIshmem_double_set\fP(3), +\fIshmem_float_set\fP(3), +\fIshmem_int_set\fP(3), +\fIshmem_long_set\fP(3), +\fIshmem_longlong_set\fP(3) +\fIshmem_int4_set\fP(3), +\fIshmem_int8_set\fP(3), +\fIshmem_real4_set\fP(3), +\fIshmem_real8_set\fP(3), +\- Atomically sets the value of a remote data object + +.SH SYNOPSIS + +C or C++: +.Vb +#include + +void shmem_double_set(double *target, double value, int pe); + +void shmem_float_set(float *target, float value, int pe); + +void shmem_int_set(int *target, int value, int pe); + +void shmem_long_set(long *target, long value, int pe); + +void shmem_longlong_set(long long *target, long long value, int pe); +.Ve +Fortran: +.Vb +INCLUDE "mpp/shmem.fh" + +INTEGER pe + +CALL SHMEM_INT4_SET(target, value, pe) +CALL SHMEM_INT8_SET(target, value, pe) +CALL SHMEM_REAL4_SET(target, value, pe) +CALL SHMEM_REAL8_SET(target, value, pe) + +.Ve +.SH DESCRIPTION + +The set routines write the \fBvalue\fP into the address \fBtarget\fP on \fBpe\fP as an atomic operation. +.PP +The arguments are as follows: +.TP +target +The remotely accessible data object to be set on the remote PE. +.TP +value +The value to be atomically written to the remote PE. +.TP +pe +An integer that indicates the PE number upon which target is to be updated. If you +are using Fortran, it must be a default integer value. +.PP +.SH RETURN VALUES +NONE + +.SH SEE ALSO + +\fIintro_shmem\fP(3) + diff --git a/oshmem/shmem/man/man3/shmem_long_fetch.3in b/oshmem/shmem/man/man3/shmem_long_fetch.3in new file mode 100644 index 0000000000..7213c75e53 --- /dev/null +++ b/oshmem/shmem/man/man3/shmem_long_fetch.3in @@ -0,0 +1 @@ +.so man3/shmem_int_fetch.3 diff --git a/oshmem/shmem/man/man3/shmem_long_set.3in b/oshmem/shmem/man/man3/shmem_long_set.3in new file mode 100644 index 0000000000..a02bb7ea5e --- /dev/null +++ b/oshmem/shmem/man/man3/shmem_long_set.3in @@ -0,0 +1 @@ +.so man3/shmem_int_set.3 diff --git a/oshmem/shmem/man/man3/shmem_longlong_fetch.3in b/oshmem/shmem/man/man3/shmem_longlong_fetch.3in new file mode 100644 index 0000000000..7213c75e53 --- /dev/null +++ b/oshmem/shmem/man/man3/shmem_longlong_fetch.3in @@ -0,0 +1 @@ +.so man3/shmem_int_fetch.3 diff --git a/oshmem/shmem/man/man3/shmem_longlong_set.3in b/oshmem/shmem/man/man3/shmem_longlong_set.3in new file mode 100644 index 0000000000..a02bb7ea5e --- /dev/null +++ b/oshmem/shmem/man/man3/shmem_longlong_set.3in @@ -0,0 +1 @@ +.so man3/shmem_int_set.3