Skip to content

Commit c06ae32

Browse files
authored
CMake Config: NOMPI (#5510)
## Summary CMake package variants are opt-in. Since AMReX MPI and no-MPI builds are binary incompatible, users might want to `REQUIRE` to select a no-MPI build. This adds the respective option for them to use in `find_package(AMReX COMPONENTS ...)`. ## Additional background This is useful when both an MPI and no-MPI variant are in the users install path. While generally useful for other binary build options as well, MPI is the most critical and common option where we need to provide this. ## Checklist The proposed changes: - [ ] fix a bug or incorrect behavior in AMReX - [x] add new capabilities to AMReX - [ ] changes answers in the test suite to more than roundoff level - [ ] are likely to significantly affect the results of downstream AMReX users - [ ] include documentation in the code and/or rst files, if appropriate
1 parent 970b6af commit c06ae32

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Docs/sphinx_documentation/source/BuildingAMReX.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ A list of AMReX component names and related configure options are shown in the t
725725
+------------------------------+-----------------+
726726
| AMReX_PIC | PIC |
727727
+------------------------------+-----------------+
728-
| AMReX_MPI | MPI |
728+
| AMReX_MPI | MPI, NOMPI |
729729
+------------------------------+-----------------+
730730
| AMReX_SIMD | SIMD |
731731
+------------------------------+-----------------+

Tools/CMake/AMReXConfig.cmake.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${AMReX_MODULE_PATH})
6161
6262
# General options
6363
set(AMReX_MPI_FOUND @AMReX_MPI@)
64+
if(AMReX_MPI_FOUND) # ensure users can request a no-MPI variant
65+
set(AMReX_NOMPI_FOUND FALSE)
66+
else()
67+
set(AMReX_NOMPI_FOUND TRUE)
68+
endif()
6469
set(AMReX_MPI_THREAD_MULTIPLE_FOUND @AMReX_MPI_THREAD_MULTIPLE@)
6570
set(AMReX_SIMD_FOUND @AMReX_SIMD@)
6671
set(AMReX_OMP_FOUND @AMReX_OMP@)

0 commit comments

Comments
 (0)