diff options
author | 百地 希留耶 <65301509+KiruyaMomochi@users.noreply.github.com> | 2022-10-01 19:49:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-01 19:49:55 +0300 |
commit | f5d122b5b269340d6397919ab303164a5a1e0e10 (patch) | |
tree | f16acec6f914c76d462a9e4af158c3e54286b992 | |
parent | ddd12fefbeb9e4163e5f659908138ecee0a52aa2 (diff) |
Use variables instead of hard-coded `mpirun` `-np` (#689)
CMake's `FindMPI` module sets `MPIEXEC_EXECUTABLE` and `MPIEXEC_NUMPROC_FLAG`. We use them so it works for different MPI implementations.
-rw-r--r-- | examples/mpi/CMakeLists.txt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/mpi/CMakeLists.txt b/examples/mpi/CMakeLists.txt index 4f99cd2a..2d929f5f 100644 --- a/examples/mpi/CMakeLists.txt +++ b/examples/mpi/CMakeLists.txt @@ -3,5 +3,5 @@ if(MPI_FOUND) add_executable(test_mpi main.cpp mpi.cpp) target_link_libraries(test_mpi doctest ${CMAKE_THREAD_LIBS_INIT} MPI::MPI_CXX) - doctest_add_test(NO_OUTPUT NAME test_mpi COMMAND mpirun -np 3 $<TARGET_FILE:test_mpi>) + doctest_add_test(NO_OUTPUT NAME test_mpi COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 3 $<TARGET_FILE:test_mpi>) endif() |