ompi/info: introduce support for the mpi_memory_alloc_kinds info object #13054
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces support for the
mpi_memory_alloc_kinds
andmpi_assert_memory_alloc_kinds
info objects as defined in the MPI 4.1 document and in the side document specifying the values for the three supported accelerator kinds.The logic is surprisingly twisted and I would not be surprised if some of the code here would have to be revised over time.
There are two ways on how the user can specify the
mpi_memory_alloc_kinds
info object: either as a runtime argument tompiexec
, namely-memory-alloc-kinds
, or as part of the info-object passed toMPI_Session_init
. There are two predefined memor-alloc-kinds, namelysystem
andmpi
, the latter having three potential restrictors. When user retrieves the info object e.g. usingMPI_Comm_get_info
onMPI_COMM_WORLD
, the MPI library is allowed to return more memory-kinds than requested by the user.This freedom has been applied in the following manner here:
system
and/ormpi
memory-alloc-kinds, we add them to the list of provided memkinds, in the case thempi
memory-alloc-kind fully spelled out with all three restrictors.This default memkind support is applied to all new {Comm/File/Window} objects, unless the user sets
mpi_assert_memory_alloc_kinds
during object creation (e.g.MPI_Comm_dup_with_info
orMPI_File_open
). The user can restrict the memory kinds supported by the object withmpi_assert_memory_alloc_kinds
, i.e. setting this info object will influencempi_memory_alloc_kinds
on that object. I am not sure whether there is another example in the MPI spec where providing one info object influences the value of another info object, but the MPI 4.1 specification is pretty clear in my understanding that this is what is expected to happen.Another difference in the handling of
mpi_assert_memory_alloc_kinds
is that if a provided value is not recognized, the entirempi_assert_memory_alloc_kinds
is dropped/ignored, not just the unrecognized memkind itself. (This is my reading of the specification on what is expected to happen).Lastly, there could probably be some discussion whether the location chosen for the majority of the code is appropriate (i.e. ompi/info), a directory which so-far has contained the code to manage the
MPI_Info
object in general. After some discussion I thought this is the most appropriate locations, since