Skip to content

Commit

Permalink
Allow multiple calls to init/finalize
Browse files Browse the repository at this point in the history
Signed-off-by: James Dinan <[email protected]>
  • Loading branch information
jdinan committed Apr 8, 2024
1 parent a0b22f7 commit f093500
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
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 \openshme library may not be able to change the level of threading support
provided after the first initialization call has been made.
}

\end{apidefinition}

0 comments on commit f093500

Please sign in to comment.