Skip to content

Add shmem_{initialized, finalized} #470

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions content/backmatter.tex
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,16 @@ \subsection{Table~\ref{p2psynctypes}: point-to-point synchronization types}

\chapter{Changes to this Document}\label{sec:changelog}

\section{Version 1.6}

The following list describes the specific changes in \openshmem[1.6]:
\begin{itemize}

\item Added \FUNC{shmem\_initialized} and \FUNC{shmem\_finalized} to
provide a query mechanism for the state of the \openshmem library.

\end{itemize}

\section{Version 1.5}
Major changes in \openshmem[1.5] include the addition of new team-based
collective functions, \OPR{put-with-signal} functions, nonblocking \ac{AMO}
Expand Down
32 changes: 32 additions & 0 deletions content/shmem_finalized.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
\apisummary{
Indicates whether the \openshmem library has been finalized.
}

\begin{apidefinition}

\begin{Csynopsis}
int @\FuncDecl{shmem\_finalized}@(void);
\end{Csynopsis}

\begin{apiarguments}
\apiargument{None}{}{}
\end{apiarguments}

\apidescription{
The \FUNC{shmem\_finalized} routine returns a value indicating
whether the \openshmem library has been finalized (i.e, a call to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want "has been" or "is currently"? The problem with "has been" is that it tells you whether the API was ever called. If we assume that an OpenSHMEM library can't be reinitialized, then this is enough information to tell you the library state. If an OpenSHMEM library supports reinitialization then "has been" is not enough information to know the state of the library. You need to know "is currently".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, here is the NVSHMEM library state query function: https://docs.nvidia.com/hpc-sdk/nvshmem/api/docs/gen/api/setup.html#nvshmemx-init-status

\FUNC{shmem\_finalize} has completed successfully).
This routine may be called at any point in an \openshmem program,
including before \FUNC{shmem\_init[\_thread]} and after
\FUNC{shmem\_finalize}.
This routine may be called by any thread of execution in the
\ac{PE}, independent of the level of thread support provided by the
implementation.
}

\apireturnvalues{
Returns \CONST{1} if the \openshmem library has been finalized;
otherwise, returns \CONST{0}.
}

\end{apidefinition}
44 changes: 44 additions & 0 deletions content/shmem_initialized.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
\apisummary{
Indicates whether the \openshmem library has been initialized.
}

\begin{apidefinition}

\begin{Csynopsis}
int @\FuncDecl{shmem\_initialized}@(void);
\end{Csynopsis}

\begin{apiarguments}
\apiargument{None}{}{}
\end{apiarguments}

\apidescription{
The \FUNC{shmem\_initialized} routine returns a value indicating
whether the \openshmem library has been initialized (i.e, a call to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want "has been" or "is currently"?

either \FUNC{shmem\_init} or \FUNC{shmem\_init\_thread} has
completed successfully).
This routine may be called at any point in an \openshmem program,
including before \FUNC{shmem\_init[\_thread]} and after
\FUNC{shmem\_finalize}.
This routine may be called by any thread of execution in the
\ac{PE}, independent of the level of thread support provided by the
implementation.
}

\apireturnvalues{
Returns \CONST{1} if the \openshmem library has been initialized;
otherwise, returns \CONST{0}.
}

\apinotes{
Although \FUNC{shmem\_initialized} is thread-safe, its return value
is not a sufficient guard to prevent multiple threads from racing to
initialize the \openshmem library concurrently, as
\FUNC{shmem\_initialized} may return \CONST{0} to one thread while
library initialization is in progress due to a call from another
thread. Applications must ensure that only one call to
\FUNC{shmem\_init[\_thread]} is made to initialize the \openshmem
library.
}

\end{apidefinition}
6 changes: 6 additions & 0 deletions main_spec.tex
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ \subsubsection{\textbf{SHMEM\_N\_PES}}\label{subsec:shmem_n_pes}
\subsubsection{\textbf{SHMEM\_FINALIZE}}\label{subsec:shmem_finalize}
\input{content/shmem_finalize}

\subsubsection{\textbf{SHMEM\_INITIALIZED}}\label{subsec:shmem_initialized}
\input{content/shmem_initialized}

\subsubsection{\textbf{SHMEM\_FINALIZED}}\label{subsec:shmem_finalized}
\input{content/shmem_finalized}

\subsubsection{\textbf{SHMEM\_GLOBAL\_EXIT}}\label{subsec:shmem_global_exit}
\input{content/shmem_global_exit}

Expand Down