Skip to content
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

Issue 296.make test mpi #613

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 16 additions & 4 deletions common/cmake/ALPSEnableTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
# check xml output
option(TestXMLOutput "Output tests to xml" OFF)

# default number of MPI processes for MPI testing
set(ALPS_TEST_MPI_NPROC 1 CACHE STRING "Default number of MPI processes to use for MPI-enabled tests")

# Find gtest or otherwise fetch it into the build_dir/gtest
function(UseGtest gtest_root)
#set (gtest_root ${ALPS_ROOT_DIR}/../common/deps/gtest-1.7.0)
Expand Down Expand Up @@ -120,10 +123,19 @@ function(alps_add_gtest test)
set(run_ok_cmd_ "$<TARGET_FILE:${test}> ${test_xml_output_}")
set(shell_cmd_ "if ${build_cmd_}\; then ${run_fail_cmd_}\; false\; else ${run_ok_cmd_}\; fi")
set(cmd_ "/bin/sh" "-c" "${shell_cmd_}")
elseif (arg_PARTEST AND MPIEXEC)
# FIXME: if compiler supports MPI directly, the MPIEXEC program is not deduced!
# FIXME: in the MPI test command, POSIX shell is assumed
set(cmd_ "/bin/sh" "-c" "${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} \${ALPS_TEST_MPI_NPROC:-1} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${test}> ${MPIEXEC_POSTFLAGS} ${test_xml_output_}")
elseif (arg_PARTEST AND ALPS_HAVE_MPI)
# if unspecified, we assume the standard mpi launcher, according to MPI-3.1 specs, Chapter 8.8
# (see https://www.mpi-forum.org/docs/mpi-3.1/mpi31-report/node228.htm#Node228)
if (NOT DEFINED MPIEXEC)
set(MPIEXEC "mpiexec")
endif()
if (NOT DEFINED MPIEXEC_NUMPROC_FLAG)
set(MPIEXEC_NUMPROC_FLAG "-n")
endif()

# we also allow test-time override of the MPI launcher and its arguments
# (NOTE: POSIX shell is assumed)
set(cmd_ "/bin/sh" "-c" "\${ALPS_TEST_MPIEXEC:-${MPIEXEC}} \${ALPS_TEST_MPI_NPROC_FLAG:-${MPIEXEC_NUMPROC_FLAG}} \${ALPS_TEST_MPI_NPROC:-${ALPS_TEST_MPI_NPROC}} \${ALPS_TEST_MPIEXEC_PREFLAGS:-${MPIEXEC_PREFLAGS}} $<TARGET_FILE:${test}> \${ALPS_TEST_MPIEXEC_POSTFLAGS:-${MPIEXEC_POSTFLAGS}} ${test_xml_output_}")
else()
set(cmd_ $<TARGET_FILE:${test}> ${test_xml_output_})
endif()
Expand Down