Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teams API topic branch #886

Merged
merged 99 commits into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from 67 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
6d3a31b
Add Teams bare-bones API without any functionality
davidozog Apr 12, 2019
73439c9
Add a KVS of available teams (DO NOT MERGE)
davidozog Apr 23, 2019
99d2f97
Teams: remove uthash and make all strides linear
davidozog Apr 26, 2019
f00ac33
Add shmemx_tem_translate unit test
davidozog Apr 29, 2019
1526cf2
Fix global_exit seg fault with no backtrace method
davidozog Apr 29, 2019
2f2fb84
Return `#include "config.h"` to `shmem_env.h`
davidozog Apr 30, 2019
52339d8
Assure teams API routines are prepended w/ shmemx
davidozog Apr 30, 2019
0e9a662
Add implementation/test of shmem_team_translate_pe
davidozog Apr 30, 2019
1b53db4
Update to shmem_internal_team_t where needed
davidozog May 13, 2019
81884da
Implement shmemx_team_split_2D and add a unit test
davidozog May 14, 2019
23226ca
Cleanup team split code, remove post-split barrier
davidozog May 14, 2019
8e4f844
Add shmemx_sync/shmemx_team_sync with unit test
davidozog May 14, 2019
41feee7
Implement shmemx_broadcast with teams support
davidozog May 15, 2019
e587b63
Add teams collect, fcollect, alltoall, alltoalls
davidozog May 16, 2019
3332081
Add bindings for collectives, fix c11 shmemx tests
davidozog May 16, 2019
b01b801
Cleanup the shmemx tests, don't exit(0) on failure
davidozog May 16, 2019
18becf8
Point contexts to the appropriate team, add test
davidozog May 23, 2019
b7fd4fa
Add team PE indexing for ctx RMA/AMO operations
davidozog May 30, 2019
1ef41d7
Add C++/C11 teams API bindings and set psync bits
davidozog Jun 10, 2019
4c8fa5c
Rename some vars and fix destroy & op_to_all bugs
davidozog Jun 25, 2019
8c73f23
Add team field to portals and none transport ctxs
davidozog Jun 25, 2019
1598f51
Support reduce_local unsigned types, fix example
davidozog Jun 25, 2019
4a1391c
Use separate psync in non-barrier/sync collectives
davidozog Jun 26, 2019
568324b
Add preliminary support for SHMEMX_TEAM_SHARED
davidozog Jun 28, 2019
00bac21
Rewrite TEAM_SHARED stride check without a malloc
davidozog Jul 9, 2019
2665b71
Fix pWrk mistake, rename a variable in team init
davidozog Jul 9, 2019
63cfde3
Simplify search for local peer PEs in TEAM_SHARED
davidozog Jul 15, 2019
de5ba2c
Merge branch 'master' of github.com:davidozog/sandia-shmem into wip/t…
davidozog Aug 20, 2019
a4f0217
Cleaning pre-defined teams initialization
davidozog Aug 20, 2019
41109d2
Cleanup teams c11/cxx bindings and SHMEMX_* fixes
davidozog Sep 6, 2019
c71e028
Rename SHMEM_TEAM_NULL to SHMEM_TEAM_INVALID
davidozog Sep 6, 2019
e9d8043
Miscellaneous bug fixes & cleanup throughout teams
davidozog Sep 6, 2019
16cf053
Associate transport context array with team object
davidozog Sep 13, 2019
90d96f2
Destroy all teams during finalize
davidozog Sep 16, 2019
eca2f5c
team pool split update, add ctx opt w/no transport
davidozog Sep 17, 2019
33fc9fe
Merge branch 'master' of github.com:Sandia-OpenSHMEM/SOS into wip/teams
davidozog Sep 20, 2019
ff30922
Copyright cleanup in teams files
davidozog Sep 20, 2019
e26f0e9
Cleanup team shmemx tests, remove pWrk from reduce
davidozog Sep 20, 2019
f9a94e7
Remove HOST and LEADERS teams & cleanup teams init
davidozog Oct 8, 2019
48b0290
Rearrange shmem_team_t & raise error w/bad bit-set
davidozog Oct 8, 2019
e74ea03
Add 2 psyncs per team for back-to-back collectives
davidozog Oct 11, 2019
8cf7156
Generalize choose/release psync in team collective
davidozog Oct 14, 2019
b6cf4e2
Merge branch 'master' of github.com:Sandia-OpenSHMEM/SOS into wip/teams
davidozog Oct 14, 2019
1a7c7e7
Add back-to-back team-collectives shmemx tests
davidozog Oct 14, 2019
db70857
Fix function signature for shmem_team_destroy
davidozog Oct 16, 2019
bd7c010
Fix checks for valid team triplet & choosing psync
davidozog Oct 18, 2019
281739a
Add teams tests: reuse teams and shrink active set
davidozog Oct 18, 2019
f5c6cf1
Add C11 test to check teams-based collective types
davidozog Oct 21, 2019
cab66b6
Check collective team is valid, not the active set
davidozog Oct 21, 2019
674e8b7
Add teams reduction type coverage test & bug fixes
davidozog Oct 25, 2019
117e69a
Clean/clarify some teams tests
davidozog Oct 25, 2019
2fe2b61
Fix bug when more than MAX_TEAMS created
davidozog Oct 28, 2019
cd884dc
Remove C11 "extras" from team reduction bindings
davidozog Oct 28, 2019
4fa6681
Fully remove C11 extras from reduction bindings
davidozog Oct 29, 2019
743da92
Fix team bug w/ indexing sync/barrier psync region
davidozog Oct 30, 2019
f496282
Revert a portion of the previous commit (d83a7e6)
davidozog Oct 31, 2019
280fdd4
Return nonzero if max teams reached, update README
davidozog Oct 31, 2019
7d66d55
Fix team assignment/comparison bug, clean warnings
davidozog Nov 1, 2019
791d568
Remove "extra" C++ bindings in teams reductions
davidozog Nov 5, 2019
f6bdaa4
Merge branch 'master' of github.com:Sandia-OpenSHMEM/SOS into wip/teams
davidozog Nov 5, 2019
e8076c2
Cleanup teams docs, comments, and unit tests
davidozog Nov 7, 2019
d920b63
Cleanup teams bindings and fix unit test warnings
davidozog Nov 8, 2019
3ea2e5b
Rename TEAM_ONLY_SELF, fix type warns, unused vars
davidozog Nov 8, 2019
5853583
Missed an instance of 'const' team config types
davidozog Nov 8, 2019
a2f8c63
Review #2 - simpler fixes to push through testing
davidozog Nov 11, 2019
7a1518a
Make psync-availabile array 8 uchars, not a uint64
davidozog Nov 12, 2019
23be78e
Change pe_in_active_set to return -1 or PE index
davidozog Nov 12, 2019
2b0ec16
Add --enable-max-teams=NUMBER option to configury
davidozog Nov 12, 2019
f265b40
Revert change to setting max_teams in shmem_team.c
davidozog Nov 12, 2019
b86b413
Minor changes from teams review #3 for testing
davidozog Nov 14, 2019
1ba3da4
Fix type incongruence in shmemx_reduce test
Nov 15, 2019
61e8b44
Cleanup and remove unneeded dup in reuse_teams test
Nov 15, 2019
4c84ced
Fix numerous bugs in team_sync unit test
Nov 15, 2019
88f46fe
Remove extra team dup in collect active set test
Nov 15, 2019
fce3cb2
Mark internal function static
Nov 15, 2019
be9f86a
Update C11 test macro to eat the semicolon
Nov 15, 2019
f8b9ff6
Update choose_psync to return long*
Nov 15, 2019
aa8bd2f
Move accessors up to user bindings
Nov 15, 2019
87a44ea
Update to make unit test work with c99 compilers
Nov 15, 2019
9e2e095
Fix choose_psync comment
Nov 15, 2019
a296326
Merge pull request #7 from jdinan/wip/teams
davidozog Nov 15, 2019
314daa8
Use persistent assertion in team init
Nov 16, 2019
39c3694
Remove dead code from team init
Nov 16, 2019
1cc7b7e
Set team world on the default context
Nov 16, 2019
db112f5
Improve error message
Nov 16, 2019
daff427
Various teams review, round #4.
davidozog Nov 16, 2019
9044877
Merge pull request #8 from jdinan/wip/teams
davidozog Nov 16, 2019
595d1f0
Merge branch 'wip/teams' of github.com:davidozog/sandia-shmem into wi…
davidozog Nov 16, 2019
57d414b
Destroy the predefined teams in shmem_team_fini
davidozog Nov 16, 2019
7c57f6f
Destroy predefined teams outside portals as well
davidozog Nov 16, 2019
d40b74b
Remove redundant PE id from error message
Nov 18, 2019
1d2da2b
Improve error handling for SHMEM_TEAMS_MAX
Nov 18, 2019
b4e26ca
Only set bits corresponding to allocated psyncs
Nov 18, 2019
3b85c1a
Add psync avail bit string debugging output
Nov 18, 2019
24ca0a0
Add comment about SHMEM_CTX_DEFAULT destroy
Nov 18, 2019
90886c8
Remove sketchy spec tests
Nov 18, 2019
c76260f
Set my_pe field on new teams
Nov 18, 2019
0310b31
Fix bugs in spec tests
Nov 18, 2019
5294eb0
Update reductions to support size_t nreduce
Nov 18, 2019
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
9 changes: 9 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,15 @@ options.
compute node is determined by its unique hostname, and the number of
STXs available on a compute node is provided by the libfabric library.

Team Environment variables:

SHMEM_TEAMS_MAX (default: 10)
Sets the maximum number of available teams per PE, including the
predefined teams. The maximum supported value is 64.
davidozog marked this conversation as resolved.
Show resolved Hide resolved

SHMEM_TEAM_SHARED_ONLY_SELF (default: off)
If defined, the predefined team, SHMEM_TEAM_SHARED, will only include
the self PE.

Debugging Environment variables:

Expand Down
39 changes: 39 additions & 0 deletions bindings/shmem_bind_c.m4
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,45 @@ $1(int, int, `SHM_INTERNAL_INT', `$2', `$3')
$1(long, long, `SHM_INTERNAL_LONG', `$2', `$3')
$1(longlong, long long, `SHM_INTERNAL_LONG_LONG', `$2', `$3')')dnl
dnl
define(`SHMEM_BIND_C_COLL_AND_OR_XOR', dnl args: macro_name, op_name, op_const
`$1(uchar, unsigned char, `SHM_INTERNAL_UCHAR', `$2', `$3')
$1(short, short, `SHM_INTERNAL_SHORT', `$2', `$3')
$1(ushort, unsigned short, `SHM_INTERNAL_USHORT', `$2', `$3')
$1(int, int, `SHM_INTERNAL_INT', `$2', `$3')
$1(uint, unsigned int, `SHM_INTERNAL_UINT', `$2', `$3')
$1(long, long, `SHM_INTERNAL_LONG', `$2', `$3')
$1(ulong, unsigned long, `SHM_INTERNAL_ULONG', `$2', `$3')
$1(longlong, long long, `SHM_INTERNAL_LONG_LONG', `$2', `$3')
$1(ulonglong, unsigned long long, `SHM_INTERNAL_ULONG_LONG', `$2', `$3')')dnl
dnl
define(`SHMEM_BIND_C_COLL_MIN_MAX', dnl args: macro_name, op_name, op_const
`$1(short, short, `SHM_INTERNAL_SHORT', `$2', `$3')
$1(ushort, unsigned short, `SHM_INTERNAL_USHORT', `$2', `$3')
$1(int, int, `SHM_INTERNAL_INT', `$2', `$3')
$1(uint, unsigned int, `SHM_INTERNAL_UINT', `$2', `$3')
$1(long, long, `SHM_INTERNAL_LONG', `$2', `$3')
$1(ulong, unsigned long, `SHM_INTERNAL_ULONG', `$2', `$3')
$1(longlong, long long, `SHM_INTERNAL_LONG_LONG', `$2', `$3')
$1(ulonglong, unsigned long long, `SHM_INTERNAL_ULONG_LONG', `$2', `$3')
$1(float, float, `SHM_INTERNAL_FLOAT', `$2', `$3')
$1(double, double, `SHM_INTERNAL_DOUBLE', `$2', `$3')
$1(longdouble, long double, `SHM_INTERNAL_LONG_DOUBLE', `$2', `$3')')dnl
dnl
define(`SHMEM_BIND_C_COLL_SUM_PROD', dnl args: macro_name, op_name, op_const
`$1(short, short, `SHM_INTERNAL_SHORT', `$2', `$3')
$1(ushort, unsigned short, `SHM_INTERNAL_USHORT', `$2', `$3')
$1(int, int, `SHM_INTERNAL_INT', `$2', `$3')
$1(uint, unsigned int, `SHM_INTERNAL_UINT', `$2', `$3')
$1(long, long, `SHM_INTERNAL_LONG', `$2', `$3')
$1(ulong, unsigned long, `SHM_INTERNAL_ULONG', `$2', `$3')
$1(longlong, long long, `SHM_INTERNAL_LONG_LONG', `$2', `$3')
$1(ulonglong, unsigned long long, `SHM_INTERNAL_ULONG_LONG', `$2', `$3')
$1(float, float, `SHM_INTERNAL_FLOAT', `$2', `$3')
$1(double, double, `SHM_INTERNAL_DOUBLE', `$2', `$3')
$1(longdouble, long double, `SHM_INTERNAL_LONG_DOUBLE', `$2', `$3')
$1(complexd, double _Complex, `SHM_INTERNAL_DOUBLE_COMPLEX', `$2', `$3')
$1(complexf, float _Complex, `SHM_INTERNAL_FLOAT_COMPLEX', `$2', `$3')')dnl
dnl
define(`SHMEM_BIND_C_COLL_FLOATS', dnl args: macro_name, op_name, op_const
`$1(float, float, `SHM_INTERNAL_FLOAT', `$2', `$3')
$1(double, double, `SHM_INTERNAL_DOUBLE', `$2', `$3')
Expand Down
40 changes: 40 additions & 0 deletions bindings/shmem_bind_c11.m4
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,43 @@ $1(ushort, unsigned short)$2
$1(uint, unsigned int)$2
$1(ulong, unsigned long)$2
$1(ulonglong, unsigned long long)')dnl
dnl
define(`SHMEM_BIND_C11_COLL_AND_OR_XOR', dnl args: macro_name, op_name, op_const
`$1(uchar, unsigned char, `SHM_INTERNAL_UCHAR')$2
davidozog marked this conversation as resolved.
Show resolved Hide resolved
$1(short, short, `SHM_INTERNAL_SHORT')$2
$1(ushort, unsigned short, `SHM_INTERNAL_USHORT')$2
$1(int, int, `SHM_INTERNAL_INT')$2
$1(uint, unsigned int, `SHM_INTERNAL_UINT')$2
$1(long, long, `SHM_INTERNAL_LONG')$2
$1(ulong, unsigned long, `SHM_INTERNAL_ULONG')$2
$1(longlong, long long, `SHM_INTERNAL_LONG_LONG')$2
$1(ulonglong, unsigned long long, `SHM_INTERNAL_ULONG_LONG')')dnl
dnl
define(`SHMEM_BIND_C11_COLL_MIN_MAX', dnl args: macro_name, op_name, op_const
`$1(short, short, `SHM_INTERNAL_SHORT')$2
$1(ushort, unsigned short, `SHM_INTERNAL_USHORT')$2
$1(int, int, `SHM_INTERNAL_INT')$2
$1(uint, unsigned int, `SHM_INTERNAL_UINT')$2
$1(long, long, `SHM_INTERNAL_LONG')$2
$1(ulong, unsigned long, `SHM_INTERNAL_ULONG')$2
$1(longlong, long long, `SHM_INTERNAL_LONG_LONG')$2
$1(ulonglong, unsigned long long, `SHM_INTERNAL_ULONG_LONG')$2
$1(float, float, `SHM_INTERNAL_FLOAT')$2
$1(double, double, `SHM_INTERNAL_DOUBLE')$2
$1(longdouble, long double, `SHM_INTERNAL_LONG_DOUBLE')')dnl
dnl
define(`SHMEM_BIND_C11_COLL_SUM_PROD', dnl args: macro_name, op_name, op_const
`$1(short, short, `SHM_INTERNAL_SHORT')$2
$1(ushort, unsigned short, `SHM_INTERNAL_USHORT')$2
$1(int, int, `SHM_INTERNAL_INT')$2
$1(uint, unsigned int, `SHM_INTERNAL_UINT')$2
$1(long, long, `SHM_INTERNAL_LONG')$2
$1(ulong, unsigned long, `SHM_INTERNAL_ULONG')$2
$1(longlong, long long, `SHM_INTERNAL_LONG_LONG')$2
$1(ulonglong, unsigned long long, `SHM_INTERNAL_ULONG_LONG')$2
$1(float, float, `SHM_INTERNAL_FLOAT')$2
$1(double, double, `SHM_INTERNAL_DOUBLE')$2
$1(longdouble, long double, `SHM_INTERNAL_LONG_DOUBLE')$2
$1(complexd, double _Complex, `SHM_INTERNAL_DOUBLE_COMPLEX')$2
$1(complexf, float _Complex, `SHM_INTERNAL_FLOAT_COMPLEX')')dnl
dnl
44 changes: 43 additions & 1 deletion bindings/shmem_bind_cxx.m4
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ $1(uint, unsigned int, `SHM_INTERNAL_UINT')$2
$1(ulong, unsigned long, `SHM_INTERNAL_ULONG')$2
$1(ulonglong, unsigned long long, `SHM_INTERNAL_ULONG_LONG')')dnl
dnl
define(`SHMEM_BIND_CXX_SYNC', dnl args: macro_name
define(`SHMEM_BIND_CXX_SYNC', dnl args: macro_name, end
SHMEM_BIND_CXX_SYNC_EXTRAS($1,$2)dnl
`$1(short, short)$2
$1(int, int)$2
Expand All @@ -66,8 +66,50 @@ $1(uint, unsigned int)$2
$1(ulong, unsigned long)$2
$1(ulonglong, unsigned long long)')dnl
dnl
define(`SHMEM_BIND_CXX_COLL_AND_OR_XOR', dnl args: macro_name, end
`$1(uchar, unsigned char, `SHM_INTERNAL_UCHAR')$2
$1(short, short, `SHM_INTERNAL_SHORT')$2
$1(ushort, unsigned short, `SHM_INTERNAL_USHORT')$2
$1(int, int, `SHM_INTERNAL_INT')$2
$1(uint, unsigned int, `SHM_INTERNAL_UINT')$2
$1(long, long, `SHM_INTERNAL_LONG')$2
$1(ulong, unsigned long, `SHM_INTERNAL_ULONG')$2
$1(longlong, long long, `SHM_INTERNAL_LONG_LONG')$2
$1(ulonglong, unsigned long long, `SHM_INTERNAL_ULONG_LONG')')dnl
dnl
define(`SHMEM_BIND_CXX_COLL_MIN_MAX', dnl args: macro_name, op_name, op_const
`$1(short, short, `SHM_INTERNAL_SHORT')$2
$1(ushort, unsigned short, `SHM_INTERNAL_USHORT')$2
$1(int, int, `SHM_INTERNAL_INT')$2
$1(uint, unsigned int, `SHM_INTERNAL_UINT')$2
$1(long, long, `SHM_INTERNAL_LONG')$2
$1(ulong, unsigned long, `SHM_INTERNAL_ULONG')$2
$1(longlong, long long, `SHM_INTERNAL_LONG_LONG')$2
$1(ulonglong, unsigned long long, `SHM_INTERNAL_ULONG_LONG')$2
$1(float, float, `SHM_INTERNAL_FLOAT')$2
$1(double, double, `SHM_INTERNAL_DOUBLE')$2
$1(longdouble, long double, `SHM_INTERNAL_LONG_DOUBLE')')dnl
dnl
define(`SHMEM_BIND_CXX_COLL_SUM_PROD', dnl args: macro_name, op_name, op_const
`$1(short, short, `SHM_INTERNAL_SHORT')$2
$1(ushort, unsigned short, `SHM_INTERNAL_USHORT')$2
$1(int, int, `SHM_INTERNAL_INT')$2
$1(uint, unsigned int, `SHM_INTERNAL_UINT')$2
$1(long, long, `SHM_INTERNAL_LONG')$2
$1(ulong, unsigned long, `SHM_INTERNAL_ULONG')$2
$1(longlong, long long, `SHM_INTERNAL_LONG_LONG')$2
$1(ulonglong, unsigned long long, `SHM_INTERNAL_ULONG_LONG')$2
$1(float, float, `SHM_INTERNAL_FLOAT')$2
$1(double, double, `SHM_INTERNAL_DOUBLE')$2
$1(longdouble, long double, `SHM_INTERNAL_LONG_DOUBLE')$2
$1(complexd, double _Complex, `SHM_INTERNAL_DOUBLE_COMPLEX')$2
$1(complexf, float _Complex, `SHM_INTERNAL_FLOAT_COMPLEX')')dnl
dnl
define(`SHMEM_CXX_DEFINE_FOR_RMA', `SHMEM_BIND_CXX_RMA(`$1')')dnl
define(`SHMEM_CXX_DEFINE_FOR_AMO', `SHMEM_BIND_CXX_AMO(`$1')')dnl
define(`SHMEM_CXX_DEFINE_FOR_EXTENDED_AMO', `SHMEM_BIND_CXX_EXTENDED_AMO(`$1')')dnl
define(`SHMEM_CXX_DEFINE_FOR_BITWISE_AMO', `SHMEM_BIND_CXX_BITWISE_AMO(`$1')')dnl
define(`SHMEM_CXX_DEFINE_FOR_SYNC', `SHMEM_BIND_CXX_SYNC(`$1')')dnl
define(`SHMEM_CXX_DEFINE_FOR_COLL_AND_OR_XOR', `SHMEM_BIND_CXX_COLL_AND_OR_XOR(`$1')')dnl
define(`SHMEM_CXX_DEFINE_FOR_COLL_MIN_MAX', `SHMEM_BIND_CXX_COLL_MIN_MAX(`$1')')dnl
define(`SHMEM_CXX_DEFINE_FOR_COLL_SUM_PROD', `SHMEM_BIND_CXX_COLL_SUM_PROD(`$1')')dnl
davidozog marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,8 @@ SHMEM_FIND_INT_TYPE([long], [$transport])
SHMEM_FIND_INT_TYPE([long long], [$transport])
SHMEM_FIND_INT_TYPE([ptrdiff_t], [$transport])

SHMEM_FIND_UINT_TYPE([unsigned char], [$transport])
SHMEM_FIND_UINT_TYPE([unsigned short], [$transport])
SHMEM_FIND_UINT_TYPE([unsigned int], [$transport])
SHMEM_FIND_UINT_TYPE([unsigned long], [$transport])
SHMEM_FIND_UINT_TYPE([unsigned long long], [$transport])
Expand Down
21 changes: 21 additions & 0 deletions mpp/shmemx-def.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,29 @@ typedef struct {
uint64_t target;
} shmemx_pcntr_t;

/* Teams */
typedef struct shmem_impl_team_t {
int dummy;
} * shmemx_team_t;

typedef struct {
int num_contexts;
} shmemx_team_config_t;

#if SHMEM_HAVE_ATTRIBUTE_VISIBILITY == 1
__attribute__((visibility("default"))) extern shmemx_team_t SHMEMX_TEAM_WORLD;
__attribute__((visibility("default"))) extern shmemx_team_t SHMEMX_TEAM_SHARED;
#else
extern shmemx_team_t SHMEMX_TEAM_WORLD;
extern shmemx_team_t SHMEMX_TEAM_SHARED;
#endif

#define SHMEMX_TEAM_INVALID NULL

#define SHMEMX_CTX_INVALID NULL

#define SHMEMX_TEAM_NUM_CONTEXTS (1l<<0)

#ifdef __cplusplus
}
#endif
Expand Down
144 changes: 144 additions & 0 deletions mpp/shmemx.h4
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,77 @@ static inline void shmemx_put_signal_nbi(shmem_ctx_t ctx, $2* dest, const $2* so
}')dnl
SHMEM_CXX_DEFINE_FOR_RMA(`SHMEM_CXX_PUT_SIGNAL_NBI')

/* Team Collective Routines */
define(`SHMEM_CXX_BCAST',
`static inline int shmemx_broadcast(shmemx_team_t team, $2* dest, const $2* source,
size_t nelems, int PE_root) {
return shmemx_$1_broadcast(team, dest, source, nelems, PE_root);
}')dnl
SHMEM_CXX_DEFINE_FOR_RMA(`SHMEM_CXX_BCAST')

define(`SHMEM_CXX_COLLECT',
`static inline int shmemx_collect(shmemx_team_t team, $2* dest, const $2* source,
size_t nelems) {
return shmemx_$1_collect(team, dest, source, nelems);
}')dnl
SHMEM_CXX_DEFINE_FOR_RMA(`SHMEM_CXX_COLLECT')

define(`SHMEM_CXX_FCOLLECT',
`static inline int shmemx_fcollect(shmemx_team_t team, $2* dest, const $2* source,
size_t nelems) {
return shmemx_$1_fcollect(team, dest, source, nelems);
}')dnl
SHMEM_CXX_DEFINE_FOR_RMA(`SHMEM_CXX_FCOLLECT')

define(`SHMEM_CXX_AND_REDUCE',
`static inline int shmemx_and_reduce(shmemx_team_t team, $2* dest, const $2* source,
size_t nreduce) {
return shmemx_$1_and_reduce(team, dest, source, nreduce);
}')dnl
SHMEM_CXX_DEFINE_FOR_COLL_AND_OR_XOR(`SHMEM_CXX_AND_REDUCE')

define(`SHMEM_CXX_MIN_REDUCE',
`static inline int shmemx_min_reduce(shmemx_team_t team, $2* dest, const $2* source,
size_t nreduce) {
return shmemx_$1_min_reduce(team, dest, source, nreduce);
}')dnl
SHMEM_CXX_DEFINE_FOR_COLL_MIN_MAX(`SHMEM_CXX_MIN_REDUCE')

define(`SHMEM_CXX_MAX_REDUCE',
`static inline int shmemx_max_reduce(shmemx_team_t team, $2* dest, const $2* source,
size_t nreduce) {
return shmemx_$1_max_reduce(team, dest, source, nreduce);
}')dnl
SHMEM_CXX_DEFINE_FOR_COLL_MIN_MAX(`SHMEM_CXX_MAX_REDUCE')

define(`SHMEM_CXX_SUM_REDUCE',
`static inline int shmemx_sum_reduce(shmemx_team_t team, $2* dest, const $2* source,
size_t nreduce) {
return shmemx_$1_sum_reduce(team, dest, source, nreduce);
}')dnl
SHMEM_CXX_DEFINE_FOR_COLL_SUM_PROD(`SHMEM_CXX_SUM_REDUCE')

define(`SHMEM_CXX_PROD_REDUCE',
`static inline int shmemx_prod_reduce(shmemx_team_t team, $2* dest, const $2* source,
size_t nreduce) {
return shmemx_$1_prod_reduce(team, dest, source, nreduce);
}')dnl
SHMEM_CXX_DEFINE_FOR_COLL_SUM_PROD(`SHMEM_CXX_PROD_REDUCE')

define(`SHMEM_CXX_ALLTOALL',
`static inline int shmemx_alltoall(shmemx_team_t team, $2* dest, const $2* source,
size_t nelems) {
return shmemx_$1_alltoall(team, dest, source, nelems);
}')dnl
SHMEM_CXX_DEFINE_FOR_RMA(`SHMEM_CXX_ALLTOALL')

define(`SHMEM_CXX_ALLTOALLS',
`static inline int shmemx_alltoalls(shmemx_team_t team, $2* dest, const $2* source,
ptrdiff_t dst, ptrdiff_t sst, size_t nelems) {
return shmemx_$1_alltoalls(team, dest, source, dst, sst, nelems);
}')dnl
SHMEM_CXX_DEFINE_FOR_RMA(`SHMEM_CXX_ALLTOALLS')

/* C11 Generic Macros */
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(SHMEM_INTERNAL_INCLUDE))

Expand Down Expand Up @@ -348,6 +419,79 @@ SHMEM_BIND_C11_RMA(`SHMEM_CTX_C11_GEN_PUT_SIGNAL_NBI', `, \') \
SHMEM_BIND_C11_RMA(`SHMEM_C11_GEN_PUT_SIGNAL_NBI', `, \') \
)(__VA_ARGS__)

/* Team Collective Routines */
define(`SHMEM_C11_GEN_BCAST', ` $2*: shmemx_$1_broadcast')dnl
#define shmemx_broadcast(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG1(__VA_ARGS__)), \
SHMEM_BIND_C11_RMA(`SHMEM_C11_GEN_BCAST', `, \') \
)(__VA_ARGS__)

define(`SHMEM_C11_GEN_COLLECT', ` $2*: shmemx_$1_collect')dnl
#define shmemx_collect(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG1(__VA_ARGS__)), \
SHMEM_BIND_C11_RMA(`SHMEM_C11_GEN_COLLECT', `, \') \
)(__VA_ARGS__)

define(`SHMEM_C11_GEN_FCOLLECT', ` $2*: shmemx_$1_fcollect')dnl
#define shmemx_fcollect(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG1(__VA_ARGS__)), \
SHMEM_BIND_C11_RMA(`SHMEM_C11_GEN_FCOLLECT', `, \') \
)(__VA_ARGS__)

define(`SHMEM_C11_GEN_AND_REDUCE', ` $2*: shmemx_$1_and_reduce')dnl
#define shmemx_and_reduce(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG1(__VA_ARGS__)), \
SHMEM_BIND_C11_COLL_AND_OR_XOR(`SHMEM_C11_GEN_AND_REDUCE', `, \') \
)(__VA_ARGS__)

define(`SHMEM_C11_GEN_OR_REDUCE', ` $2*: shmemx_$1_or_reduce')dnl
#define shmemx_or_reduce(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG1(__VA_ARGS__)), \
SHMEM_BIND_C11_COLL_AND_OR_XOR(`SHMEM_C11_GEN_OR_REDUCE', `, \') \
)(__VA_ARGS__)

define(`SHMEM_C11_GEN_XOR_REDUCE', ` $2*: shmemx_$1_xor_reduce')dnl
#define shmemx_xor_reduce(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG1(__VA_ARGS__)), \
SHMEM_BIND_C11_COLL_AND_OR_XOR(`SHMEM_C11_GEN_XOR_REDUCE', `, \') \
)(__VA_ARGS__)

define(`SHMEM_C11_GEN_MIN_REDUCE', ` $2*: shmemx_$1_min_reduce')dnl
#define shmemx_min_reduce(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG1(__VA_ARGS__)), \
SHMEM_BIND_C11_COLL_MIN_MAX(`SHMEM_C11_GEN_MIN_REDUCE', `, \') \
)(__VA_ARGS__)

define(`SHMEM_C11_GEN_MAX_REDUCE', ` $2*: shmemx_$1_max_reduce')dnl
#define shmemx_max_reduce(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG1(__VA_ARGS__)), \
SHMEM_BIND_C11_COLL_MIN_MAX(`SHMEM_C11_GEN_MAX_REDUCE', `, \') \
)(__VA_ARGS__)

define(`SHMEM_C11_GEN_SUM_REDUCE', ` $2*: shmemx_$1_sum_reduce')dnl
#define shmemx_sum_reduce(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG1(__VA_ARGS__)), \
SHMEM_BIND_C11_COLL_SUM_PROD(`SHMEM_C11_GEN_SUM_REDUCE', `, \') \
)(__VA_ARGS__)

define(`SHMEM_C11_GEN_PROD_REDUCE', ` $2*: shmemx_$1_prod_reduce')dnl
#define shmemx_prod_reduce(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG1(__VA_ARGS__)), \
SHMEM_BIND_C11_COLL_SUM_PROD(`SHMEM_C11_GEN_PROD_REDUCE', `, \') \
)(__VA_ARGS__)

define(`SHMEM_C11_GEN_ALLTOALL', ` $2*: shmemx_$1_alltoall')dnl
#define shmemx_alltoall(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG1(__VA_ARGS__)), \
SHMEM_BIND_C11_RMA(`SHMEM_C11_GEN_ALLTOALL', `, \') \
)(__VA_ARGS__)

define(`SHMEM_C11_GEN_ALLTOALLS', ` $2*: shmemx_$1_alltoalls')dnl
#define shmemx_alltoalls(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG1(__VA_ARGS__)), \
SHMEM_BIND_C11_RMA(`SHMEM_C11_GEN_ALLTOALLS', `, \') \
)(__VA_ARGS__)

#endif /* C11 */

#endif /* SHMEMX_H */
Loading