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

Add Multi-init/finalize Support #512

Merged
merged 7 commits into from
May 24, 2024
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
12 changes: 9 additions & 3 deletions content/shmem_init.tex
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@
library. It is a collective operation that all \acp{PE} must call before any
other \openshmem routine may be called. At the end of the \openshmem program
which it initialized, the call to \FUNC{shmem\_init} must be matched with a
call to \FUNC{shmem\_finalize}. After the first call to \FUNC{shmem\_init}, a
subsequent call to \FUNC{shmem\_init} or \FUNC{shmem\_init\_thread} in the
same program results in undefined behavior.
call to \FUNC{shmem\_finalize}.

The \FUNC{shmem\_init} and \FUNC{shmem\_init\_thread} initialization
routines may be called multiple times within an \openshmem program. A
corresponding call to \FUNC{shmem\_finalize} must be made for each call to
an \openshmem initialization routine. The \openshmem library must not be
finalized until after the last call to \FUNC{shmem\_finalize} and may be
re-initialized with a subsequent call to an initialization routine.

}

\apireturnvalues{
Expand Down
15 changes: 12 additions & 3 deletions content/shmem_init_thread.tex
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@
\VAR{requested} are \CONST{SHMEM\_THREAD\_SINGLE}, \CONST{SHMEM\_THREAD\_FUNNELED},
\CONST{SHMEM\_THREAD\_SERIALIZED}, and \CONST{SHMEM\_THREAD\_MULTIPLE}.

An \openshmem program is initialized either by \FUNC{shmem\_init} or \FUNC{shmem\_init\_thread}.
Once an \openshmem library initialization call has been performed, a subsequent
initialization call in the same program results in undefined behavior.
The \FUNC{shmem\_init} and \FUNC{shmem\_init\_thread} initialization
routines may be called multiple times within an \openshmem program. A
corresponding call to \FUNC{shmem\_finalize} must be made for each call to
an \openshmem initialization routine. The \openshmem library must not be
finalized until after the last call to \FUNC{shmem\_finalize} and may be
re-initialized with a subsequent call to an initialization routine.

If the call to \FUNC{shmem\_init\_thread}
is unsuccessful in allocating and initializing resources for the
\openshmem library, then the behavior of any subsequent call
to the \openshmem library is undefined.


}

\apireturnvalues{
Expand All @@ -43,6 +49,9 @@
or \FUNC{shmem\_init\_thread}. If the \openshmem library is initialized
by \FUNC{shmem\_init}, the library implementation can choose to
support any one of the defined thread levels.

The \openshmem library may not be able to change the level of threading support
provided after the first initialization call has been made.
}

\end{apidefinition}
30 changes: 30 additions & 0 deletions content/shmem_query_initialized.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
\apisummary{
Returns the initialized status of the \openshmem library.
}

\begin{apidefinition}

\begin{Csynopsis}
void @\FuncDecl{shmem\_query\_initialized}@(int *initialized);
jdinan marked this conversation as resolved.
Show resolved Hide resolved
\end{Csynopsis}

\begin{apiarguments}
\apiargument{OUT}{initialized}{Nonzero if the \openshmem library is in the initialized state. Nonzero otherwise.}
jdinan marked this conversation as resolved.
Show resolved Hide resolved
\end{apiarguments}

\apidescription{
The \FUNC{shmem\_query\_initialized} call returns the initialization status
of the \openshmem library. If the application has called an \openshmem
initialization routine and has not yet made the corresponding call to
jdinan marked this conversation as resolved.
Show resolved Hide resolved
\FUNC{shmem\_finalize}, this routine returns nonzero. Otherwise, it returns
zero.

This function may be called at any time, regardless of the thread safety
level of the \openshmem library.
}

\apireturnvalues{
None.
}

\end{apidefinition}
3 changes: 3 additions & 0 deletions content/shmem_query_thread.tex
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
initialized by \FUNC{shmem\_init\_thread}. If the library was initialized by
\FUNC{shmem\_init}, the implementation can choose to provide any one of the defined
thread levels, and \FUNC{shmem\_query\_thread} returns this thread level.

This function may be called at any time, regardless of the thread safety
level of the \openshmem library.
}

\apireturnvalues{
Expand Down
4 changes: 4 additions & 0 deletions main_spec.tex
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ \subsubsection{\textbf{SHMEM\_QUERY\_THREAD}}
\label{subsec:shmem_query_thread}
\input{content/shmem_query_thread}

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


\subsection{Memory Management Routines}
\label{sec:memory_management}
Expand Down