Skip to content

Commit

Permalink
Use variables instead of hard-coded mpirun -np (doctest#689)
Browse files Browse the repository at this point in the history
CMake's `FindMPI` module sets `MPIEXEC_EXECUTABLE` and `MPIEXEC_NUMPROC_FLAG`. We use them so it works for different MPI implementations.
  • Loading branch information
KiruyaMomochi authored and onqtam committed Feb 27, 2023
1 parent 8abfc84 commit 0a8a06e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/mpi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 0a8a06e

Please sign in to comment.