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 edits from September F2F #302

Merged
merged 9 commits into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
2 changes: 1 addition & 1 deletion content/shmem_ctx_create.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
\apisummary{
Create a communication context locally.
Create a communication context.
}
jdinan marked this conversation as resolved.
Show resolved Hide resolved

\begin{apidefinition}
Expand Down
7 changes: 3 additions & 4 deletions content/shmem_sync.tex
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
\apisummary{
Registers the arrival of a \ac{PE} at a synchronization point and suspends
execution until all other \acp{PE} in a given \openshmem team or active set
arrive at a synchronization point. For multithreaded programs, execution is suspended
as specified by the threading model (Section \ref{subsec:thread_support}).
Registers the arrival of a \ac{PE} at a synchronization point.
This routine does not return until all other PEs in a given OpenSHMEM team
jdinan marked this conversation as resolved.
Show resolved Hide resolved
or active set arrive at the synchronization point.
jdinan marked this conversation as resolved.
Show resolved Hide resolved
}

\begin{apidefinition}
Expand Down
5 changes: 3 additions & 2 deletions content/shmem_team_create_ctx.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
\apisummary{
Create a communication context from a team locally.
Create a communication context from a team.
}

\begin{apidefinition}
Expand All @@ -20,7 +20,8 @@
\apidescription{
The \FUNC{shmem\_team\_create\_ctx} routine creates a new communication
context and returns its handle through the \VAR{ctx} argument.
This context is created from the team specified by the \VAR{team} argument.
This context is created from the team specified by the \VAR{team} argument;
however, the context creation operation is not collective

jdinan marked this conversation as resolved.
Show resolved Hide resolved
In addition to the team, the \FUNC{shmem\_team\_create\_ctx} routine accepts
the same arguments and provides all the same return conditions as the
Expand Down
4 changes: 2 additions & 2 deletions content/teams_intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ \subsubsection*{Team Creation}
is detailed further in Section~\ref{subsec:shmem_team_config_t}.

\acp{PE} in a newly created teams are consecutively numbered with starting with
\ac{PE} number 0. \acp{PE} are always ordered by the existing global \ac{PE} number that
would be returned by the \FUNC{shmem\_my\_pe} routine. Team relative \ac{PE}
\ac{PE} number 0. \acp{PE} are always ordered by the existing \ac{PE} number that
would be returned by the \FUNC{shmem\_team\_my\_pe} routine called on the parent team. Team relative \ac{PE}
jdinan marked this conversation as resolved.
Show resolved Hide resolved
numbers can be used for point-to-point operations through team-based
contexts (see Section~\ref{sec:ctx}) or using the translation routine
\FUNC{shmem\_team\_translate\_pe}.
Expand Down
10 changes: 7 additions & 3 deletions example_code/shmem_sync_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,23 @@ int main(void)
shmem_team_split_strided(SHMEM_TEAM_WORLD, 0, 3, npes / 3 + odd_npes,
config, 0, &threes_team);

int my_pe_twos = shmem_team_my_pe(twos_team);
int my_pe_twos = shmem_team_my_pe(twos_team);
int my_pe_threes = shmem_team_my_pe(threes_team);
int npes_twos = shmem_team_n_pes(twos_team);
int npes_threes = shmem_team_n_pes(threes_team);

if (twos_team != SHMEM_TEAM_INVALID) {
/* put the value 2 to the next team member in a circular fashion */
shmem_p(&x, 2, (me + 2) % npes);
shmem_p(&x, 2, shmem_team_translate_pe(twos_team, (my_pe_twos + 1) %
npes_twos, SHMEM_TEAM_WORLD));
shmem_quiet();
shmem_sync(twos_team);
}

if (threes_team != SHMEM_TEAM_INVALID) {
/* put the value 3 to the next team member in a circular fashion */
shmem_p(&x, 3, (me + 3) % npes);
shmem_p(&x, 3, shmem_team_translate_pe(threes_team, (my_pe_threes + 1) %
npes_threes, SHMEM_TEAM_WORLD));
shmem_quiet();
shmem_sync(threes_team);
}
Expand Down
12 changes: 6 additions & 6 deletions example_code/shmem_team_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ int my_ctx_translate_pe(shmem_ctx_t src_ctx, int src_pe, shmem_ctx_t dest_ctx)
if (dest_ctx == SHMEM_CTX_INVALID) {
return -1;
}

shmem_team_t src_team, dest_team;
shmem_ctx_get_team(src_ctx, &src_team);
shmem_ctx_get_team(dest_ctx, &dest_team);
Expand All @@ -37,7 +37,7 @@ void my_send_to_neighbor(shmem_ctx_t ctx, int *val)
fprintf (stderr, "Send to neighbor fail due to invalid context\n");
return;
}

shmem_team_t team;
shmem_ctx_get_team(ctx, &team);
int pe = shmem_team_my_pe(team);
Expand All @@ -56,7 +56,7 @@ int main()

int npes = shmem_n_pes();
isum = 0;

shmem_team_t team_2s, team_3s;
shmem_ctx_t ctx_2s, ctx_3s;
shmem_team_config_t conf;
Expand All @@ -76,7 +76,7 @@ int main()
my_send_to_neighbor(ctx_3s, &ival3);

// Quiet all contexts and synchronize all PEs to complete the data transfers
shmem_ctx_quiet(ctx_2s);
shmem_ctx_quiet(ctx_2s);
shmem_ctx_quiet(ctx_3s);
shmem_team_sync(SHMEM_TEAM_WORLD);

Expand All @@ -89,10 +89,10 @@ int main()
}
else {
// Add up the results on pe 4 of the 3s team, using the 2s team context
shmem_ctx_int_atomic_add(ctx_2s, &isum, ival2 + ival3, _pe4_of_3s_in_2s);
shmem_ctx_int_atomic_add(ctx_2s, &isum, ival2 + ival3, pe4_of_3s_in_2s);
}
}

// Quiet the context and synchronize PEs to complete the operation
shmem_ctx_quiet(ctx_2s);
shmem_team_sync(SHMEM_TEAM_WORLD);
Expand Down