-
Notifications
You must be signed in to change notification settings - Fork 188
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
Make unit tests respect Cmake MPIEXEC_*FLAGS #3221
Make unit tests respect Cmake MPIEXEC_*FLAGS #3221
Conversation
This commit makes the two cmake variables MPIEXEC_PREFLAGS and MPIEXEC_POSTFLAGS be taken into account in the cmdline of mpiexec-based unit tests. This commit changes
Codecov Report
@@ Coverage Diff @@
## python #3221 +/- ##
======================================
Coverage 85% 85%
======================================
Files 530 530
Lines 26025 26025
======================================
Hits 22156 22156
Misses 3869 3869 Continue to review full report at Codecov.
|
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.
To get the same MPI command line syntax in the entire project, the new flags could be added here:
espresso/maintainer/benchmarks/CMakeLists.txt
Lines 63 to 65 in fc08e8a
add_test(NAME ${BENCHMARK_TEST_NAME} | |
COMMAND ${MPIEXEC} ${MPIEXEC_OVERSUBSCRIBE} ${MPIEXEC_NUMPROC_FLAG} ${nproc} | |
${CMAKE_BINARY_DIR}/pypresso ${BENCHMARK_FILE} ${BENCHMARK_ARGUMENTS}) |
cmake/unit_test.cmake
Outdated
else() | ||
add_test(${TEST_NAME} ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${TEST_NUM_PROC} ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}) | ||
add_test(${TEST_NAME} ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${TEST_NUM_PROC} ${MPIEXEC_PREFLAGS} ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} ${MPIEXEC_POSTFLAGS}) |
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.
Lines 37 and 39 can probably be combined into one line by adding this construction on top of the file (before line 1):
espresso/testsuite/python/CMakeLists.txt
Lines 7 to 15 in fc08e8a
if(EXISTS ${MPIEXEC}) | |
# OpenMPI 3.0 and higher checks the number of processes against the number of CPUs | |
execute_process(COMMAND ${MPIEXEC} --version RESULT_VARIABLE mpi_version_result OUTPUT_VARIABLE mpi_version_output ERROR_VARIABLE mpi_version_output) | |
if (mpi_version_result EQUAL 0 AND mpi_version_output MATCHES "\\(Open(RTE| MPI)\\) ([3-9]\\.|1[0-9])") | |
set(MPIEXEC_OVERSUBSCRIBE "-oversubscribe") | |
else() | |
set(MPIEXEC_OVERSUBSCRIBE "") | |
endif() | |
endif() |
@jngrad thanks for your suggestions. Done. (I did not add the oversubscribe code at the beginning of the file but rather before the command line. Let me know if you want it at the beginning or if this is okay.) |
Moving the block to the top would avoid calling mpiexec in a subprocess every time a new test is configured. We already do it for the testsuite and benchmarks. This might also help refactoring the CMake logic in the future, by having only one occurrence of this block of code in the entire project, somewhere in the top-level CMake file after the MPI import. |
@jngrad that's definitely a good reason. I hadn't thought about that. |
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.
LGTM
bors r+ |
3212: Remove unused force reduction function r=fweik a=hirschsn The function `reduce_forces_sum` was made obsolete by a538ebb Fixes # Description of changes: - Remove unused function PR Checklist ------------ - [ ] Tests? - [ ] Interface - [ ] Core - [ ] Docs? 3221: Make unit tests respect Cmake MPIEXEC_*FLAGS r=jngrad a=hirschsn There are two cmake flags called MPIEXEC_PREFLAGS and MPIEXEC_POSTFLAGS. This commit makes the unit test include these two variables in the creation of the cmdlines. These variables are useful for passing parameters to mpiexec, e.g. MPIEXEC_PREFLAGS="--bind-to;none". Fixes # Description of changes: - PR Checklist ------------ - [ ] Tests? - [ ] Interface - [ ] Core - [ ] Docs? 3232: Particle data cleanup r=KaiSzuttor a=fweik Description of changes: - Removed unused functions and macro 3240: Benchmark: Ferrofluid benchmark (derived from LJ one) r=fweik a=RudolfWeeber I did not include it into the benchmark cmake target, as it is not such a common scenario outside the ICP Co-authored-by: Steffen Hirschmann <[email protected]> Co-authored-by: Florian Weik <[email protected]> Co-authored-by: Rudolf Weeber <[email protected]>
Build succeeded |
There are two cmake flags called MPIEXEC_PREFLAGS and MPIEXEC_POSTFLAGS.
This commit makes the unit test include these two variables in the creation of
the cmdlines. These variables are useful for passing parameters to mpiexec, e.g. MPIEXEC_PREFLAGS="--bind-to;none".
Fixes #
Description of changes:
PR Checklist