diff --git a/src/ffibuilder.py b/src/ffibuilder.py index e37c544..8a0fe77 100644 --- a/src/ffibuilder.py +++ b/src/ffibuilder.py @@ -11,8 +11,8 @@ def build_api( module="api", shmem_h="shmem.h", - shmem_ctx_t='...*', - shmem_team_t='...*', + shmem_ctx_t='struct{...;}', + shmem_team_t='struct{...;}', ): from apicodegen import generate ffi = cffi.FFI() @@ -23,6 +23,12 @@ def build_api( ffi.cdef(code) for code in generate(): ffi.cdef(code) + for hdl in ('ctx', 'team'): + ffi.cdef(f""" + bool eq_{hdl}(shmem_{hdl}_t, shmem_{hdl}_t); + uintptr_t {hdl}2id(shmem_{hdl}_t); + shmem_{hdl}_t id2{hdl}(uintptr_t); + """) ffi.cdef(""" int shmem_alltoallsmem_x( shmem_team_t team, diff --git a/src/libshmem.c b/src/libshmem.c index 2dbacea..1dc1d7c 100644 --- a/src/libshmem.c +++ b/src/libshmem.c @@ -50,6 +50,7 @@ /* --- */ +#include "libshmem/hdltypes.h" #include "libshmem/fallback.h" #include "libshmem/initfini.h" #include "libshmem/memalloc.h" diff --git a/src/libshmem/compat/cray.h b/src/libshmem/compat/cray.h index 5865475..2607872 100644 --- a/src/libshmem/compat/cray.h +++ b/src/libshmem/compat/cray.h @@ -1,46 +1,12 @@ #ifndef PySHMEM_COMPAT_CRAY_H #define PySHMEM_COMPAT_CRAY_H -static -void shmem_complexf_sum_to_all(float _Complex *dest, const float _Complex *source, int nreduce, - int PE_start, int logPE_stride, int PE_size, - float _Complex *pWrk, long *pSync) -{ - shmem_float_sum_to_all((float*)dest, (float*)source, 2*nreduce, - PE_start, logPE_stride, PE_size, - (float*)pWrk, pSync); -} - -static -void shmem_complexd_sum_to_all(double _Complex *dest, const double _Complex *source, int nreduce, - int PE_start, int logPE_stride, int PE_size, - double _Complex *pWrk, long *pSync) -{ - shmem_double_sum_to_all((double*)dest, (double*)source, 2*nreduce, - PE_start, logPE_stride, PE_size, - (double*)pWrk, pSync); -} - -static -void shmem_complexf_prod_to_all(float _Complex *dest, const float _Complex *source, int nreduce, - int PE_start, int logPE_stride, int PE_size, - float _Complex *pWrk, long *pSync) -{ - (void)dest; (void)source; (void)nreduce; - (void)PE_start; (void)logPE_stride; - (void)PE_size; (void)pWrk; (void)pSync; - PySHMEM_UNAVAILABLE; -} +#if CRAY_SHMEM_MAJOR_VERSION == 9 +#include "cray09.h" +#endif -static -void shmem_complexd_prod_to_all(double _Complex *dest, const double _Complex *source, int nreduce, - int PE_start, int logPE_stride, int PE_size, - double _Complex *pWrk, long *pSync) -{ - (void)dest; (void)source; (void)nreduce; - (void)PE_start; (void)logPE_stride; (void)PE_size; - (void)pWrk; (void)pSync; - PySHMEM_UNAVAILABLE; -} +#if CRAY_SHMEM_MAJOR_VERSION == 11 +#include "cray11.h" +#endif #endif diff --git a/src/libshmem/compat/cray09.h b/src/libshmem/compat/cray09.h new file mode 100644 index 0000000..f4d0acc --- /dev/null +++ b/src/libshmem/compat/cray09.h @@ -0,0 +1,41 @@ +static +void shmem_complexf_sum_to_all(float _Complex *dest, const float _Complex *source, int nreduce, + int PE_start, int logPE_stride, int PE_size, + float _Complex *pWrk, long *pSync) +{ + shmem_float_sum_to_all((float*)dest, (float*)source, 2*nreduce, + PE_start, logPE_stride, PE_size, + (float*)pWrk, pSync); +} + +static +void shmem_complexd_sum_to_all(double _Complex *dest, const double _Complex *source, int nreduce, + int PE_start, int logPE_stride, int PE_size, + double _Complex *pWrk, long *pSync) +{ + shmem_double_sum_to_all((double*)dest, (double*)source, 2*nreduce, + PE_start, logPE_stride, PE_size, + (double*)pWrk, pSync); +} + +static +void shmem_complexf_prod_to_all(float _Complex *dest, const float _Complex *source, int nreduce, + int PE_start, int logPE_stride, int PE_size, + float _Complex *pWrk, long *pSync) +{ + (void)dest; (void)source; (void)nreduce; + (void)PE_start; (void)logPE_stride; + (void)PE_size; (void)pWrk; (void)pSync; + PySHMEM_UNAVAILABLE; +} + +static +void shmem_complexd_prod_to_all(double _Complex *dest, const double _Complex *source, int nreduce, + int PE_start, int logPE_stride, int PE_size, + double _Complex *pWrk, long *pSync) +{ + (void)dest; (void)source; (void)nreduce; + (void)PE_start; (void)logPE_stride; (void)PE_size; + (void)pWrk; (void)pSync; + PySHMEM_UNAVAILABLE; +} diff --git a/src/libshmem/compat/cray11.h b/src/libshmem/compat/cray11.h new file mode 100644 index 0000000..7fa9e07 --- /dev/null +++ b/src/libshmem/compat/cray11.h @@ -0,0 +1,567 @@ +static int PySHMEM_Cray_shmem_char_max_reduce(shmem_team_t t, char *d, const char *s, size_t n) { shmem_char_max_reduce(t, d, s, n); return 0; } +#undef shmem_char_max_reduce +#define shmem_char_max_reduce PySHMEM_Cray_shmem_char_max_reduce + +static int PySHMEM_Cray_shmem_char_min_reduce(shmem_team_t t, char *d, const char *s, size_t n) { shmem_char_min_reduce(t, d, s, n); return 0; } +#undef shmem_char_min_reduce +#define shmem_char_min_reduce PySHMEM_Cray_shmem_char_min_reduce + +static int PySHMEM_Cray_shmem_char_sum_reduce(shmem_team_t t, char *d, const char *s, size_t n) { shmem_char_sum_reduce(t, d, s, n); return 0; } +#undef shmem_char_sum_reduce +#define shmem_char_sum_reduce PySHMEM_Cray_shmem_char_sum_reduce + +static int PySHMEM_Cray_shmem_char_prod_reduce(shmem_team_t t, char *d, const char *s, size_t n) { shmem_char_prod_reduce(t, d, s, n); return 0; } +#undef shmem_char_prod_reduce +#define shmem_char_prod_reduce PySHMEM_Cray_shmem_char_prod_reduce + +static int PySHMEM_Cray_shmem_schar_max_reduce(shmem_team_t t, signed char *d, const signed char *s, size_t n) { shmem_schar_max_reduce(t, d, s, n); return 0; } +#undef shmem_schar_max_reduce +#define shmem_schar_max_reduce PySHMEM_Cray_shmem_schar_max_reduce + +static int PySHMEM_Cray_shmem_schar_min_reduce(shmem_team_t t, signed char *d, const signed char *s, size_t n) { shmem_schar_min_reduce(t, d, s, n); return 0; } +#undef shmem_schar_min_reduce +#define shmem_schar_min_reduce PySHMEM_Cray_shmem_schar_min_reduce + +static int PySHMEM_Cray_shmem_schar_sum_reduce(shmem_team_t t, signed char *d, const signed char *s, size_t n) { shmem_schar_sum_reduce(t, d, s, n); return 0; } +#undef shmem_schar_sum_reduce +#define shmem_schar_sum_reduce PySHMEM_Cray_shmem_schar_sum_reduce + +static int PySHMEM_Cray_shmem_schar_prod_reduce(shmem_team_t t, signed char *d, const signed char *s, size_t n) { shmem_schar_prod_reduce(t, d, s, n); return 0; } +#undef shmem_schar_prod_reduce +#define shmem_schar_prod_reduce PySHMEM_Cray_shmem_schar_prod_reduce + +static int PySHMEM_Cray_shmem_short_max_reduce(shmem_team_t t, short *d, const short *s, size_t n) { shmem_short_max_reduce(t, d, s, n); return 0; } +#undef shmem_short_max_reduce +#define shmem_short_max_reduce PySHMEM_Cray_shmem_short_max_reduce + +static int PySHMEM_Cray_shmem_short_min_reduce(shmem_team_t t, short *d, const short *s, size_t n) { shmem_short_min_reduce(t, d, s, n); return 0; } +#undef shmem_short_min_reduce +#define shmem_short_min_reduce PySHMEM_Cray_shmem_short_min_reduce + +static int PySHMEM_Cray_shmem_short_sum_reduce(shmem_team_t t, short *d, const short *s, size_t n) { shmem_short_sum_reduce(t, d, s, n); return 0; } +#undef shmem_short_sum_reduce +#define shmem_short_sum_reduce PySHMEM_Cray_shmem_short_sum_reduce + +static int PySHMEM_Cray_shmem_short_prod_reduce(shmem_team_t t, short *d, const short *s, size_t n) { shmem_short_prod_reduce(t, d, s, n); return 0; } +#undef shmem_short_prod_reduce +#define shmem_short_prod_reduce PySHMEM_Cray_shmem_short_prod_reduce + +static int PySHMEM_Cray_shmem_int_max_reduce(shmem_team_t t, int *d, const int *s, size_t n) { shmem_int_max_reduce(t, d, s, n); return 0; } +#undef shmem_int_max_reduce +#define shmem_int_max_reduce PySHMEM_Cray_shmem_int_max_reduce + +static int PySHMEM_Cray_shmem_int_min_reduce(shmem_team_t t, int *d, const int *s, size_t n) { shmem_int_min_reduce(t, d, s, n); return 0; } +#undef shmem_int_min_reduce +#define shmem_int_min_reduce PySHMEM_Cray_shmem_int_min_reduce + +static int PySHMEM_Cray_shmem_int_sum_reduce(shmem_team_t t, int *d, const int *s, size_t n) { shmem_int_sum_reduce(t, d, s, n); return 0; } +#undef shmem_int_sum_reduce +#define shmem_int_sum_reduce PySHMEM_Cray_shmem_int_sum_reduce + +static int PySHMEM_Cray_shmem_int_prod_reduce(shmem_team_t t, int *d, const int *s, size_t n) { shmem_int_prod_reduce(t, d, s, n); return 0; } +#undef shmem_int_prod_reduce +#define shmem_int_prod_reduce PySHMEM_Cray_shmem_int_prod_reduce + +static int PySHMEM_Cray_shmem_long_max_reduce(shmem_team_t t, long *d, const long *s, size_t n) { shmem_long_max_reduce(t, d, s, n); return 0; } +#undef shmem_long_max_reduce +#define shmem_long_max_reduce PySHMEM_Cray_shmem_long_max_reduce + +static int PySHMEM_Cray_shmem_long_min_reduce(shmem_team_t t, long *d, const long *s, size_t n) { shmem_long_min_reduce(t, d, s, n); return 0; } +#undef shmem_long_min_reduce +#define shmem_long_min_reduce PySHMEM_Cray_shmem_long_min_reduce + +static int PySHMEM_Cray_shmem_long_sum_reduce(shmem_team_t t, long *d, const long *s, size_t n) { shmem_long_sum_reduce(t, d, s, n); return 0; } +#undef shmem_long_sum_reduce +#define shmem_long_sum_reduce PySHMEM_Cray_shmem_long_sum_reduce + +static int PySHMEM_Cray_shmem_long_prod_reduce(shmem_team_t t, long *d, const long *s, size_t n) { shmem_long_prod_reduce(t, d, s, n); return 0; } +#undef shmem_long_prod_reduce +#define shmem_long_prod_reduce PySHMEM_Cray_shmem_long_prod_reduce + +static int PySHMEM_Cray_shmem_longlong_max_reduce(shmem_team_t t, long long *d, const long long *s, size_t n) { shmem_longlong_max_reduce(t, d, s, n); return 0; } +#undef shmem_longlong_max_reduce +#define shmem_longlong_max_reduce PySHMEM_Cray_shmem_longlong_max_reduce + +static int PySHMEM_Cray_shmem_longlong_min_reduce(shmem_team_t t, long long *d, const long long *s, size_t n) { shmem_longlong_min_reduce(t, d, s, n); return 0; } +#undef shmem_longlong_min_reduce +#define shmem_longlong_min_reduce PySHMEM_Cray_shmem_longlong_min_reduce + +static int PySHMEM_Cray_shmem_longlong_sum_reduce(shmem_team_t t, long long *d, const long long *s, size_t n) { shmem_longlong_sum_reduce(t, d, s, n); return 0; } +#undef shmem_longlong_sum_reduce +#define shmem_longlong_sum_reduce PySHMEM_Cray_shmem_longlong_sum_reduce + +static int PySHMEM_Cray_shmem_longlong_prod_reduce(shmem_team_t t, long long *d, const long long *s, size_t n) { shmem_longlong_prod_reduce(t, d, s, n); return 0; } +#undef shmem_longlong_prod_reduce +#define shmem_longlong_prod_reduce PySHMEM_Cray_shmem_longlong_prod_reduce + +static int PySHMEM_Cray_shmem_ptrdiff_max_reduce(shmem_team_t t, ptrdiff_t *d, const ptrdiff_t *s, size_t n) { shmem_ptrdiff_max_reduce(t, d, s, n); return 0; } +#undef shmem_ptrdiff_max_reduce +#define shmem_ptrdiff_max_reduce PySHMEM_Cray_shmem_ptrdiff_max_reduce + +static int PySHMEM_Cray_shmem_ptrdiff_min_reduce(shmem_team_t t, ptrdiff_t *d, const ptrdiff_t *s, size_t n) { shmem_ptrdiff_min_reduce(t, d, s, n); return 0; } +#undef shmem_ptrdiff_min_reduce +#define shmem_ptrdiff_min_reduce PySHMEM_Cray_shmem_ptrdiff_min_reduce + +static int PySHMEM_Cray_shmem_ptrdiff_sum_reduce(shmem_team_t t, ptrdiff_t *d, const ptrdiff_t *s, size_t n) { shmem_ptrdiff_sum_reduce(t, d, s, n); return 0; } +#undef shmem_ptrdiff_sum_reduce +#define shmem_ptrdiff_sum_reduce PySHMEM_Cray_shmem_ptrdiff_sum_reduce + +static int PySHMEM_Cray_shmem_ptrdiff_prod_reduce(shmem_team_t t, ptrdiff_t *d, const ptrdiff_t *s, size_t n) { shmem_ptrdiff_prod_reduce(t, d, s, n); return 0; } +#undef shmem_ptrdiff_prod_reduce +#define shmem_ptrdiff_prod_reduce PySHMEM_Cray_shmem_ptrdiff_prod_reduce + +static int PySHMEM_Cray_shmem_uchar_and_reduce(shmem_team_t t, unsigned char *d, const unsigned char *s, size_t n) { shmem_uchar_and_reduce(t, d, s, n); return 0; } +#undef shmem_uchar_and_reduce +#define shmem_uchar_and_reduce PySHMEM_Cray_shmem_uchar_and_reduce + +static int PySHMEM_Cray_shmem_uchar_or_reduce(shmem_team_t t, unsigned char *d, const unsigned char *s, size_t n) { shmem_uchar_or_reduce(t, d, s, n); return 0; } +#undef shmem_uchar_or_reduce +#define shmem_uchar_or_reduce PySHMEM_Cray_shmem_uchar_or_reduce + +static int PySHMEM_Cray_shmem_uchar_xor_reduce(shmem_team_t t, unsigned char *d, const unsigned char *s, size_t n) { shmem_uchar_xor_reduce(t, d, s, n); return 0; } +#undef shmem_uchar_xor_reduce +#define shmem_uchar_xor_reduce PySHMEM_Cray_shmem_uchar_xor_reduce + +static int PySHMEM_Cray_shmem_uchar_max_reduce(shmem_team_t t, unsigned char *d, const unsigned char *s, size_t n) { shmem_uchar_max_reduce(t, d, s, n); return 0; } +#undef shmem_uchar_max_reduce +#define shmem_uchar_max_reduce PySHMEM_Cray_shmem_uchar_max_reduce + +static int PySHMEM_Cray_shmem_uchar_min_reduce(shmem_team_t t, unsigned char *d, const unsigned char *s, size_t n) { shmem_uchar_min_reduce(t, d, s, n); return 0; } +#undef shmem_uchar_min_reduce +#define shmem_uchar_min_reduce PySHMEM_Cray_shmem_uchar_min_reduce + +static int PySHMEM_Cray_shmem_uchar_sum_reduce(shmem_team_t t, unsigned char *d, const unsigned char *s, size_t n) { shmem_uchar_sum_reduce(t, d, s, n); return 0; } +#undef shmem_uchar_sum_reduce +#define shmem_uchar_sum_reduce PySHMEM_Cray_shmem_uchar_sum_reduce + +static int PySHMEM_Cray_shmem_uchar_prod_reduce(shmem_team_t t, unsigned char *d, const unsigned char *s, size_t n) { shmem_uchar_prod_reduce(t, d, s, n); return 0; } +#undef shmem_uchar_prod_reduce +#define shmem_uchar_prod_reduce PySHMEM_Cray_shmem_uchar_prod_reduce + +static int PySHMEM_Cray_shmem_ushort_and_reduce(shmem_team_t t, unsigned short *d, const unsigned short *s, size_t n) { shmem_ushort_and_reduce(t, d, s, n); return 0; } +#undef shmem_ushort_and_reduce +#define shmem_ushort_and_reduce PySHMEM_Cray_shmem_ushort_and_reduce + +static int PySHMEM_Cray_shmem_ushort_or_reduce(shmem_team_t t, unsigned short *d, const unsigned short *s, size_t n) { shmem_ushort_or_reduce(t, d, s, n); return 0; } +#undef shmem_ushort_or_reduce +#define shmem_ushort_or_reduce PySHMEM_Cray_shmem_ushort_or_reduce + +static int PySHMEM_Cray_shmem_ushort_xor_reduce(shmem_team_t t, unsigned short *d, const unsigned short *s, size_t n) { shmem_ushort_xor_reduce(t, d, s, n); return 0; } +#undef shmem_ushort_xor_reduce +#define shmem_ushort_xor_reduce PySHMEM_Cray_shmem_ushort_xor_reduce + +static int PySHMEM_Cray_shmem_ushort_max_reduce(shmem_team_t t, unsigned short *d, const unsigned short *s, size_t n) { shmem_ushort_max_reduce(t, d, s, n); return 0; } +#undef shmem_ushort_max_reduce +#define shmem_ushort_max_reduce PySHMEM_Cray_shmem_ushort_max_reduce + +static int PySHMEM_Cray_shmem_ushort_min_reduce(shmem_team_t t, unsigned short *d, const unsigned short *s, size_t n) { shmem_ushort_min_reduce(t, d, s, n); return 0; } +#undef shmem_ushort_min_reduce +#define shmem_ushort_min_reduce PySHMEM_Cray_shmem_ushort_min_reduce + +static int PySHMEM_Cray_shmem_ushort_sum_reduce(shmem_team_t t, unsigned short *d, const unsigned short *s, size_t n) { shmem_ushort_sum_reduce(t, d, s, n); return 0; } +#undef shmem_ushort_sum_reduce +#define shmem_ushort_sum_reduce PySHMEM_Cray_shmem_ushort_sum_reduce + +static int PySHMEM_Cray_shmem_ushort_prod_reduce(shmem_team_t t, unsigned short *d, const unsigned short *s, size_t n) { shmem_ushort_prod_reduce(t, d, s, n); return 0; } +#undef shmem_ushort_prod_reduce +#define shmem_ushort_prod_reduce PySHMEM_Cray_shmem_ushort_prod_reduce + +static int PySHMEM_Cray_shmem_uint_and_reduce(shmem_team_t t, unsigned int *d, const unsigned int *s, size_t n) { shmem_uint_and_reduce(t, d, s, n); return 0; } +#undef shmem_uint_and_reduce +#define shmem_uint_and_reduce PySHMEM_Cray_shmem_uint_and_reduce + +static int PySHMEM_Cray_shmem_uint_or_reduce(shmem_team_t t, unsigned int *d, const unsigned int *s, size_t n) { shmem_uint_or_reduce(t, d, s, n); return 0; } +#undef shmem_uint_or_reduce +#define shmem_uint_or_reduce PySHMEM_Cray_shmem_uint_or_reduce + +static int PySHMEM_Cray_shmem_uint_xor_reduce(shmem_team_t t, unsigned int *d, const unsigned int *s, size_t n) { shmem_uint_xor_reduce(t, d, s, n); return 0; } +#undef shmem_uint_xor_reduce +#define shmem_uint_xor_reduce PySHMEM_Cray_shmem_uint_xor_reduce + +static int PySHMEM_Cray_shmem_uint_max_reduce(shmem_team_t t, unsigned int *d, const unsigned int *s, size_t n) { shmem_uint_max_reduce(t, d, s, n); return 0; } +#undef shmem_uint_max_reduce +#define shmem_uint_max_reduce PySHMEM_Cray_shmem_uint_max_reduce + +static int PySHMEM_Cray_shmem_uint_min_reduce(shmem_team_t t, unsigned int *d, const unsigned int *s, size_t n) { shmem_uint_min_reduce(t, d, s, n); return 0; } +#undef shmem_uint_min_reduce +#define shmem_uint_min_reduce PySHMEM_Cray_shmem_uint_min_reduce + +static int PySHMEM_Cray_shmem_uint_sum_reduce(shmem_team_t t, unsigned int *d, const unsigned int *s, size_t n) { shmem_uint_sum_reduce(t, d, s, n); return 0; } +#undef shmem_uint_sum_reduce +#define shmem_uint_sum_reduce PySHMEM_Cray_shmem_uint_sum_reduce + +static int PySHMEM_Cray_shmem_uint_prod_reduce(shmem_team_t t, unsigned int *d, const unsigned int *s, size_t n) { shmem_uint_prod_reduce(t, d, s, n); return 0; } +#undef shmem_uint_prod_reduce +#define shmem_uint_prod_reduce PySHMEM_Cray_shmem_uint_prod_reduce + +static int PySHMEM_Cray_shmem_ulong_and_reduce(shmem_team_t t, unsigned long *d, const unsigned long *s, size_t n) { shmem_ulong_and_reduce(t, d, s, n); return 0; } +#undef shmem_ulong_and_reduce +#define shmem_ulong_and_reduce PySHMEM_Cray_shmem_ulong_and_reduce + +static int PySHMEM_Cray_shmem_ulong_or_reduce(shmem_team_t t, unsigned long *d, const unsigned long *s, size_t n) { shmem_ulong_or_reduce(t, d, s, n); return 0; } +#undef shmem_ulong_or_reduce +#define shmem_ulong_or_reduce PySHMEM_Cray_shmem_ulong_or_reduce + +static int PySHMEM_Cray_shmem_ulong_xor_reduce(shmem_team_t t, unsigned long *d, const unsigned long *s, size_t n) { shmem_ulong_xor_reduce(t, d, s, n); return 0; } +#undef shmem_ulong_xor_reduce +#define shmem_ulong_xor_reduce PySHMEM_Cray_shmem_ulong_xor_reduce + +static int PySHMEM_Cray_shmem_ulong_max_reduce(shmem_team_t t, unsigned long *d, const unsigned long *s, size_t n) { shmem_ulong_max_reduce(t, d, s, n); return 0; } +#undef shmem_ulong_max_reduce +#define shmem_ulong_max_reduce PySHMEM_Cray_shmem_ulong_max_reduce + +static int PySHMEM_Cray_shmem_ulong_min_reduce(shmem_team_t t, unsigned long *d, const unsigned long *s, size_t n) { shmem_ulong_min_reduce(t, d, s, n); return 0; } +#undef shmem_ulong_min_reduce +#define shmem_ulong_min_reduce PySHMEM_Cray_shmem_ulong_min_reduce + +static int PySHMEM_Cray_shmem_ulong_sum_reduce(shmem_team_t t, unsigned long *d, const unsigned long *s, size_t n) { shmem_ulong_sum_reduce(t, d, s, n); return 0; } +#undef shmem_ulong_sum_reduce +#define shmem_ulong_sum_reduce PySHMEM_Cray_shmem_ulong_sum_reduce + +static int PySHMEM_Cray_shmem_ulong_prod_reduce(shmem_team_t t, unsigned long *d, const unsigned long *s, size_t n) { shmem_ulong_prod_reduce(t, d, s, n); return 0; } +#undef shmem_ulong_prod_reduce +#define shmem_ulong_prod_reduce PySHMEM_Cray_shmem_ulong_prod_reduce + +static int PySHMEM_Cray_shmem_ulonglong_and_reduce(shmem_team_t t, unsigned long long *d, const unsigned long long *s, size_t n) { shmem_ulonglong_and_reduce(t, d, s, n); return 0; } +#undef shmem_ulonglong_and_reduce +#define shmem_ulonglong_and_reduce PySHMEM_Cray_shmem_ulonglong_and_reduce + +static int PySHMEM_Cray_shmem_ulonglong_or_reduce(shmem_team_t t, unsigned long long *d, const unsigned long long *s, size_t n) { shmem_ulonglong_or_reduce(t, d, s, n); return 0; } +#undef shmem_ulonglong_or_reduce +#define shmem_ulonglong_or_reduce PySHMEM_Cray_shmem_ulonglong_or_reduce + +static int PySHMEM_Cray_shmem_ulonglong_xor_reduce(shmem_team_t t, unsigned long long *d, const unsigned long long *s, size_t n) { shmem_ulonglong_xor_reduce(t, d, s, n); return 0; } +#undef shmem_ulonglong_xor_reduce +#define shmem_ulonglong_xor_reduce PySHMEM_Cray_shmem_ulonglong_xor_reduce + +static int PySHMEM_Cray_shmem_ulonglong_max_reduce(shmem_team_t t, unsigned long long *d, const unsigned long long *s, size_t n) { shmem_ulonglong_max_reduce(t, d, s, n); return 0; } +#undef shmem_ulonglong_max_reduce +#define shmem_ulonglong_max_reduce PySHMEM_Cray_shmem_ulonglong_max_reduce + +static int PySHMEM_Cray_shmem_ulonglong_min_reduce(shmem_team_t t, unsigned long long *d, const unsigned long long *s, size_t n) { shmem_ulonglong_min_reduce(t, d, s, n); return 0; } +#undef shmem_ulonglong_min_reduce +#define shmem_ulonglong_min_reduce PySHMEM_Cray_shmem_ulonglong_min_reduce + +static int PySHMEM_Cray_shmem_ulonglong_sum_reduce(shmem_team_t t, unsigned long long *d, const unsigned long long *s, size_t n) { shmem_ulonglong_sum_reduce(t, d, s, n); return 0; } +#undef shmem_ulonglong_sum_reduce +#define shmem_ulonglong_sum_reduce PySHMEM_Cray_shmem_ulonglong_sum_reduce + +static int PySHMEM_Cray_shmem_ulonglong_prod_reduce(shmem_team_t t, unsigned long long *d, const unsigned long long *s, size_t n) { shmem_ulonglong_prod_reduce(t, d, s, n); return 0; } +#undef shmem_ulonglong_prod_reduce +#define shmem_ulonglong_prod_reduce PySHMEM_Cray_shmem_ulonglong_prod_reduce + +static int PySHMEM_Cray_shmem_int8_and_reduce(shmem_team_t t, int8_t *d, const int8_t *s, size_t n) { shmem_int8_and_reduce(t, d, s, n); return 0; } +#undef shmem_int8_and_reduce +#define shmem_int8_and_reduce PySHMEM_Cray_shmem_int8_and_reduce + +static int PySHMEM_Cray_shmem_int8_or_reduce(shmem_team_t t, int8_t *d, const int8_t *s, size_t n) { shmem_int8_or_reduce(t, d, s, n); return 0; } +#undef shmem_int8_or_reduce +#define shmem_int8_or_reduce PySHMEM_Cray_shmem_int8_or_reduce + +static int PySHMEM_Cray_shmem_int8_xor_reduce(shmem_team_t t, int8_t *d, const int8_t *s, size_t n) { shmem_int8_xor_reduce(t, d, s, n); return 0; } +#undef shmem_int8_xor_reduce +#define shmem_int8_xor_reduce PySHMEM_Cray_shmem_int8_xor_reduce + +static int PySHMEM_Cray_shmem_int8_max_reduce(shmem_team_t t, int8_t *d, const int8_t *s, size_t n) { shmem_int8_max_reduce(t, d, s, n); return 0; } +#undef shmem_int8_max_reduce +#define shmem_int8_max_reduce PySHMEM_Cray_shmem_int8_max_reduce + +static int PySHMEM_Cray_shmem_int8_min_reduce(shmem_team_t t, int8_t *d, const int8_t *s, size_t n) { shmem_int8_min_reduce(t, d, s, n); return 0; } +#undef shmem_int8_min_reduce +#define shmem_int8_min_reduce PySHMEM_Cray_shmem_int8_min_reduce + +static int PySHMEM_Cray_shmem_int8_sum_reduce(shmem_team_t t, int8_t *d, const int8_t *s, size_t n) { shmem_int8_sum_reduce(t, d, s, n); return 0; } +#undef shmem_int8_sum_reduce +#define shmem_int8_sum_reduce PySHMEM_Cray_shmem_int8_sum_reduce + +static int PySHMEM_Cray_shmem_int8_prod_reduce(shmem_team_t t, int8_t *d, const int8_t *s, size_t n) { shmem_int8_prod_reduce(t, d, s, n); return 0; } +#undef shmem_int8_prod_reduce +#define shmem_int8_prod_reduce PySHMEM_Cray_shmem_int8_prod_reduce + +static int PySHMEM_Cray_shmem_int16_and_reduce(shmem_team_t t, int16_t *d, const int16_t *s, size_t n) { shmem_int16_and_reduce(t, d, s, n); return 0; } +#undef shmem_int16_and_reduce +#define shmem_int16_and_reduce PySHMEM_Cray_shmem_int16_and_reduce + +static int PySHMEM_Cray_shmem_int16_or_reduce(shmem_team_t t, int16_t *d, const int16_t *s, size_t n) { shmem_int16_or_reduce(t, d, s, n); return 0; } +#undef shmem_int16_or_reduce +#define shmem_int16_or_reduce PySHMEM_Cray_shmem_int16_or_reduce + +static int PySHMEM_Cray_shmem_int16_xor_reduce(shmem_team_t t, int16_t *d, const int16_t *s, size_t n) { shmem_int16_xor_reduce(t, d, s, n); return 0; } +#undef shmem_int16_xor_reduce +#define shmem_int16_xor_reduce PySHMEM_Cray_shmem_int16_xor_reduce + +static int PySHMEM_Cray_shmem_int16_max_reduce(shmem_team_t t, int16_t *d, const int16_t *s, size_t n) { shmem_int16_max_reduce(t, d, s, n); return 0; } +#undef shmem_int16_max_reduce +#define shmem_int16_max_reduce PySHMEM_Cray_shmem_int16_max_reduce + +static int PySHMEM_Cray_shmem_int16_min_reduce(shmem_team_t t, int16_t *d, const int16_t *s, size_t n) { shmem_int16_min_reduce(t, d, s, n); return 0; } +#undef shmem_int16_min_reduce +#define shmem_int16_min_reduce PySHMEM_Cray_shmem_int16_min_reduce + +static int PySHMEM_Cray_shmem_int16_sum_reduce(shmem_team_t t, int16_t *d, const int16_t *s, size_t n) { shmem_int16_sum_reduce(t, d, s, n); return 0; } +#undef shmem_int16_sum_reduce +#define shmem_int16_sum_reduce PySHMEM_Cray_shmem_int16_sum_reduce + +static int PySHMEM_Cray_shmem_int16_prod_reduce(shmem_team_t t, int16_t *d, const int16_t *s, size_t n) { shmem_int16_prod_reduce(t, d, s, n); return 0; } +#undef shmem_int16_prod_reduce +#define shmem_int16_prod_reduce PySHMEM_Cray_shmem_int16_prod_reduce + +static int PySHMEM_Cray_shmem_int32_and_reduce(shmem_team_t t, int32_t *d, const int32_t *s, size_t n) { shmem_int32_and_reduce(t, d, s, n); return 0; } +#undef shmem_int32_and_reduce +#define shmem_int32_and_reduce PySHMEM_Cray_shmem_int32_and_reduce + +static int PySHMEM_Cray_shmem_int32_or_reduce(shmem_team_t t, int32_t *d, const int32_t *s, size_t n) { shmem_int32_or_reduce(t, d, s, n); return 0; } +#undef shmem_int32_or_reduce +#define shmem_int32_or_reduce PySHMEM_Cray_shmem_int32_or_reduce + +static int PySHMEM_Cray_shmem_int32_xor_reduce(shmem_team_t t, int32_t *d, const int32_t *s, size_t n) { shmem_int32_xor_reduce(t, d, s, n); return 0; } +#undef shmem_int32_xor_reduce +#define shmem_int32_xor_reduce PySHMEM_Cray_shmem_int32_xor_reduce + +static int PySHMEM_Cray_shmem_int32_max_reduce(shmem_team_t t, int32_t *d, const int32_t *s, size_t n) { shmem_int32_max_reduce(t, d, s, n); return 0; } +#undef shmem_int32_max_reduce +#define shmem_int32_max_reduce PySHMEM_Cray_shmem_int32_max_reduce + +static int PySHMEM_Cray_shmem_int32_min_reduce(shmem_team_t t, int32_t *d, const int32_t *s, size_t n) { shmem_int32_min_reduce(t, d, s, n); return 0; } +#undef shmem_int32_min_reduce +#define shmem_int32_min_reduce PySHMEM_Cray_shmem_int32_min_reduce + +static int PySHMEM_Cray_shmem_int32_sum_reduce(shmem_team_t t, int32_t *d, const int32_t *s, size_t n) { shmem_int32_sum_reduce(t, d, s, n); return 0; } +#undef shmem_int32_sum_reduce +#define shmem_int32_sum_reduce PySHMEM_Cray_shmem_int32_sum_reduce + +static int PySHMEM_Cray_shmem_int32_prod_reduce(shmem_team_t t, int32_t *d, const int32_t *s, size_t n) { shmem_int32_prod_reduce(t, d, s, n); return 0; } +#undef shmem_int32_prod_reduce +#define shmem_int32_prod_reduce PySHMEM_Cray_shmem_int32_prod_reduce + +static int PySHMEM_Cray_shmem_int64_and_reduce(shmem_team_t t, int64_t *d, const int64_t *s, size_t n) { shmem_int64_and_reduce(t, d, s, n); return 0; } +#undef shmem_int64_and_reduce +#define shmem_int64_and_reduce PySHMEM_Cray_shmem_int64_and_reduce + +static int PySHMEM_Cray_shmem_int64_or_reduce(shmem_team_t t, int64_t *d, const int64_t *s, size_t n) { shmem_int64_or_reduce(t, d, s, n); return 0; } +#undef shmem_int64_or_reduce +#define shmem_int64_or_reduce PySHMEM_Cray_shmem_int64_or_reduce + +static int PySHMEM_Cray_shmem_int64_xor_reduce(shmem_team_t t, int64_t *d, const int64_t *s, size_t n) { shmem_int64_xor_reduce(t, d, s, n); return 0; } +#undef shmem_int64_xor_reduce +#define shmem_int64_xor_reduce PySHMEM_Cray_shmem_int64_xor_reduce + +static int PySHMEM_Cray_shmem_int64_max_reduce(shmem_team_t t, int64_t *d, const int64_t *s, size_t n) { shmem_int64_max_reduce(t, d, s, n); return 0; } +#undef shmem_int64_max_reduce +#define shmem_int64_max_reduce PySHMEM_Cray_shmem_int64_max_reduce + +static int PySHMEM_Cray_shmem_int64_min_reduce(shmem_team_t t, int64_t *d, const int64_t *s, size_t n) { shmem_int64_min_reduce(t, d, s, n); return 0; } +#undef shmem_int64_min_reduce +#define shmem_int64_min_reduce PySHMEM_Cray_shmem_int64_min_reduce + +static int PySHMEM_Cray_shmem_int64_sum_reduce(shmem_team_t t, int64_t *d, const int64_t *s, size_t n) { shmem_int64_sum_reduce(t, d, s, n); return 0; } +#undef shmem_int64_sum_reduce +#define shmem_int64_sum_reduce PySHMEM_Cray_shmem_int64_sum_reduce + +static int PySHMEM_Cray_shmem_int64_prod_reduce(shmem_team_t t, int64_t *d, const int64_t *s, size_t n) { shmem_int64_prod_reduce(t, d, s, n); return 0; } +#undef shmem_int64_prod_reduce +#define shmem_int64_prod_reduce PySHMEM_Cray_shmem_int64_prod_reduce + +static int PySHMEM_Cray_shmem_uint8_and_reduce(shmem_team_t t, uint8_t *d, const uint8_t *s, size_t n) { shmem_uint8_and_reduce(t, d, s, n); return 0; } +#undef shmem_uint8_and_reduce +#define shmem_uint8_and_reduce PySHMEM_Cray_shmem_uint8_and_reduce + +static int PySHMEM_Cray_shmem_uint8_or_reduce(shmem_team_t t, uint8_t *d, const uint8_t *s, size_t n) { shmem_uint8_or_reduce(t, d, s, n); return 0; } +#undef shmem_uint8_or_reduce +#define shmem_uint8_or_reduce PySHMEM_Cray_shmem_uint8_or_reduce + +static int PySHMEM_Cray_shmem_uint8_xor_reduce(shmem_team_t t, uint8_t *d, const uint8_t *s, size_t n) { shmem_uint8_xor_reduce(t, d, s, n); return 0; } +#undef shmem_uint8_xor_reduce +#define shmem_uint8_xor_reduce PySHMEM_Cray_shmem_uint8_xor_reduce + +static int PySHMEM_Cray_shmem_uint8_max_reduce(shmem_team_t t, uint8_t *d, const uint8_t *s, size_t n) { shmem_uint8_max_reduce(t, d, s, n); return 0; } +#undef shmem_uint8_max_reduce +#define shmem_uint8_max_reduce PySHMEM_Cray_shmem_uint8_max_reduce + +static int PySHMEM_Cray_shmem_uint8_min_reduce(shmem_team_t t, uint8_t *d, const uint8_t *s, size_t n) { shmem_uint8_min_reduce(t, d, s, n); return 0; } +#undef shmem_uint8_min_reduce +#define shmem_uint8_min_reduce PySHMEM_Cray_shmem_uint8_min_reduce + +static int PySHMEM_Cray_shmem_uint8_sum_reduce(shmem_team_t t, uint8_t *d, const uint8_t *s, size_t n) { shmem_uint8_sum_reduce(t, d, s, n); return 0; } +#undef shmem_uint8_sum_reduce +#define shmem_uint8_sum_reduce PySHMEM_Cray_shmem_uint8_sum_reduce + +static int PySHMEM_Cray_shmem_uint8_prod_reduce(shmem_team_t t, uint8_t *d, const uint8_t *s, size_t n) { shmem_uint8_prod_reduce(t, d, s, n); return 0; } +#undef shmem_uint8_prod_reduce +#define shmem_uint8_prod_reduce PySHMEM_Cray_shmem_uint8_prod_reduce + +static int PySHMEM_Cray_shmem_uint16_and_reduce(shmem_team_t t, uint16_t *d, const uint16_t *s, size_t n) { shmem_uint16_and_reduce(t, d, s, n); return 0; } +#undef shmem_uint16_and_reduce +#define shmem_uint16_and_reduce PySHMEM_Cray_shmem_uint16_and_reduce + +static int PySHMEM_Cray_shmem_uint16_or_reduce(shmem_team_t t, uint16_t *d, const uint16_t *s, size_t n) { shmem_uint16_or_reduce(t, d, s, n); return 0; } +#undef shmem_uint16_or_reduce +#define shmem_uint16_or_reduce PySHMEM_Cray_shmem_uint16_or_reduce + +static int PySHMEM_Cray_shmem_uint16_xor_reduce(shmem_team_t t, uint16_t *d, const uint16_t *s, size_t n) { shmem_uint16_xor_reduce(t, d, s, n); return 0; } +#undef shmem_uint16_xor_reduce +#define shmem_uint16_xor_reduce PySHMEM_Cray_shmem_uint16_xor_reduce + +static int PySHMEM_Cray_shmem_uint16_max_reduce(shmem_team_t t, uint16_t *d, const uint16_t *s, size_t n) { shmem_uint16_max_reduce(t, d, s, n); return 0; } +#undef shmem_uint16_max_reduce +#define shmem_uint16_max_reduce PySHMEM_Cray_shmem_uint16_max_reduce + +static int PySHMEM_Cray_shmem_uint16_min_reduce(shmem_team_t t, uint16_t *d, const uint16_t *s, size_t n) { shmem_uint16_min_reduce(t, d, s, n); return 0; } +#undef shmem_uint16_min_reduce +#define shmem_uint16_min_reduce PySHMEM_Cray_shmem_uint16_min_reduce + +static int PySHMEM_Cray_shmem_uint16_sum_reduce(shmem_team_t t, uint16_t *d, const uint16_t *s, size_t n) { shmem_uint16_sum_reduce(t, d, s, n); return 0; } +#undef shmem_uint16_sum_reduce +#define shmem_uint16_sum_reduce PySHMEM_Cray_shmem_uint16_sum_reduce + +static int PySHMEM_Cray_shmem_uint16_prod_reduce(shmem_team_t t, uint16_t *d, const uint16_t *s, size_t n) { shmem_uint16_prod_reduce(t, d, s, n); return 0; } +#undef shmem_uint16_prod_reduce +#define shmem_uint16_prod_reduce PySHMEM_Cray_shmem_uint16_prod_reduce + +static int PySHMEM_Cray_shmem_uint32_and_reduce(shmem_team_t t, uint32_t *d, const uint32_t *s, size_t n) { shmem_uint32_and_reduce(t, d, s, n); return 0; } +#undef shmem_uint32_and_reduce +#define shmem_uint32_and_reduce PySHMEM_Cray_shmem_uint32_and_reduce + +static int PySHMEM_Cray_shmem_uint32_or_reduce(shmem_team_t t, uint32_t *d, const uint32_t *s, size_t n) { shmem_uint32_or_reduce(t, d, s, n); return 0; } +#undef shmem_uint32_or_reduce +#define shmem_uint32_or_reduce PySHMEM_Cray_shmem_uint32_or_reduce + +static int PySHMEM_Cray_shmem_uint32_xor_reduce(shmem_team_t t, uint32_t *d, const uint32_t *s, size_t n) { shmem_uint32_xor_reduce(t, d, s, n); return 0; } +#undef shmem_uint32_xor_reduce +#define shmem_uint32_xor_reduce PySHMEM_Cray_shmem_uint32_xor_reduce + +static int PySHMEM_Cray_shmem_uint32_max_reduce(shmem_team_t t, uint32_t *d, const uint32_t *s, size_t n) { shmem_uint32_max_reduce(t, d, s, n); return 0; } +#undef shmem_uint32_max_reduce +#define shmem_uint32_max_reduce PySHMEM_Cray_shmem_uint32_max_reduce + +static int PySHMEM_Cray_shmem_uint32_min_reduce(shmem_team_t t, uint32_t *d, const uint32_t *s, size_t n) { shmem_uint32_min_reduce(t, d, s, n); return 0; } +#undef shmem_uint32_min_reduce +#define shmem_uint32_min_reduce PySHMEM_Cray_shmem_uint32_min_reduce + +static int PySHMEM_Cray_shmem_uint32_sum_reduce(shmem_team_t t, uint32_t *d, const uint32_t *s, size_t n) { shmem_uint32_sum_reduce(t, d, s, n); return 0; } +#undef shmem_uint32_sum_reduce +#define shmem_uint32_sum_reduce PySHMEM_Cray_shmem_uint32_sum_reduce + +static int PySHMEM_Cray_shmem_uint32_prod_reduce(shmem_team_t t, uint32_t *d, const uint32_t *s, size_t n) { shmem_uint32_prod_reduce(t, d, s, n); return 0; } +#undef shmem_uint32_prod_reduce +#define shmem_uint32_prod_reduce PySHMEM_Cray_shmem_uint32_prod_reduce + +static int PySHMEM_Cray_shmem_uint64_and_reduce(shmem_team_t t, uint64_t *d, const uint64_t *s, size_t n) { shmem_uint64_and_reduce(t, d, s, n); return 0; } +#undef shmem_uint64_and_reduce +#define shmem_uint64_and_reduce PySHMEM_Cray_shmem_uint64_and_reduce + +static int PySHMEM_Cray_shmem_uint64_or_reduce(shmem_team_t t, uint64_t *d, const uint64_t *s, size_t n) { shmem_uint64_or_reduce(t, d, s, n); return 0; } +#undef shmem_uint64_or_reduce +#define shmem_uint64_or_reduce PySHMEM_Cray_shmem_uint64_or_reduce + +static int PySHMEM_Cray_shmem_uint64_xor_reduce(shmem_team_t t, uint64_t *d, const uint64_t *s, size_t n) { shmem_uint64_xor_reduce(t, d, s, n); return 0; } +#undef shmem_uint64_xor_reduce +#define shmem_uint64_xor_reduce PySHMEM_Cray_shmem_uint64_xor_reduce + +static int PySHMEM_Cray_shmem_uint64_max_reduce(shmem_team_t t, uint64_t *d, const uint64_t *s, size_t n) { shmem_uint64_max_reduce(t, d, s, n); return 0; } +#undef shmem_uint64_max_reduce +#define shmem_uint64_max_reduce PySHMEM_Cray_shmem_uint64_max_reduce + +static int PySHMEM_Cray_shmem_uint64_min_reduce(shmem_team_t t, uint64_t *d, const uint64_t *s, size_t n) { shmem_uint64_min_reduce(t, d, s, n); return 0; } +#undef shmem_uint64_min_reduce +#define shmem_uint64_min_reduce PySHMEM_Cray_shmem_uint64_min_reduce + +static int PySHMEM_Cray_shmem_uint64_sum_reduce(shmem_team_t t, uint64_t *d, const uint64_t *s, size_t n) { shmem_uint64_sum_reduce(t, d, s, n); return 0; } +#undef shmem_uint64_sum_reduce +#define shmem_uint64_sum_reduce PySHMEM_Cray_shmem_uint64_sum_reduce + +static int PySHMEM_Cray_shmem_uint64_prod_reduce(shmem_team_t t, uint64_t *d, const uint64_t *s, size_t n) { shmem_uint64_prod_reduce(t, d, s, n); return 0; } +#undef shmem_uint64_prod_reduce +#define shmem_uint64_prod_reduce PySHMEM_Cray_shmem_uint64_prod_reduce + +static int PySHMEM_Cray_shmem_size_and_reduce(shmem_team_t t, size_t *d, const size_t *s, size_t n) { shmem_size_and_reduce(t, d, s, n); return 0; } +#undef shmem_size_and_reduce +#define shmem_size_and_reduce PySHMEM_Cray_shmem_size_and_reduce + +static int PySHMEM_Cray_shmem_size_or_reduce(shmem_team_t t, size_t *d, const size_t *s, size_t n) { shmem_size_or_reduce(t, d, s, n); return 0; } +#undef shmem_size_or_reduce +#define shmem_size_or_reduce PySHMEM_Cray_shmem_size_or_reduce + +static int PySHMEM_Cray_shmem_size_xor_reduce(shmem_team_t t, size_t *d, const size_t *s, size_t n) { shmem_size_xor_reduce(t, d, s, n); return 0; } +#undef shmem_size_xor_reduce +#define shmem_size_xor_reduce PySHMEM_Cray_shmem_size_xor_reduce + +static int PySHMEM_Cray_shmem_size_max_reduce(shmem_team_t t, size_t *d, const size_t *s, size_t n) { shmem_size_max_reduce(t, d, s, n); return 0; } +#undef shmem_size_max_reduce +#define shmem_size_max_reduce PySHMEM_Cray_shmem_size_max_reduce + +static int PySHMEM_Cray_shmem_size_min_reduce(shmem_team_t t, size_t *d, const size_t *s, size_t n) { shmem_size_min_reduce(t, d, s, n); return 0; } +#undef shmem_size_min_reduce +#define shmem_size_min_reduce PySHMEM_Cray_shmem_size_min_reduce + +static int PySHMEM_Cray_shmem_size_sum_reduce(shmem_team_t t, size_t *d, const size_t *s, size_t n) { shmem_size_sum_reduce(t, d, s, n); return 0; } +#undef shmem_size_sum_reduce +#define shmem_size_sum_reduce PySHMEM_Cray_shmem_size_sum_reduce + +static int PySHMEM_Cray_shmem_size_prod_reduce(shmem_team_t t, size_t *d, const size_t *s, size_t n) { shmem_size_prod_reduce(t, d, s, n); return 0; } +#undef shmem_size_prod_reduce +#define shmem_size_prod_reduce PySHMEM_Cray_shmem_size_prod_reduce + +static int PySHMEM_Cray_shmem_float_max_reduce(shmem_team_t t, float *d, const float *s, size_t n) { shmem_float_max_reduce(t, d, s, n); return 0; } +#undef shmem_float_max_reduce +#define shmem_float_max_reduce PySHMEM_Cray_shmem_float_max_reduce + +static int PySHMEM_Cray_shmem_float_min_reduce(shmem_team_t t, float *d, const float *s, size_t n) { shmem_float_min_reduce(t, d, s, n); return 0; } +#undef shmem_float_min_reduce +#define shmem_float_min_reduce PySHMEM_Cray_shmem_float_min_reduce + +static int PySHMEM_Cray_shmem_float_sum_reduce(shmem_team_t t, float *d, const float *s, size_t n) { shmem_float_sum_reduce(t, d, s, n); return 0; } +#undef shmem_float_sum_reduce +#define shmem_float_sum_reduce PySHMEM_Cray_shmem_float_sum_reduce + +static int PySHMEM_Cray_shmem_float_prod_reduce(shmem_team_t t, float *d, const float *s, size_t n) { shmem_float_prod_reduce(t, d, s, n); return 0; } +#undef shmem_float_prod_reduce +#define shmem_float_prod_reduce PySHMEM_Cray_shmem_float_prod_reduce + +static int PySHMEM_Cray_shmem_double_max_reduce(shmem_team_t t, double *d, const double *s, size_t n) { shmem_double_max_reduce(t, d, s, n); return 0; } +#undef shmem_double_max_reduce +#define shmem_double_max_reduce PySHMEM_Cray_shmem_double_max_reduce + +static int PySHMEM_Cray_shmem_double_min_reduce(shmem_team_t t, double *d, const double *s, size_t n) { shmem_double_min_reduce(t, d, s, n); return 0; } +#undef shmem_double_min_reduce +#define shmem_double_min_reduce PySHMEM_Cray_shmem_double_min_reduce + +static int PySHMEM_Cray_shmem_double_sum_reduce(shmem_team_t t, double *d, const double *s, size_t n) { shmem_double_sum_reduce(t, d, s, n); return 0; } +#undef shmem_double_sum_reduce +#define shmem_double_sum_reduce PySHMEM_Cray_shmem_double_sum_reduce + +static int PySHMEM_Cray_shmem_double_prod_reduce(shmem_team_t t, double *d, const double *s, size_t n) { shmem_double_prod_reduce(t, d, s, n); return 0; } +#undef shmem_double_prod_reduce +#define shmem_double_prod_reduce PySHMEM_Cray_shmem_double_prod_reduce + +static int PySHMEM_Cray_shmem_longdouble_max_reduce(shmem_team_t t, long double *d, const long double *s, size_t n) { shmem_longdouble_max_reduce(t, d, s, n); return 0; } +#undef shmem_longdouble_max_reduce +#define shmem_longdouble_max_reduce PySHMEM_Cray_shmem_longdouble_max_reduce + +static int PySHMEM_Cray_shmem_longdouble_min_reduce(shmem_team_t t, long double *d, const long double *s, size_t n) { shmem_longdouble_min_reduce(t, d, s, n); return 0; } +#undef shmem_longdouble_min_reduce +#define shmem_longdouble_min_reduce PySHMEM_Cray_shmem_longdouble_min_reduce + +static int PySHMEM_Cray_shmem_longdouble_sum_reduce(shmem_team_t t, long double *d, const long double *s, size_t n) { shmem_longdouble_sum_reduce(t, d, s, n); return 0; } +#undef shmem_longdouble_sum_reduce +#define shmem_longdouble_sum_reduce PySHMEM_Cray_shmem_longdouble_sum_reduce + +static int PySHMEM_Cray_shmem_longdouble_prod_reduce(shmem_team_t t, long double *d, const long double *s, size_t n) { shmem_longdouble_prod_reduce(t, d, s, n); return 0; } +#undef shmem_longdouble_prod_reduce +#define shmem_longdouble_prod_reduce PySHMEM_Cray_shmem_longdouble_prod_reduce + +static int PySHMEM_Cray_shmem_complexd_sum_reduce(shmem_team_t t, double _Complex *d, const double _Complex *s, size_t n) { shmem_double_sum_reduce(t, (double*)d, (const double*)s, 2*n); return 0; } +#undef shmem_complexd_sum_reduce +#define shmem_complexd_sum_reduce PySHMEM_Cray_shmem_complexd_sum_reduce + +static int PySHMEM_Cray_shmem_complexd_prod_reduce(shmem_team_t t, double _Complex *d, const double _Complex *s, size_t n) { (void)t; (void)d; (void)s; (void)n; return PySHMEM_UNAVAILABLE; } +#undef shmem_complexd_prod_reduce +#define shmem_complexd_prod_reduce PySHMEM_Cray_shmem_complexd_prod_reduce + +static int PySHMEM_Cray_shmem_complexf_sum_reduce(shmem_team_t t, float _Complex *d, const float _Complex *s, size_t n) { shmem_float_sum_reduce(t, (float*)d, (const float*)s, 2*n); return 0; } +#undef shmem_complexf_sum_reduce +#define shmem_complexf_sum_reduce PySHMEM_Cray_shmem_complexf_sum_reduce + +static int PySHMEM_Cray_shmem_complexf_prod_reduce(shmem_team_t t, float _Complex *d, const float _Complex *s, size_t n) { (void)t; (void)d; (void)s; (void)n; return PySHMEM_UNAVAILABLE; } +#undef shmem_complexf_prod_reduce +#define shmem_complexf_prod_reduce PySHMEM_Cray_shmem_complexf_prod_reduce diff --git a/src/libshmem/config/cray.h b/src/libshmem/config/cray.h index db66c31..e6a881d 100644 --- a/src/libshmem/config/cray.h +++ b/src/libshmem/config/cray.h @@ -1,4 +1,27 @@ #ifndef PySHMEM_CONFIG_CRAY_H #define PySHMEM_CONFIG_CRAY_H +#if CRAY_SHMEM_MAJOR_VERSION >= 11 +#define PySHMEM_HAVE_shmem_malloc_with_hints 1 +#define PySHMEM_HAVE_shmem_team_t 1 +#define PySHMEM_HAVE_SHMEM_CTX_INVALID 1 +#define PySHMEM_HAVE_shmem_amo_nbi 1 +#define PySHMEM_HAVE_shmem_put_signal 1 +#define PySHMEM_HAVE_shmem_signal_fetch 1 +#define PySHMEM_HAVE_shmem_signal_wait_until 1 +#define PySHMEM_HAVE_shmem_broadcast 1 +#define PySHMEM_HAVE_shmem_collect 1 +#define PySHMEM_HAVE_shmem_fcollect 1 +#define PySHMEM_HAVE_shmem_alltoall 1 +#define PySHMEM_HAVE_shmem_alltoalls 1 +#define PySHMEM_HAVE_shmem_broadcastmem 1 +#define PySHMEM_HAVE_shmem_collectmem 1 +#define PySHMEM_HAVE_shmem_fcollectmem 1 +#define PySHMEM_HAVE_shmem_alltoallmem 1 +#define PySHMEM_HAVE_shmem_alltoallsmem 1 +#define PySHMEM_HAVE_shmem_reduce 1 +#define PySHMEM_HAVE_shmem_wait_test_many 1 +/* #define PySHMEM_HAVE_shmem_pcontrol 1 */ +#endif + #endif diff --git a/src/libshmem/hdltypes.h b/src/libshmem/hdltypes.h new file mode 100644 index 0000000..7a73d58 --- /dev/null +++ b/src/libshmem/hdltypes.h @@ -0,0 +1,7 @@ +#define eq_ctx(a, b) ((a) == (b)) +#define ctx2id(c) ((uintptr_t)(c)) +#define id2ctx(i) ((shmem_ctx_t)(i)) + +#define eq_team(a, b) ((a) == (b)) +#define team2id(t) ((uintptr_t)(t)) +#define id2team(i) ((shmem_team_t)i) diff --git a/src/shmem4py/shmem.py b/src/shmem4py/shmem.py index 3d373b7..67087c9 100644 --- a/src/shmem4py/shmem.py +++ b/src/shmem4py/shmem.py @@ -281,15 +281,15 @@ def __new__( def __eq__(self, other: Any) -> bool: if not isinstance(other, Ctx): return NotImplemented - return self.ob_ctx == other.ob_ctx + return lib.eq_ctx(self.ob_ctx, other.ob_ctx) def __ne__(self, other: Any) -> bool: if not isinstance(other, Ctx): return NotImplemented - return self.ob_ctx != other.ob_ctx + return not lib.eq_ctx(self.ob_ctx, other.ob_ctx) def __bool__(self) -> bool: - return self.ob_ctx != lib.SHMEM_CTX_INVALID + return not lib.eq_ctx(self.ob_ctx, lib.SHMEM_CTX_INVALID) def __enter__(self) -> Ctx: return self @@ -331,9 +331,9 @@ def destroy(self) -> None: return ctx = self.ob_ctx self.ob_ctx = lib.SHMEM_CTX_INVALID - if ctx == lib.SHMEM_CTX_DEFAULT: + if lib.eq_ctx(ctx, lib.SHMEM_CTX_DEFAULT): return - if ctx == lib.SHMEM_CTX_INVALID: + if lib.eq_ctx(ctx, lib.SHMEM_CTX_INVALID): return lib.shmem_ctx_destroy(ctx) @@ -400,15 +400,15 @@ def __new__( def __eq__(self, other: Any) -> bool: if not isinstance(other, Team): return NotImplemented - return self.ob_team == other.ob_team + return lib.eq_team(self.ob_team, other.ob_team) def __ne__(self, other: Any) -> bool: if not isinstance(other, Team): return NotImplemented - return self.ob_team != other.ob_team + return not lib.eq_team(self.ob_team, other.ob_team) def __bool__(self) -> bool: - return self.ob_team != lib.SHMEM_TEAM_INVALID + return not lib.eq_team(self.ob_team, lib.SHMEM_TEAM_INVALID) def __enter__(self) -> Team: return self @@ -426,11 +426,11 @@ def destroy(self) -> None: return team = self.ob_team self.ob_team = lib.SHMEM_TEAM_INVALID - if team == lib.SHMEM_TEAM_WORLD: + if lib.eq_team(team, lib.SHMEM_TEAM_WORLD): return - if team == lib.SHMEM_TEAM_SHARED: + if lib.eq_team(team, lib.SHMEM_TEAM_SHARED): return - if team == lib.SHMEM_TEAM_INVALID: + if lib.eq_team(team, lib.SHMEM_TEAM_INVALID): return lib.shmem_team_destroy(team)