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 1-8] Updates and additions to front matter #528

Merged
merged 9 commits into from
Sep 27, 2024
13 changes: 13 additions & 0 deletions content/library_constants.tex
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@
See Section~\ref{subsec:shmem_ctx_create} for more detail about its use.
\tabularnewline \hline
%%
\LibConstDecl{SHMEM\_CTX\_SESSION\_TOTAL\_OPS} &
The bitwise flag which specifies that a session start routine should use the
\VAR{total\_ops} member of the provided \CTYPE{shmem\_ctx\_session\_config\_t}
configuration parameter as a hint. See \ref{subsec:shmem_ctx_session_config_t}
for more detail about its use.
\tabularnewline \hline
%%
\LibConstDecl{SHMEM\_CTX\_SESSION\_BATCH} &
The session start option which specifies that operations in the given session
are latency tolerant and may be candidates for batching. See
\ref{subsec:shmem_ctx_session_start} for more detail about its use.
\tabularnewline \hline
%%
\LibConstDecl{SHMEM\_SIGNAL\_SET} &
An integer constant expression corresponding to the signal update set operation.
See Section~\ref{subsec:shmem_put_signal} and
Expand Down
2 changes: 1 addition & 1 deletion content/memory_model.tex
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ \subsection{Pointers to Symmetric Objects}\label{subsec:pointers_to_symmetric_ob
The ``mem'' interfaces (e.g., \FUNC{shmem\_putmem}) have no alignment
requirements.

The \FUNC{shmem\_ptr} routine allows the programmer to query a {\em local
The \FUNC{shmem\_ptr} and \FUNC{shmem\_team\_ptr} routines allow the application to query a {\em local
address} to a remotely accessible data object at a specified \ac{PE}. The
resulting pointer is valid for direct memory access; however, providing this
address as an argument of an \openshmem routine that requires a symmetric
Expand Down
56 changes: 38 additions & 18 deletions content/programming_model_overview.tex
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@

\item \textbf{Symmetric Data Object Management}
\begin{enumerate}
\item \OPR{Allocation}: All executing \acp{PE} must participate in the
\item \OPR{Allocation}: All executing \acp{PE} must collectively participate in the
allocation of a symmetric data object with identical arguments.
\item \OPR{Deallocation}: All executing \acp{PE} must participate in the
\item \OPR{Deallocation}: All executing \acp{PE} must collectively participate in the
deallocation of the same symmetric data object with identical arguments.
\item \OPR{Reallocation}: All executing \acp{PE} must participate in the
\item \OPR{Reallocation}: All executing \acp{PE} must collectively participate in the
reallocation of the same symmetric data object with identical arguments.
\end{enumerate}

Expand Down Expand Up @@ -81,24 +81,27 @@

\item \textbf{\acfp{AMO}}
\begin{enumerate}
\item \OPR{Swap}: The \ac{PE} initiating the swap gets the old value of a
symmetric data object from a remote \ac{PE} and copies a new value to
that symmetric data object on the remote \ac{PE}.
\item \OPR{Fetch}: The \ac{PE} initiating the fetch returns the value of the
symmetric data object on the remote \ac{PE}.
\item \OPR{Set}: The \ac{PE} initiating the set copies a new value to the
symmetric data object on the remote \ac{PE}.
\item \OPR{Swap}: The \ac{PE} initiating the swap copies a new value to the
symmetric data object on the remote \ac{PE} and returns the old value.
\item \OPR{Increment}: The \ac{PE} initiating the increment adds 1 to the
symmetric data object on the remote \ac{PE}.
\item \OPR{Add}: The \ac{PE} initiating the add specifies the value to be added
to the symmetric data object on the remote \ac{PE}.
\item \OPR{Bitwise Operations}: The \ac{PE} initiating the bitwise
operation specifies the operand value to the bitwise operation to be
performed on the symmetric data object on the remote \ac{PE}.
\item \OPR{Compare and Swap}: The \ac{PE} initiating the swap gets the old value
of the symmetric data object based on a value to be compared and copies a
new value to the symmetric data object on the remote \ac{PE}.
\item \OPR{Fetch and Increment}: The \ac{PE} initiating the increment adds 1 to
the symmetric data object on the remote \ac{PE} and returns with the old
\item \OPR{Compare and Swap}: The \ac{PE} initiating the compare and swap
conditionally copies a new value to the symmetric data object on the
remote \ac{PE} and returns the old value.
\item \OPR{Fetch and Increment}: The \ac{PE} initiating the increment adds 1
to the symmetric data object on the remote \ac{PE} and returns the old
value.
\item \OPR{Fetch and Add}: The \ac{PE} initiating the add specifies the value to
be added to the symmetric data object on the remote \ac{PE} and returns with
be added to the symmetric data object on the remote \ac{PE} and returns
the old value.
\item \OPR{Fetch and Bitwise Operations}: The \ac{PE} initiating the bitwise
operation specifies the operand value to the bitwise operation to be
Expand All @@ -108,9 +111,23 @@

\item \textbf{Signaling Operations}
\begin{enumerate}
\item \OPR{Signaling Put}: The \source{} data is copied to the symmetric
object on the remote \ac{PE} and a flag on the remote \ac{PE} is subsequently
updated to signal completion.
\item \OPR{Put Signal}: The local \ac{PE} specifies the \source{} data object
to be copied to the symmetric data object on the remote \ac{PE} and
another symmetric data object on the remote \ac{PE} is subsequently
updated to signal completion.
\item \OPR{Signal Add}: The local \ac{PE} specifies a value to be added to
the symmetric data object on the remote \ac{PE}.
\item \OPR{Signal Set}: The local \ac{PE} specifies a value to be copied to
the symmetric data object on the remote \ac{PE}.
\item \OPR{Signal Fetch}: The local \ac{PE} returns the value of a local data
object.
\end{enumerate}

\item \textbf{Session Management}
\begin{enumerate}
\item \OPR{Sessions}: Sessions are a mechanism for the application to inform
the implementation about an upcoming sequence of operations that exhibit
a pattern that may be suitable for runtime optimization.
\end{enumerate}

\item \textbf{Synchronization and Ordering}
Expand All @@ -135,16 +152,19 @@
\begin{enumerate}
\item \OPR{Broadcast}: The \VAR{root} \ac{PE} specifies a symmetric data
object to be copied to a symmetric data object on one or more remote
\acp{PE} (not including itself).
\acp{PE}.
\item \OPR{Collection}: All \acp{PE} participating in the routine get the result
of concatenated symmetric objects contributed by each of the \acp{PE} in
another symmetric data object.
\item \OPR{Reduction}: All \acp{PE} participating in the routine get the result
of an associative binary routine over elements of the specified symmetric
data object on another symmetric data object.
\item \OPR{All-to-All}: All \acp{PE} participating in the routine exchange
a fixed amount of contiguous or strided data with all other \acp{PE}
in the active set.
a fixed amount of contiguous or strided data with all other participating
\acp{PE}.
\item \OPR{Scan}: All \acp{PE} participating in the routine perform an
inclusive or exclusive prefix sum over elements of the specified
symmetric data object.
\end{enumerate}

\item \textbf{Mutual Exclusion}
Expand Down
7 changes: 1 addition & 6 deletions example_code/amo_scenario_3.c
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
#include <shmem.h>

int main(void) {
static long psync[SHMEM_REDUCE_SYNC_SIZE];
static int pwrk[SHMEM_REDUCE_MIN_WRKDATA_SIZE];
static int x = 0, y = 0;

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

shmem_init();
shmem_int_atomic_inc(&x, (shmem_my_pe() + 1) % shmem_n_pes());
/* Undefined behavior: The following reduction operation performs accesses to
* symmetric variable 'x' that are concurrent with previously issued atomic
* increment operations on the same variable. */
shmem_int_sum_to_all(&y, &x, 1, 0, 0, shmem_n_pes(), pwrk, psync);
shmem_int_sum_reduce(SHMEM_TEAM_WORLD, &y, &x, 1);

shmem_finalize();
return 0;
Expand Down