-
Notifications
You must be signed in to change notification settings - Fork 41
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
OpenSHMEM Sessions (ctx hints) API #493
Merged
Merged
Changes from 10 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
2387433
Add 1st draft of bundle start/stop API & example
352f20f
Added change-log entry for the bundle routines
ca03037
Branch from wip/bundles w/ feedback (highlighted)
0b532e0
WIP text / rearrangment for Sessions
97fe276
Merge branch 'master' of github.com:openshmem-org/specification into …
9d7b266
Sessions: rewrite bundles text to suit sessions
ef0d9c6
Sessions: rewrite bundles text to suit sessions
64b51f6
Merge branch 'wip/sessions' of github.com:davidozog/openshmem-specifi…
09a0f10
Sessions: remove unecessary drafting artifacts
93f510e
Sessions: address some feedback from reading
0a9873a
Sessions: rewording and edits based on WG feedback
c2dd73e
Update content/sessions_intro.tex
davidozog 96758c9
Update content/backmatter.tex
davidozog 4616742
Sessions: better define "chain" and add an example
6417925
rm extraneous sessions options, clarify "chaining"
bd37f7c
sessions: swap shmem_session_start arguments
davidozog e015370
sessions: "chain together", not "optimizations"
davidozog 242595b
sessions: small vs. large blocking puts for chains
davidozog ff3a2db
sessions: Say "HPC Challenge benchmark" not "GUPS"
davidozog 94dd7c1
sessions: add quiet & comments to sessions example
davidozog 7a6f600
sessions: no-op if ctx equals SHMEM_CTX_INVALID
davidozog 9e24b47
sessions: redo options table, rename chain->batch
davidozog 7034807
sessions: note "small" depends on implementation
davidozog 4a0e482
sessions: update code example based on WG feedback
davidozog 30ce68e
sessions/example: check ctx_create return & clean
caacb66
sessions/example: add config struct and mask
6d0f714
sessions: rename completion_rate to delivery_rate
933f8ff
sessions: remove delivery_rate config_t parameter
aa84ede
sessions: improve language regarding config_t hint
3fc9bf3
sessions: improve writing, fix example, SAME_AMO
26f3cc0
sessions: rename entire API to shmem_ctx_session_*
e22a3f1
sessions: remove SESSION_SAME_AMO hint for now...
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
\openshmem \emph{sessions} provide a mechanism for applications to inform the | ||
\openshmem library of an upcoming sequence of communication routines that | ||
exhibit suitable patterns for runtime optimizations. | ||
A session is associated with a specific \openshmem communication context | ||
(Section~\ref{sec:ctx}), and it indicates the beginning and ending of | ||
communication phases on that context. | ||
The \FUNC{shmem\_session\_start} routine indicates the beginning of a session, | ||
and the \FUNC{shmem\_session\_stop} routine indicates the end of a session. | ||
The \LibConstRef{SHMEM\_SESSION\_*} options (Table~\ref{session_opts}) indicate | ||
which patterns of \openshmem RMA and AMO routines will occur within a session. | ||
These options serve only as \textit{hints} to the library; it is up to the | ||
implementation whether or not to apply any optimizations within a session. | ||
|
||
Usage of the \openshmem session APIs on a particular context must comply with | ||
the requirements of all options set on that context. | ||
Starting and stoping \openshmem sessions should not affect the completion or | ||
davidozog marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ordering semantics of any \openshmem routines in the program. | ||
For these reasons, multi-threaded \openshmem programs may require additional | ||
thread synchronization to ensure sessions hints are correctly applied to | ||
shareable contexts. | ||
Because sessions are associated with an \openshmem communication context, | ||
routines not performed on a communication context (like collective routines) | ||
are ineligible for session hints. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
\apisummary{ | ||
Start a communication session. | ||
} | ||
|
||
\begin{apidefinition} | ||
|
||
\begin{Csynopsis} | ||
void @\FuncDecl{shmem\_session\_start}@(long options, shmem_ctx_t ctx); | ||
\end{Csynopsis} | ||
|
||
\begin{apiarguments} | ||
\apiargument{IN}{options}{The set of requested options from | ||
Table~\ref{session_opts} for this session. Multiple options may be | ||
requested by combining them with a bitwise OR operation; otherwise, | ||
\CONST{0} can be given if no options are requested.} | ||
\apiargument{IN}{ctx}{A context handle specifying the context associated | ||
with this session.} | ||
\end{apiarguments} | ||
|
||
\apidescription{ | ||
\FUNC{shmem\_session\_start} is a non-collective routine that begins a | ||
session on communication context \VAR{ctx} with hints requested via | ||
\VAR{options}. | ||
Sessions on a communication context must be stopped with a call to | ||
\FUNC{shmem\_session\_stop} on the same context. | ||
If a session is already started on a given context, another call to | ||
\FUNC{shmem\_session\_start} on that same context combines new options via a | ||
bitwise OR operation. | ||
Passing false or ambiguous \VAR{options} to a session should never result in | ||
undefined behavior, but may result in poor library performance. | ||
} | ||
|
||
\apireturnvalues{ | ||
None. | ||
} | ||
|
||
\begin{longtable}{|p{0.45\textwidth}|p{0.5\textwidth}|} | ||
\hline | ||
\hline | ||
\textbf{Option} & \textbf{Usage hint} | ||
\tabularnewline \hline | ||
\endhead | ||
%% | ||
\LibConstDecl{SHMEM\_SESSION\_OP\_PUT} & | ||
\newline | ||
The session will contain non-blocking \textit{put} and/or scalar put operations. | ||
\tabularnewline \hline | ||
|
||
\LibConstDecl{SHMEM\_SESSION\_OP\_GET} & | ||
\newline | ||
The session will contain non-blocking \textit{get} operations. | ||
\tabularnewline \hline | ||
|
||
\LibConstDecl{SHMEM\_SESSION\_OP\_PUT\_SIGNAL} & | ||
\newline | ||
The session will contain non-blocking \textit{put-with-signal} operations. | ||
\tabularnewline \hline | ||
|
||
\LibConstDecl{SHMEM\_SESSION\_OP\_AMO} & | ||
\newline | ||
The session will contain non-fetching AMOs. | ||
\tabularnewline \hline | ||
|
||
\LibConstDecl{SHMEM\_SESSION\_OP\_AMO\_FETCH} & | ||
\newline | ||
The session will contain non-blocking fetching AMOs. | ||
\tabularnewline \hline | ||
|
||
\LibConstDecl{SHMEM\_SESSION\_CHAIN} & | ||
\newline | ||
The session will contain a chain (a trivial repeating pattern) of similar RMA operations. | ||
\tabularnewline \hline | ||
|
||
\LibConstDecl{SHMEM\_SESSION\_UNIFORM\_AMO} & | ||
\newline | ||
The session will contain a chain of AMOs that will not occur concurrently | ||
across any different signal operators (i.e.~\ref{subsec:signal_operator}), | ||
operations (\ref{sec:amo}), or types (Tables \ref{stdamotypes} and | ||
\ref{extamotypes}). | ||
\tabularnewline \hline | ||
\TableCaptionRef{Session options} | ||
\label{session_opts} | ||
\end{longtable} | ||
|
||
\apinotes{ | ||
The \FUNC{shmem\_session\_start} routine provides hints for improving | ||
performance, and \openshmem implementations are not required to apply any | ||
optimization. | ||
\FUNC{shmem\_session\_start} is non-collective, so there is no implied | ||
synchronization. | ||
Implementations are encouraged to supply users with information about the | ||
session options being applied or ignored; for instance, when | ||
\LibConstRef{SHMEM\_DEBUG} is set. | ||
} | ||
|
||
\end{apidefinition} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
\apisummary{ | ||
Stop a communication session. | ||
} | ||
|
||
\begin{apidefinition} | ||
|
||
\begin{Csynopsis} | ||
void @\FuncDecl{shmem\_session\_stop}@(shmem_ctx_t ctx); | ||
\end{Csynopsis} | ||
|
||
\begin{apiarguments} | ||
\apiargument{IN}{ctx}{A context handle specifying the context associated | ||
with this session.} | ||
\end{apiarguments} | ||
|
||
\apidescription{ | ||
The \FUNC{shmem\_session\_stop} routine ends a session on context \VAR{ctx}. | ||
If a session is already stopped on a given communication context, another | ||
call to \FUNC{shmem\_session\_stop} on that context has no effect. | ||
} | ||
|
||
\apireturnvalues{ | ||
None. | ||
} | ||
|
||
\apinotes{ | ||
Users are discouraged from including non-\openshmem code, such as a long | ||
computation loop, within a session without first calling | ||
\FUNC{shmem\_session\_stop}. | ||
} | ||
|
||
|
||
\begin{apiexamples} | ||
|
||
\apicexample | ||
{The following example demonstrates the usage of | ||
\FUNC{shmem\_session\_start} and \FUNC{shmem\_session\_stop} with a loop of | ||
random atomic non-fetching XOR updates to a distributed table, similar to | ||
the Giga-updates per second (GUPS) microbenchmark | ||
\footnote{http://icl.cs.utk.edu/projectsfiles/hpcc/RandomAccess/}.} | ||
{./example_code/shmem_session_example.c} | ||
{} | ||
\end{apiexamples} | ||
|
||
\end{apidefinition} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <shmem.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
#define N_UPDATES (1lu << 18) | ||
#define N_INDICES (1lu << 10) | ||
#define N_VALUES (1lu << 31) | ||
|
||
int main(void) { | ||
|
||
shmem_init(); | ||
|
||
uint64_t *table = shmem_calloc(N_INDICES, sizeof(uint64_t)); | ||
|
||
int mype = shmem_my_pe(); | ||
int npes = shmem_n_pes(); | ||
srand(mype); | ||
|
||
shmem_session_start(SHMEM_SESSION_UNIFORM_AMO, SHMEM_CTX_DEFAULT); | ||
|
||
for (size_t i = 0; i < N_UPDATES; i++) { | ||
int random_pe = rand() % npes; | ||
size_t random_idx = rand() % N_INDICES; | ||
uint64_t random_val = rand() % N_VALUES; | ||
shmem_uint64_atomic_xor(&table[random_idx], random_val, random_pe); | ||
} | ||
|
||
shmem_session_stop(SHMEM_CTX_DEFAULT); | ||
|
||
shmem_free(table); | ||
shmem_finalize(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these start/stop functions have been updated to include
ctx
as well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, yes; I think these should have been renamed just like every other instance below.
How shall we handle this @jdinan? Do you think it's eligible for a doc edit?