-
Notifications
You must be signed in to change notification settings - Fork 30
Change MPI3 shared memory in Quest so it uses Umpire. #1652
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
Change MPI3 shared memory in Quest so it uses Umpire. #1652
Conversation
…ionality so it uses Umpire shared memory allocators.
…nce_interface when run on multiple ranks. Remove build logic to limit the test to 1 rank.
…mory via Umpire, as far as I can tell.
…3 shared memory support.
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.
Thanks @BradWhitlock
I had some questions/suggestions about config variables that I'd like to work through before merging, and also possibly about promoting the shared resource allocator logic to core instead of quest, but otherwise this looks great!
Thanks for fixing the umpire memory leak and the issue w/ scaling to more than one rank!
| depends_on("[email protected]", when="@0.6.0") | ||
| depends_on("umpire@5:5.0.1", when="@:0.5.0") | ||
| depends_on("umpire+openmp", when="+openmp") | ||
| depends_on("umpire+mpi3_shmem", when="+mpi") |
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.
Is mpi3_shmem always available when mpi is available?
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.
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.
I think its something like this:
depends_on("umpire+mpi3_shmem", when="+mpi ^mpi@3:")
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.
| if (${test_name} STREQUAL "quest_signed_distance_interface") | ||
| set(_numMPITasks 1) | ||
| endif() |
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.
👍
| MPI_Comm intra_node_comm = MPI_COMM_NULL; | ||
| MPI_Comm inter_node_comm = MPI_COMM_NULL; | ||
| create_communicators(global_comm, | ||
| intra_node_comm, |
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.
Do we still need to create extra communicators w/ the new allocator? Or (hopefully) does the new Umpire shared memory allocator allow us to simplify this?
…m:LLNL/axom into feature/whitlock/use_umpire_shared_memory
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.
Thanks for the updates @BradWhitlock!
My previous reservations related to the build system flags. I think the new #defines are a lot cleaner.
It'd be nice to centralize the shared memory allocation logic to memory_management.*pp in a follow-up, but I don't think it's required for this PR.
| cmake_dependent_option(AXOM_ENABLE_MPI3 "Enables use of MPI-3 features" OFF "ENABLE_MPI" OFF) | ||
| mark_as_advanced(AXOM_ENABLE_MPI3) | ||
|
|
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.
👍
| # Check whether the Umpire defines symbols for shared memory | ||
| blt_check_code_compiles(CODE_COMPILES UMPIRE_SHARED_MEMORY | ||
| VERBOSE_OUTPUT OFF | ||
| DEPENDS_ON umpire | ||
| SOURCE_STRING " | ||
| #include <umpire/config.hpp> | ||
| #if defined(UMPIRE_ENABLE_IPC_SHARED_MEMORY) || defined(UMPIRE_ENABLE_MPI3_SHARED_MEMORY) | ||
| int main() { return 0; } | ||
| #else | ||
| #error Macros not defined | ||
| #endif | ||
| ") | ||
| if (AXOM_ENABLE_MPI AND UMPIRE_SHARED_MEMORY) | ||
| set(AXOM_USE_UMPIRE_SHARED_MEMORY TRUE) | ||
| else() | ||
| set(AXOM_USE_UMPIRE_SHARED_MEMORY FALSE) | ||
| endif() | ||
| message(STATUS "Umpire supports shared memory: ${AXOM_USE_UMPIRE_SHARED_MEMORY}") |
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.
👍 -- interesting solution!
I thought it might involve checking properties of the umpire target.
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.
Thanks @BradWhitlock -- even better!
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.
Nice test!
src/axom/core/memory_management.cpp
Outdated
| { | ||
| int allocator_id = INVALID_ALLOCATOR_ID; | ||
| #if defined(AXOM_USE_UMPIRE_SHARED_MEMORY) | ||
| const std::string allocatorName("axom_named_allocator"); |
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.
Would it make sense to call this "axom_shared_allocator" ?
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.
or, looking a few lines down, should it be "axom_node_allocator"?
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.
In the Umpire examples, they first make a "node allocator" but then wrap it as a named allocator. From what I gather from their docs, this is to make the allocator compatible with their IPC shared memory logic. I renamed it to "axom_shared_allocator".
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.
Nice functionality @BradWhitlock !
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.
Thank you @BradWhitlock
|
I just want to add a note of caution. Right now, it can be confusing if Umpire's IPC Shared Memory and/or Umpire's MPI3 Shared Memory are turned on since they can be both supported. If IPC is explicitly enabled but MPI3 is not, then MPI3 is turned off and IPC is the default shared memory resource. If MPI3 is explicitly enabled but IPC is not, then MPI3 is the default shared memory resource, but IPC is still turned on (will need to explicitly turn off if you don't want it). If IPC is explicitly enabled and MPI3 is explicitly enabled, then MPI3 is the default shared memory resource. (This all assumes MPI itself is enabled.) The "default shared memory resource" is what is used when you only specify "SHARED". To avoid confusion, I would highly recommend using |
|
Specifically, I discovered today that our recipe_naming_shim example is broken. When I enable IPC and MPI3 shared memory, it keeps trying to use MPI3 even if I do So again, I encourage caution here and to be as explicit as possible. |
…d shared memory allocator. Add cmake status message for value of UMPIRE_DEFAULT_SHARED_MEMORY_RESOURCE.
…m:LLNL/axom into feature/whitlock/use_umpire_shared_memory
This PR resolves #1058 by migrating direct MPI3 calls to suitable Umpire shared memory replacements. These changes are all in quest and are part of the
signed_distancefunctionality.+mpiis given (tpls and host-configs are not updated)