Skip to content

Commit

Permalink
Fix up finalization text
Browse files Browse the repository at this point in the history
Signed-off-by: James Dinan <[email protected]>
  • Loading branch information
jdinan committed Apr 26, 2024
1 parent e5d2493 commit 6bc6a78
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
10 changes: 4 additions & 6 deletions content/execution_model.tex
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
other \openshmem library routines.
An \openshmem program concludes its use of the \openshmem library when all \acp{PE} call
\FUNC{shmem\_finalize} or any \ac{PE} calls \FUNC{shmem\_global\_exit}.
During the last call to \FUNC{shmem\_finalize}, the \openshmem library must
complete all pending communication and release all the resources associated to
the library using an implicit collective synchronization across \acp{PE}.
%% FIXME: SHMEM allocated memory can't be freed until the last finalization call
%% FIXME: Does the non-last call to finalize include an implicit synchronization
%% FIXME: These semantics need to be moved to the finalize function definition
During a call to \FUNC{shmem\_finalize}, the \openshmem library synchronizes
all \acp{PE} and completes all pending communication. During the last call to
\FUNC{shmem\_finalize}, it releases all the resources associated to the
library.

The \acp{PE} of the \openshmem program are identified by unique integers. The
identifiers are integers assigned in a monotonically increasing manner from zero
Expand Down
26 changes: 16 additions & 10 deletions content/shmem_finalize.tex
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,29 @@
\end{apiarguments}

\apidescription{
\FUNC{shmem\_finalize} is a collective operation that ends the \openshmem
portion of a program previously initialized by \FUNC{shmem\_init} or \FUNC{shmem\_init\_thread} and
releases all resources used by the \openshmem library. This collective
operation requires all \acp{PE} to participate in the call. There is an
\FUNC{shmem\_finalize} ends the \openshmem
portion of a program previously initialized by \FUNC{shmem\_init} or \FUNC{shmem\_init\_thread}.
This is a collective
operation that requires all \acp{PE} to participate in the call. There is an
implicit global barrier in \FUNC{shmem\_finalize} to ensure that pending
communications are completed and that no resources are released until all
\acp{PE} have entered \FUNC{shmem\_finalize}.
This routine destroys all teams created by the \openshmem program.

An \openshmem program may perform a series of matching
initialization and finalization calls.
The last call to \FUNC{shmem\_finalize} in this series
releases all resources used by the \openshmem library.
This call destroys all teams created by the \openshmem program.
As a result, all shareable contexts are destroyed.
The user is
responsible for destroying all contexts with the
\CONST{SHMEM\_CTX\_PRIVATE} option enabled prior to calling this routine;
\CONST{SHMEM\_CTX\_PRIVATE} option enabled prior to this call;
otherwise, the behavior is undefined.
\FUNC{shmem\_finalize} must be
the last \openshmem library call encountered in the \openshmem portion of a
program. A call to \FUNC{shmem\_finalize} will release all resources
initialized by a corresponding call to \FUNC{shmem\_init} or \FUNC{shmem\_init\_thread}. All processes

The last call to \FUNC{shmem\_finalize} causes the \openshmem library
to enter an uninitialized state. No further \openshmem calls may be
made until an \openshmem initialization routine is called.
All processes
that represent the \acp{PE} will still exist after the
call to \FUNC{shmem\_finalize} returns, but they will no longer have access
to resources that have been released.
Expand Down

0 comments on commit 6bc6a78

Please sign in to comment.