-
Notifications
You must be signed in to change notification settings - Fork 42
Memory Spaces #567
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
base: main
Are you sure you want to change the base?
Memory Spaces #567
Changes from all commits
4d8b256
0ec0cb9
12d4eda
fc84155
4c0738a
3f0f412
c930e77
8076b8c
2006de2
9ce8c06
b8699a9
838e65f
0ed0006
e5aed21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,4 @@ main_spec.out | |
| main_spec.pdf | ||
| main_spec.toc | ||
| *~ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ | |
|
|
||
| \medskip{} | ||
|
|
||
| \begin{longtable}{|p{0.260\textwidth}|p{0.145\textwidth}|p{0.50\textwidth}|} | ||
| \begin{longtable}{|p{0.370\textwidth}|p{0.145\textwidth}|p{0.390\textwidth}|} | ||
| \hline | ||
| \textbf{Variable} & \textbf{Value} & \textbf{Description} | ||
| \tabularnewline\hline | ||
|
|
@@ -31,29 +31,45 @@ | |
| %% | ||
| \EnvVarDecl{SHMEM\_SYMMETRIC\_SIZE} | ||
| & Non-negative integer or floating point value with an optional character | ||
| suffix | ||
| & Specifies the size (in bytes) of the symmetric heap memory per \ac{PE}. | ||
| The resulting size is implementation-defined and must be at least as large as | ||
| the integer ceiling of the product of the numeric prefix and the scaling | ||
| factor. The allowed character suffixes for the scaling factor are as | ||
| follows: | ||
| suffix | ||
| & Specifies the size (in bytes) of the symmetric heap memory per \ac{PE} | ||
| for \LibHandleRef{SHMEM\_SPACE\_DEFAULT}. The resulting size is | ||
| implementation-defined and must be at least as large as the integer | ||
| ceiling of the product of the numeric prefix and the scaling factor. | ||
| The allowed character suffixes for the scaling factor are: | ||
| \begin{itemize} | ||
| \item k or K multiplies by \(2^{10}\) (kibibytes) | ||
| \item m or M multiplies by \(2^{20}\) (mebibytes) | ||
| \item g or G multiplies by \(2^{30}\) (gibibytes) | ||
| \item t or T multiplies by \(2^{40}\) (tebibytes) | ||
| \end{itemize} | ||
| For example, string \enquote{20m} is equivalent to the integer value | ||
| 20971520, or 20 mebibytes. Similarly the string \enquote{3.1M} is | ||
| equivalent to the integer value 3250586. | ||
| Only one multiplier is recognized and any characters following the | ||
| multiplier are ignored, so \enquote{20kk} will not produce the same | ||
| result as \enquote{20m}. Usage of string \enquote{.5m} will yield the | ||
| same result as the string \enquote{0.5m}. | ||
|
|
||
| An invalid value for \ENVVAR{SHMEM\_SYMMETRIC\_SIZE} is an error, which the | ||
| \openshmem library shall report by either returning a nonzero value from | ||
| \FUNC{shmem\_init\_thread} or causing program termination. | ||
| An invalid value is an error, which the \openshmem library shall report | ||
| by either returning a nonzero value from \FUNC{shmem\_init\_thread} or | ||
| causing program termination. | ||
| \tabularnewline\hline | ||
| %% | ||
| \EnvVarDecl{SHMEM\_<DEVICE>\_SYMMETRIC\_SIZE} | ||
| & Non-negative integer or floating point value with an optional character | ||
| suffix | ||
| & Specifies the size (in bytes) of the symmetric heap memory per \ac{PE} | ||
| for \LibHandleRef{SHMEM\_SPACE\_<DEVICE>}. The resulting size is | ||
| implementation-defined and must be at least as large as the integer | ||
| ceiling of the product of the numeric prefix and the scaling factor. | ||
| The allowed character suffixes are as in \ENVVAR{SHMEM\_SYMMETRIC\_SIZE}. | ||
| Device tokens are implementation-defined. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need a clear definition for "device tokens". |
||
| \tabularnewline\hline | ||
| %% | ||
| \EnvVarDecl{SHMEM\_ENABLE\_<DEVICE>} | ||
| & Any | ||
| & Enables the symmetric heap for \LibHandleRef{SHMEM\_SPACE\_<DEVICE>}. | ||
| When not set or empty for a given \textit{<DEVICE>}, that device's | ||
| symmetric heap is disabled. Device tokens are implementation-defined. | ||
| \tabularnewline\hline | ||
| %% | ||
| \EnvVarDecl{SHMEM\_DEFAULT\_SPACE} | ||
| & \textit{<DEVICE>} | ||
| & Controls which space \LibHandleRef{SHMEM\_SPACE\_DEFAULT} aliases to. | ||
| If not set, the implementation chooses the default space. | ||
| \tabularnewline\hline | ||
| %% | ||
| \EnvVarDecl{SHMEM\_DEBUG} | ||
|
|
@@ -62,4 +78,4 @@ | |
| \tabularnewline\hline | ||
| \end{longtable} | ||
|
|
||
| \medskip{} | ||
| \medskip{} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,43 @@ | ||
| \openshmem provides a set of \acp{API} for managing the symmetric heap. The | ||
| \openshmem provides a set of \acp{API} for managing symmetric heaps. The | ||
| \acp{API} allow one to dynamically allocate, deallocate, reallocate, and align | ||
| symmetric data objects in the symmetric heap. | ||
| symmetric data objects in these heaps. | ||
|
|
||
| The symmetric memory allocation routines differ from the private heap | ||
| In addition to the traditional (legacy) symmetric heap used by | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we use the term "legacy" elsewhere in the spec, e.g. to refer to operations that use the default context. Unless they are being deprecated, I would suggest that we don't introduce this term. |
||
| \FUNC{shmem\_malloc}, \FUNC{shmem\_calloc}, \FUNC{shmem\_free}, and | ||
| \FUNC{shmem\_realloc}, an implementation may provide multiple symmetric heaps | ||
| associated with memory \emph{spaces} (see Section~\ref{subsec:space}). The | ||
| legacy routines operate on the default symmetric heap, which aliases | ||
| \LibHandleRef{SHMEM\_SPACE\_DEFAULT}, while the space-specific routines | ||
| \FUNC{shmem\_space\_malloc}, \FUNC{shmem\_space\_calloc}, and | ||
| \FUNC{shmem\_space\_free} operate on the symmetric heap associated with a | ||
| given \CTYPE{shmem\_space\_t} handle. | ||
|
|
||
| The legacy symmetric memory allocation routines differ from the private heap | ||
| allocation routines in that they must be called by all \acp{PE} in | ||
| the world team. When specified, each of these routines includes at | ||
| least one call to a procedure that is semantically equivalent to | ||
| \FUNC{shmem\_barrier\_all}. This ensures that all \acp{PE} | ||
| participate in the memory management, and that the memory on other | ||
| \acp{PE} can be used as soon as the local \ac{PE} returns. The | ||
| implicit barriers performed by these routines quiet the default | ||
| implicit barriers performed by these legacy routines quiet the default | ||
| context. It is the user's responsibility to ensure that no | ||
| communication operations involving the given memory block are pending | ||
| on other contexts prior to calling the \FUNC{shmem\_free} and | ||
| \FUNC{shmem\_realloc} routines. | ||
|
|
||
| The total size of the symmetric heap is determined at job startup. One can | ||
| specify the size of the heap using the \ENVVAR{SHMEM\_SYMMETRIC\_SIZE} environment | ||
| variable (where available). | ||
| The space-specific allocation routines are collective on the team | ||
| associated with the space handle and, where applicable, include a call | ||
| that is semantically equivalent to \FUNC{shmem\_team\_sync} on exit. | ||
|
|
||
| The total size of each symmetric heap is determined at job startup. The size of | ||
| the default symmetric heap can be controlled with the | ||
| \ENVVAR{SHMEM\_SYMMETRIC\_SIZE} environment variable (where available). The | ||
| sizes of device-specific spaces can be controlled with | ||
| \ENVVAR{SHMEM\_<DEVICE>\_SYMMETRIC\_SIZE}; when | ||
| \LibHandleRef{SHMEM\_SPACE\_DEFAULT} aliases to | ||
| \LibHandleRef{SHMEM\_SPACE\_<DEVICE>}, the device-specific variable takes | ||
| precedence. Availability of device spaces may be controlled with | ||
| \ENVVAR{SHMEM\_ENABLE\_<DEVICE>}. | ||
|
|
||
| \begin{DeprecateBlock} | ||
| As of \openshmem[1.2] the use of \FUNC{shmalloc}, \FUNC{shmemalign}, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,16 @@ | |
| numbering through team-based contexts. | ||
| \end{enumerate} | ||
|
|
||
| \item \textbf{Space Management} | ||
| \begin{enumerate} | ||
| \item \OPR{Spaces}: Spaces are containers for symmetric memory in specific memory | ||
| domains. They provide the storage for \openshmem symmetric data objects and | ||
| define accessibility and operational properties of those objects. Allocations | ||
| within a space are collective and symmetric across the \acp{PE} for which the | ||
| space is available. Collective and communication operations operate on data | ||
| resident in one or more spaces as permitted by the implementation | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing a period. |
||
| \end{enumerate} | ||
|
|
||
| \item \textbf{\acf{RMA}} | ||
| \begin{enumerate} | ||
| \item \PUT: The local \ac{PE} specifies the \source{} data object, private | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| \apisummary{ | ||
| Collectively allocate a zeroed block of symmetric memory in a specific space. | ||
| } | ||
|
|
||
| \begin{apidefinition} | ||
|
|
||
| \begin{Csynopsis} | ||
| void *@\FuncDecl{shmem\_space\_calloc}@(shmem_space_t space, size_t count, size_t size); | ||
| \end{Csynopsis} | ||
|
|
||
| \begin{apiarguments} | ||
| \apiargument{IN}{space}{The space within which to allocate.} | ||
| \apiargument{IN}{count}{The number of elements to allocate.} | ||
| \apiargument{IN}{size}{The size in bytes of each element to allocate.} | ||
| \end{apiarguments} | ||
|
|
||
| \apidescription{ | ||
| The \FUNC{shmem\_space\_calloc} routine is a collective operation on the | ||
| team associated with \VAR{space}. It allocates a region of | ||
| remotely-accessible symmetric memory for an array of \VAR{count} objects of | ||
| \VAR{size} bytes each from the symmetric heap identified by \VAR{space}, and | ||
| returns the symmetric address of the lowest byte of the allocated symmetric | ||
| memory. The space is initialized to all bits zero. | ||
|
|
||
| If the allocation succeeds, the pointer returned shall be suitably aligned so | ||
| that it may be assigned to a pointer to any type of object. If the allocation | ||
| does not succeed, or either \VAR{count} or \VAR{size} is \CONST{0}, the | ||
| return value is a null pointer. | ||
|
|
||
| The values of the \VAR{space}, \VAR{count}, and \VAR{size} arguments must be | ||
| identical on all \acp{PE}; otherwise, the behavior is undefined. | ||
|
|
||
| When \VAR{count} or \VAR{size} is \CONST{0}, the \FUNC{shmem\_space\_calloc} | ||
| routine returns without performing a barrier; otherwise, | ||
| \FUNC{shmem\_space\_calloc} calls a procedure that is semantically | ||
| equivalent to \FUNC{shmem\_team\_sync} on exit. | ||
| } | ||
|
|
||
| \apireturnvalues{ | ||
| The \FUNC{shmem\_space\_calloc} routine returns the symmetric address of the | ||
| allocated space; otherwise, it returns a null pointer. | ||
| } | ||
|
|
||
| \end{apidefinition} | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| \apisummary{ | ||
| Collectively deallocate symmetric memory in a specific space. | ||
| } | ||
|
|
||
| \begin{apidefinition} | ||
|
|
||
| \begin{Csynopsis} | ||
| void @\FuncDecl{shmem\_space\_free}@(shmem_space_t space, void *ptr); | ||
| \end{Csynopsis} | ||
|
|
||
| \begin{apiarguments} | ||
| \apiargument{IN}{space}{Space handle from which ptr was allocated.} | ||
| \apiargument{IN}{ptr}{Symmetric address of an object in the given space.} | ||
| \end{apiarguments} | ||
|
|
||
| \apidescription{ | ||
| The \FUNC{shmem\_space\_free} routine is a collective operation on the | ||
| team associated with \VAR{space} that causes the block to which \VAR{ptr} | ||
| points to be deallocated, that is, made available for further | ||
| allocation. If \VAR{ptr} is a null pointer, no action is performed; | ||
| otherwise, \FUNC{shmem\_space\_free} calls a function equivalent to barrier on entry. | ||
| It is the user's responsibility to ensure that no communication | ||
| operations involving the given memory block are pending on other | ||
| communication contexts prior to calling \FUNC{shmem\_space\_free}. | ||
|
|
||
| The values of the \VAR{space} and \VAR{ptr} arguments must be identical on all | ||
| \acp{PE}; otherwise, the behavior is undefined. | ||
| } | ||
|
|
||
| \apireturnvalues{ | ||
| None. | ||
| } | ||
|
|
||
| \end{apidefinition} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| \apisummary{ | ||
| Collectively allocate symmetric memory in a specific space. | ||
| } | ||
|
|
||
| \begin{apidefinition} | ||
|
|
||
| \begin{Csynopsis} | ||
| void *@\FuncDecl{shmem\_space\_malloc}@(shmem_space_t space, size_t size); | ||
| \end{Csynopsis} | ||
|
|
||
| \begin{apiarguments} | ||
| \apiargument{IN}{space}{The space within which to allocate.} | ||
| \apiargument{IN}{size}{The size, in bytes, of a block to be | ||
| allocated from the space.} | ||
| \end{apiarguments} | ||
|
|
||
|
|
||
| \apidescription{ | ||
| The \FUNC{shmem\_space\_malloc} routine is a collective operation on the | ||
| team associated with \VAR{space} and returns the symmetric address of a | ||
| block of at least \VAR{size} bytes, which shall be suitably aligned | ||
| so that it may be assigned to a pointer to any type of object. | ||
| This block is allocated from the specific symmetric heap identified | ||
| by \VAR{space}. | ||
| When \VAR{size} is zero, the \FUNC{shmem\_space\_malloc} routine performs | ||
| no action and returns a null pointer; otherwise, | ||
| \FUNC{shmem\_space\_malloc} calls a procedure that is semantically equivalent | ||
| to \FUNC{shmem\_team\_sync} on exit. This ensures | ||
| that all \acp{PE} with access to the space participate | ||
| in the memory allocation, and that the object on other \acp{PE} can be used as soon as the local | ||
| \ac{PE} returns. | ||
| The values of the \VAR{space} and \VAR{size} arguments must be identical on all | ||
| \acp{PE}; otherwise, the behavior is undefined. | ||
| } | ||
|
|
||
| \apireturnvalues{ | ||
| The \FUNC{shmem\_space\_malloc} routine returns the symmetric address of | ||
| the allocated space; otherwise, it returns a null pointer. | ||
| } | ||
|
|
||
| \end{apidefinition} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this back in!!!