12.4.3. Memory Allocation Info

PreviousUpNext
Up: Common Elements of Both Process Models Next: Portable MPI Process Startup Previous: Aborting MPI Processes

Computing systems contain memory with different properties, including differences in performance, persistence, access permissions, or access mode. These distinct memories are generally allocated using distinct mechanisms and are referred to as memory allocation kinds that are named according to the method of allocation. The following info keys can be used to request or query the memory allocation kinds supported by the MPI library and to assert application usage of memory allocation kinds with respect to specific MPI objects, as shown in Example Memory Allocation Info.

"mpi_memory_alloc_kinds" (string, default: "mpi,system"):
A comma separated list of memory allocation kinds. When set on the input info object in a call to MPI_SESSION_INIT, MPI_COMM_SPAWN, or MPI_COMM_SPAWN_MULTIPLE, or when supplied as an argument to an MPI startup mechanism, this info key requests support for the specified memory allocation kinds.

When returned by MPI, this info key indicates the memory allocation kinds supported by the MPI library on the given session, MPI object, or objects derived from the World Model. This info key does not affect the kind of memory allocated by MPI, e.g., in a call to MPI_ALLOC_MEM or MPI_WIN_ALLOCATE. A value corresponding to the empty string represents no memory allocation kinds.

"mpi_assert_memory_alloc_kinds" (string, not set by default):
A comma separated list of memory allocation kinds that the calling MPI process will use with the given MPI object. A value corresponding to the empty string represents no memory allocation kinds.


The mpi_memory_alloc_kinds info key is used both for requesting and querying support for memory allocation kinds from the MPI library.

When supplied to MPI_SESSION_INIT, this info key requests support for memory allocation kinds for all objects that will be derived from the new session. This info hint can also be supplied through an argument to an MPI startup mechanism. In the Sessions Model, this behaves as though the mpi_memory_alloc_kinds info key with the given value was supplied in the info argument in calls to MPI_SESSION_INIT. A value of mpi_memory_alloc_kinds supplied in the info argument to MPI_SESSION_INIT takes precedence over a value supplied as an argument to an MPI startup mechanism.

In the World Model, an info hint passed to an MPI startup mechanism requests support for memory allocation kinds for all objects derived from the World Model. This info hint can also be supplied to MPI_COMM_SPAWN or MPI_COMM_SPAWN_MULTIPLE in the World Model. This requests support for memory allocation kinds for all objects derived from the World Model in the spawned MPI process or MPI processes.

When returned by MPI_SESSION_GET_INFO, this info key indicates the memory allocation kinds supported by the MPI library on the given session. When returned in MPI_INFO_ENV, this info key indicates the memory allocation kinds supported by the MPI library for all objects derived from the World Model.

If mpi_memory_alloc_kinds was supplied during session creation, then the value of the corresponding key in the info object returned by MPI_SESSION_GET_INFO must include all requested memory allocation kinds that are supported. The substrings that indicate support for these memory allocation kinds must be identical to those supplied by the user. MPI may also return additional memory allocation kinds that were not requested by the user. The order of the memory allocation kinds returned through this info key is undefined.


Rationale.

MPI libraries may have implementation-specific mechanisms (e.g., environment variables) that control the supported memory allocation kinds. Allowing implementations to return additonal memory allocation kinds provides for compatibility with such mechanisms. ( End of rationale.)
The mpi_memory_alloc_kinds info key must also be contained in the info object returned by MPI_COMM_GET_INFO, MPI_WIN_GET_INFO, and MPI_FILE_GET_INFO. If the communicator, window, or file is derived from the World Model, the value of this info key must be identical to the value of this info key in MPI_INFO_ENV unless the user has asserted that support for memory allocation kinds can be restricted by setting mpi_assert_memory_alloc_kinds on that communicator, window, or file. If the communicator, window, or file is derived from the Sessions Model, the value of this info key must be identical to the value of this info key in the info object returned by MPI_SESSION_GET_INFO for that session unless the user has asserted that support for memory allocation kinds can be restricted by setting mpi_assert_memory_alloc_kinds on that communicator, window, or file.

When the user sets the mpi_assert_memory_alloc_kinds info key on the input info object for communicator creation, including via MPI_COMM_SPAWN or MPI_COMM_SPAWN_MULTIPLE, window creation, or file creation the implementation may assume that the memory for all communication buffers passed to MPI operations performed by the calling MPI process on the newly created MPI object will use only the memory allocation kinds listed in the value string. If the MPI library does not support one or more of the allocation kinds associated with the mpi_assert_memory_alloc_kinds info key, it will ignore this info key. When an MPI library recognizes this info key, the value returned when querying this info key (e.g., through a call to MPI_COMM_GET_INFO) must be identical to the value supplied by the user. It is erroneous to pass a communication buffer with an unsupported memory allocation kind to an MPI routine.

Memory allocation kind strings are comma separated lists that follow the rules specified in Section The Info Object. Each element in the list is a memory allocation kind that is formatted as the name of the kind, followed by an optional colon separated list of restrictors. Whitespace is not permitted within the list of restrictors. For example, "kind_a:restrictor_1,kind_b:restrictor_1:restrictor_2,...".

Within a memory allocation kind string, a given kind may be listed more than once with different restrictors, e.g., "kind_a:restrictor_1,kind_a:restrictor_2". A given kind may also be listed more than once with fewer restrictors, e.g., "kind_a,kind_a:restrictor_1". A memory allocation kind with no restrictors indicates an unrestricted memory allocation kind. Each instance of a kind in the memory allocation kind string indicates a separate and potentially overlapping memory allocation kind. The following memory allocation kinds and restrictors are defined by MPI. This list may be extended by MPI side documents and implementations.


Restrictors for the "mpi" memory allocation kind:

Example mpi_memory_alloc_kinds,mpi_assert_memory_alloc_kindsThis example demonstrates the usage of memory allocation kinds info keys with the Sessions Model. It shows how support for additional memory allocation kinds can be requested, how supported memory allocation kinds can be queried, how to parse the list of supported memory allocation kinds, and how to assert that a subset of supported memory allocation kinds are used with operations on a specific communicator.

Image file


PreviousUpNext
Up: Common Elements of Both Process Models Next: Portable MPI Process Startup Previous: Aborting MPI Processes


Return to MPI-4.1 Standard Index
Return to MPI Forum Home Page

(Unofficial) MPI-4.1 of November 2, 2023
HTML Generated on November 19, 2023