Skip to content

Commit

Permalink
teams: name SHMEMX_TEAM_HOSTS to SHMEMX_TEAM_NODE
Browse files Browse the repository at this point in the history
Signed-off-by: David Ozog <[email protected]>
  • Loading branch information
davidozog committed Oct 3, 2023
1 parent 9f010f1 commit 8cafd85
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions mpp/shmemx-def.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ typedef struct {
} shmemx_pcntr_t;

#if SHMEM_HAVE_ATTRIBUTE_VISIBILITY == 1
__attribute__((visibility("default"))) extern shmem_team_t SHMEMX_TEAM_HOST;
__attribute__((visibility("default"))) extern shmem_team_t SHMEMX_TEAM_NODE;
#else
extern shmem_team_t SHMEMX_TEAM_HOST;
extern shmem_team_t SHMEMX_TEAM_NODE;
#endif

#ifdef __cplusplus
Expand Down
46 changes: 23 additions & 23 deletions src/shmem_team.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#define SHMEM_TEAM_WORLD_INDEX 0
#define SHMEM_TEAM_SHARED_INDEX 1
#define SHMEM_TEAM_HOST_INDEX 2
#define SHMEM_TEAM_NODE_INDEX 2
#define SHMEM_TEAMS_MIN 3

#define N_PSYNC_BYTES 8
Expand All @@ -33,8 +33,8 @@ shmem_team_t SHMEM_TEAM_WORLD = (shmem_team_t) &shmem_internal_team_world;
shmem_internal_team_t shmem_internal_team_shared;
shmem_team_t SHMEM_TEAM_SHARED = (shmem_team_t) &shmem_internal_team_shared;

shmem_internal_team_t shmem_internal_team_host;
shmem_team_t SHMEMX_TEAM_HOST = (shmem_team_t) &shmem_internal_team_host;
shmem_internal_team_t shmem_internal_team_node;
shmem_team_t SHMEMX_TEAM_NODE = (shmem_team_t) &shmem_internal_team_node;

shmem_internal_team_t **shmem_internal_team_pool;
long *shmem_internal_psync_pool;
Expand Down Expand Up @@ -97,15 +97,15 @@ int shmem_internal_team_init(void)
shmem_internal_team_shared.psync_avail[i] = 1;
SHMEM_TEAM_SHARED = (shmem_team_t) &shmem_internal_team_shared;

/* Initialize SHMEM_TEAM_HOST */
shmem_internal_team_host.psync_idx = SHMEM_TEAM_HOST_INDEX;
shmem_internal_team_host.my_pe = 0;
shmem_internal_team_host.config_mask = 0;
shmem_internal_team_host.contexts_len = 0;
memset(&shmem_internal_team_host.config, 0, sizeof(shmem_team_config_t));
/* Initialize SHMEM_TEAM_NODE */
shmem_internal_team_node.psync_idx = SHMEM_TEAM_NODE_INDEX;
shmem_internal_team_node.my_pe = 0;
shmem_internal_team_node.config_mask = 0;
shmem_internal_team_node.contexts_len = 0;
memset(&shmem_internal_team_node.config, 0, sizeof(shmem_team_config_t));
for (size_t i = 0; i < N_PSYNCS_PER_TEAM; i++)
shmem_internal_team_host.psync_avail[i] = 1;
SHMEMX_TEAM_HOST = (shmem_team_t) &shmem_internal_team_host;
shmem_internal_team_node.psync_avail[i] = 1;
SHMEMX_TEAM_NODE = (shmem_team_t) &shmem_internal_team_node;

if (shmem_internal_params.TEAM_SHARED_ONLY_SELF) {
shmem_internal_team_shared.start = shmem_internal_my_pe;
Expand Down Expand Up @@ -157,16 +157,16 @@ int shmem_internal_team_init(void)
}
shmem_internal_assert(size > 0 && size == shmem_runtime_get_node_size());

shmem_internal_team_host.start = start;
shmem_internal_team_host.stride = (stride == -1) ? 1 : stride;
shmem_internal_team_host.size = size;
shmem_internal_team_host.my_pe =
shmem_internal_team_node.start = start;
shmem_internal_team_node.stride = (stride == -1) ? 1 : stride;
shmem_internal_team_node.size = size;
shmem_internal_team_node.my_pe =
shmem_internal_team_translate_pe(&shmem_internal_team_world, shmem_internal_my_pe,
&shmem_internal_team_host);
&shmem_internal_team_node);

DEBUG_MSG("SHMEMX_TEAM_HOST: start=%d, stride=%d, size=%d\n",
shmem_internal_team_host.start, shmem_internal_team_host.stride,
shmem_internal_team_host.size);
DEBUG_MSG("SHMEMX_TEAM_NODE: start=%d, stride=%d, size=%d\n",
shmem_internal_team_node.start, shmem_internal_team_node.stride,
shmem_internal_team_node.size);

if (shmem_internal_params.TEAMS_MAX > N_PSYNC_BYTES * CHAR_BIT) {
RETURN_ERROR_MSG("Requested %ld teams, but only %d are supported\n",
Expand All @@ -185,7 +185,7 @@ int shmem_internal_team_init(void)
}
shmem_internal_team_pool[SHMEM_TEAM_WORLD_INDEX] = &shmem_internal_team_world;
shmem_internal_team_pool[SHMEM_TEAM_SHARED_INDEX] = &shmem_internal_team_shared;
shmem_internal_team_pool[SHMEM_TEAM_HOST_INDEX] = &shmem_internal_team_host;
shmem_internal_team_pool[SHMEM_TEAM_NODE_INDEX] = &shmem_internal_team_node;

/* Allocate pSync pool, each with the maximum possible size requirement */
/* Create two pSyncs per team for back-to-back collectives and one for barriers.
Expand Down Expand Up @@ -217,10 +217,10 @@ int shmem_internal_team_init(void)
shmem_internal_bit_set(psync_pool_avail, N_PSYNC_BYTES, i);
}

/* Set the bits for SHMEM_TEAM_WORLD, SHMEM_TEAM_SHARED, and SHMEMX_TEAM_HOST to 0: */
/* Set the bits for SHMEM_TEAM_WORLD, SHMEM_TEAM_SHARED, and SHMEMX_TEAM_NODE to 0: */
shmem_internal_bit_clear(psync_pool_avail, N_PSYNC_BYTES, SHMEM_TEAM_WORLD_INDEX);
shmem_internal_bit_clear(psync_pool_avail, N_PSYNC_BYTES, SHMEM_TEAM_SHARED_INDEX);
shmem_internal_bit_clear(psync_pool_avail, N_PSYNC_BYTES, SHMEM_TEAM_HOST_INDEX);
shmem_internal_bit_clear(psync_pool_avail, N_PSYNC_BYTES, SHMEM_TEAM_NODE_INDEX);

/* Initialize an integer used to agree on an equal return value across PEs in team creation: */
team_ret_val = shmem_internal_shmalloc(sizeof(int) * 2);
Expand Down Expand Up @@ -504,7 +504,7 @@ int shmem_internal_team_destroy(shmem_internal_team_t *team)
free(team->contexts);

if (team != &shmem_internal_team_world && team != &shmem_internal_team_shared &&
team != &shmem_internal_team_host) {
team != &shmem_internal_team_node) {
free(team);
}

Expand Down
2 changes: 1 addition & 1 deletion src/shmem_team.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ typedef struct shmem_internal_team_t shmem_internal_team_t;

extern shmem_internal_team_t shmem_internal_team_world;
extern shmem_internal_team_t shmem_internal_team_shared;
extern shmem_internal_team_t shmem_internal_team_host;
extern shmem_internal_team_t shmem_internal_team_node;

enum shmem_internal_team_op_t {
SYNC = 0,
Expand Down
2 changes: 1 addition & 1 deletion test/shmemx/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ endif
if SHMEMX_TESTS
check_PROGRAMS += \
perf_counter \
shmemx_team_host \
shmemx_team_node \
shmem_malloc_with_hints

if HAVE_PTHREADS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ int main(void)
int me = shmem_my_pe();
int npes = shmem_n_pes();

int team_shared_npes = shmem_team_n_pes(SHMEMX_TEAM_HOST);
int team_shared_npes = shmem_team_n_pes(SHMEMX_TEAM_NODE);

int *peers = malloc(team_shared_npes * sizeof(int));
int num_peers = 0;

/* Print the team members on SHMEM_TEAM_HOST */
/* Print the team members on SHMEMX_TEAM_NODE */
/* Use a lock for cleaner output */
shmem_set_lock(&lock);

printf("[PE: %d] SHMEM_TEAM_HOST peers: { ", me);
printf("[PE: %d] SHMEMX_TEAM_NODE peers: { ", me);
for (int i = 0; i < npes; i++) {
if (shmem_team_translate_pe(SHMEM_TEAM_WORLD, i,
SHMEMX_TEAM_HOST) != -1) {
SHMEMX_TEAM_NODE) != -1) {
peers[num_peers++] = i;
printf("%d ", i);
}
Expand Down

0 comments on commit 8cafd85

Please sign in to comment.