Skip to content

Commit b02d247

Browse files
committed
Disable automatic MPI linkage
1 parent 7fccd11 commit b02d247

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1818

1919
### Changed
2020
- The tian2019 composition model now returns a mass fraction instead of a mass percentage. \[Daniel Douglas; 2024-11-12; [#767](https://github.com/GeodynamicWorldBuilder/WorldBuilder/pull/767)\]
21+
- Only link to MPI libraries if the cmake variable USE_MPI has been set. No longer automatically link to MPI if MPI is found. \[Rene Gassmoeller; 2025-01-20; [#792](https://github.com/GeodynamicWorldBuilder/WorldBuilder/pull/792)\]
22+
2123
### Fixed
2224

2325
## [1.0.0]

CMakeLists.txt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,19 @@ else()
9494
message(STATUS "SWIG was not found, disabling python wrapper compilation.")
9595
endif()
9696

97+
# Check if MPI is requested
98+
set(USE_MPI OFF CACHE BOOL "Whether or not to enable MPI when compiling the world builder. MPI is optional.")
9799

98-
# Find MPI if available.
99-
find_package(MPI)
100+
if(USE_MPI)
101+
# Find MPI if available.
102+
find_package(MPI)
100103

101-
if(MPI_FOUND AND ${CMAKE_VERSION} VERSION_GREATER "3.9.0" )
102-
message(STATUS "MPI found.")
103-
set(USE_MPI ON CACHE BOOL "Whether or not to enable MPI when compiling the world builder.")
104-
else()
105-
message(STATUS "MPI not found or cmake version lower than 3.9.0.")
106-
set(USE_MPI OFF CACHE BOOL "Whether or not to enable MPI when compiling the world builder." FORCE)
104+
if(MPI_FOUND AND ${CMAKE_VERSION} VERSION_GREATER "3.9.0" )
105+
message(STATUS "MPI found.")
106+
else()
107+
message(STATUS "MPI not found or cmake version lower than 3.9.0.")
108+
set(USE_MPI OFF CACHE BOOL "Whether or not to enable MPI when compiling the world builder. MPI is optional." FORCE)
109+
endif()
107110
endif()
108111

109112
if(USE_MPI)

doc/sphinx/user_manual/installation/installing_prerequisites.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Installing the prerequisites
44

55
When installing the World Builder on a system, make sure CMake is installed.
66
If you want a Fortran wrapper, then also make sure a Fortran compiler is installed (GFortran is the preferred option, but other Fortran compilers should work as well).
7-
If you want a Python interface, make sure you have Python 3 installed.
7+
If you want a Python interface, make sure you have Python 3 installed. Some World Builder apps can make use of MPI parallelization, although the main library generally makes no use of it. If you want to use MPI parallelization in the apps make sure that a MPI library *including its development header files* is installed on your system.
88

99
There are many ways to install the prerequisites of the World Builder per operating system.
1010
For each system, we show some options which we know work.
@@ -17,6 +17,7 @@ If it doesn't work for your system, please let us know through GitHub issues (<h
1717
3. Set the environment variables using `export CC=gcc; export CXX=g++;`.
1818
4. (Optional) For a Fortran wrapper, run `sudo apt install gFortran`.
1919
5. (Optional) For a Python wrapper, run `sudo apt install swig python3-setuptools`.
20+
6. (Optional) For MPI parallelization, run `sudo apt install libopenmpi-dev`.
2021

2122
:::::
2223

doc/sphinx/user_manual/installation/stand_alone_install.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,20 @@ Stand-alone installation with all apps
1212
::::{tab-set}
1313
:::{tab-item} For Windows with Visual Studio
1414
6. Run CMake by entering: `cmake MAKE_FILE_GENERATOR="Visual Studio 15 2017 Win64"..`, or the version of Visual Studio you have installed, and make sure CMake finds all the dependencies.
15-
7. For production runs, set build type to release by entering `-DCMAKE_BUILD_TYPE=Release`.
16-
8. Run make with the amount of threads you want to use (e.g., use 8 processes: `make -j 8`).
17-
9. If you want the Geodynamic World Builder to be installed on your system, run `cmake -build . -target install -j 8`
18-
10. Run the tests to make sure everything is installed correctly (`cmake -build . -target run_tests -j 8`).
15+
7. If you want to make use of MPI parallelism in the stand-alone apps, add `-DUSE_MPI=ON` to the cmake command of 6.
16+
8. For production runs, set build type to release by adding `-DCMAKE_BUILD_TYPE=Release` to the cmake command of 6.
17+
9. Run make with the amount of threads you want to use (e.g., use 8 processes: `make -j 8`).
18+
10. If you want the Geodynamic World Builder to be installed on your system, run `cmake -build . -target install -j 8`
19+
11. Run the tests to make sure everything is installed correctly (`cmake -build . -target run_tests -j 8`).
1920
:::
2021

2122
:::{tab-item} For all other configurations
2223
6. Run CMake by entering: `cmake ..` and make sure CMake finds all the dependencies.
23-
7. For production runs, set build type to release by entering `make release`.
24-
8. Run make with the amount of threads you want to use (e.g., use 8 processes: `make -j 8`).
25-
9. If you want the Geodynamic World Builder to be installed on your system, run `sudo make install -j 4`
26-
10. Run the tests to make sure everything is installed correctly (`ctest`).
24+
7. If you want to make use of MPI parallelism in the stand-alone apps, add `-DUSE_MPI=ON` to the cmake command of 6.
25+
8. For production runs, set build type to release by entering `make release`.
26+
9. Run make with the amount of threads you want to use (e.g., use 8 processes: `make -j 8`).
27+
10. If you want the Geodynamic World Builder to be installed on your system, run `sudo make install -j 4`
28+
11. Run the tests to make sure everything is installed correctly (`ctest`).
2729
:::
2830
::::
2931

0 commit comments

Comments
 (0)