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

[SHMEM 1.6 Sec 9.4-9.5] Updates to Teams and Context #538

Merged
merged 12 commits into from
Sep 27, 2024
Merged
15 changes: 13 additions & 2 deletions content/shmem_team_split_strided.tex
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
\begin{apiarguments}
\apiargument{IN}{parent\_team}{An \openshmem team.}

\apiargument{IN}{start}{The lowest \ac{PE} number of the subset of \acp{PE} from
the parent team that will form the new team.}
\apiargument{IN}{start}{The first \acs{PE} number of the subset of \acp{PE} from the parent team that will form the new team. If the stride is less than zero, the first \acs{PE} number is the highest \acs{PE} of the parent team; if it is greater than zero, it is the lowest; if the stride is zero, it is the starting \acs{PE}.}

\apiargument{IN}{stride}{The stride between team \ac{PE}
numbers in the parent team that comprise the subset of \acp{PE} that will form
Expand Down Expand Up @@ -59,6 +58,18 @@
relative order with respect to the parent team.
If a $stride$ value equal to 0 is passed to \FUNC{shmem\_team\_split\_strided},
then the $size$ argument passed must be 1, or the behavior is undefined.
If the triplet provided to \FUNC{shmem\_team\_split\_strided} implies a
wrap-around sequence, the input is considered invalid and the behavior is
undefined.
In other words, when $stride$ is nonzero, a newly created team must only
include \acp{PE} whose subsequent parent \ac{PE} values are either all
increasing (for positive $stride$) or all decreasing (for negative
$stride$).
That is, \textit{wrap-around} with respect to the parent team's \ac{PE} values
is not permitted.
For example, the list of \acp{PE} in the parent team should not start at a high
number and then continue to include \acp{PE} in the lower end of the parent
team's \ac{PE} range.

This routine must be called by all \acp{PE} in the parent team.
All \acp{PE} must provide the same values for the \ac{PE} triplet.
Expand Down
8 changes: 1 addition & 7 deletions example_code/shmem_ctx.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#include <shmem.h>
#include <stdio.h>

long pwrk[SHMEM_REDUCE_MIN_WRKDATA_SIZE];
long psync[SHMEM_REDUCE_SYNC_SIZE];

long task_cntr = 0; /* Next task counter */
long tasks_done = 0; /* Tasks done by this PE */
long total_done = 0; /* Total tasks done by all PEs */
Expand All @@ -12,9 +9,6 @@ int main(void) {
int tl, i;
long ntasks = 1024; /* Total tasks per PE */

for (i = 0; i < SHMEM_REDUCE_SYNC_SIZE; i++)
psync[i] = SHMEM_SYNC_VALUE;

shmem_init_thread(SHMEM_THREAD_MULTIPLE, &tl);
if (tl != SHMEM_THREAD_MULTIPLE)
shmem_global_exit(1);
Expand Down Expand Up @@ -49,7 +43,7 @@ int main(void) {
shmem_ctx_destroy(ctx);
}

shmem_long_sum_to_all(&total_done, &tasks_done, 1, 0, 0, npes, pwrk, psync);
shmem_long_sum_reduce(SHMEM_TEAM_WORLD, &total_done, &tasks_done, 1);

int result = (total_done != ntasks * npes);
shmem_finalize();
Expand Down