From f1a9a6c7cb9a02928897b8be00e8f2b6dd40983a Mon Sep 17 00:00:00 2001 From: "Nicholas S. Park" Date: Fri, 25 Jun 2021 16:29:10 -0400 Subject: [PATCH 1/3] Add shmem_{initialized, finalized} --- content/shmem_finalized.tex | 32 ++++++++++++++++++++++++++++++++ content/shmem_initialized.tex | 33 +++++++++++++++++++++++++++++++++ main_spec.tex | 6 ++++++ 3 files changed, 71 insertions(+) create mode 100644 content/shmem_finalized.tex create mode 100644 content/shmem_initialized.tex diff --git a/content/shmem_finalized.tex b/content/shmem_finalized.tex new file mode 100644 index 000000000..3626392b8 --- /dev/null +++ b/content/shmem_finalized.tex @@ -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 + \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} diff --git a/content/shmem_initialized.tex b/content/shmem_initialized.tex new file mode 100644 index 000000000..79fb17d60 --- /dev/null +++ b/content/shmem_initialized.tex @@ -0,0 +1,33 @@ +\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 + 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}. +} + +\end{apidefinition} diff --git a/main_spec.tex b/main_spec.tex index d9e914215..f9d02bc82 100644 --- a/main_spec.tex +++ b/main_spec.tex @@ -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} From 5ed7209a258efed40fcfc1a6cb17bed087675fc4 Mon Sep 17 00:00:00 2001 From: "Nicholas S. Park" Date: Fri, 25 Jun 2021 17:09:42 -0400 Subject: [PATCH 2/3] Changelog for shmem_{initialized,finalized} --- content/backmatter.tex | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/content/backmatter.tex b/content/backmatter.tex index 10191168b..3baa7c603 100644 --- a/content/backmatter.tex +++ b/content/backmatter.tex @@ -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} From c8296d32647104ef1d56ad549d9a764317d50ec9 Mon Sep 17 00:00:00 2001 From: "Nicholas S. Park" Date: Wed, 8 Sep 2021 15:16:41 -0400 Subject: [PATCH 3/3] Add note on multithreaded races for shmem_initialized --- content/shmem_initialized.tex | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/content/shmem_initialized.tex b/content/shmem_initialized.tex index 79fb17d60..9d88bebeb 100644 --- a/content/shmem_initialized.tex +++ b/content/shmem_initialized.tex @@ -30,4 +30,15 @@ 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}