I use MPIEXEC_PREFLAGS
when adding a test as described in the FindMPI documentation. For example:
add_test(
NAME mytest
COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 4
${MPIEXEC_PREFLAGS} mytest ${MPIEXEC_POSTFLAGS}
)
When configuring with -D MPIEXEC_PREFLAGS="--bind-to none"
I find that the test command above fails because the following command is generated:
mpiexec "-n" "4" "--bind-to none" mytest
and "--bind-to none"
is the point of failure. What does work is -D MPIEXEC_PREFLAGS="--bind-to;none"
which generates the following command:
mpiexec "-n" "4" "--bind-to" "none" mytest
Note that "--bind-to none"
is now "--bind-to" "none"
.
This issue is further complicated in the context of CI when setting the CTEST_CONFIGURE_COMMAND
in my ctest script. The closest I’ve cometo getting it right is:
set(CTEST_CONFIGURE_COMMAND "cmake -D MPIEXEC_PREFLAGS=\"--bind-to;none\""
which gives the following output when running `ctest -VV -S myscript.cmake:
Configure with command: cmake -D MPIEXEC_PREFLAGS="--bind-to;none"
Run command: "cmake" "-D" "MPIEXEC_PREFLAGS="--bind-to;none""
First, I wonder if I should use MPIEXEC_PREFLAGS
this way - I don’t see any strict guidance in the documentation on how to use the variable.
If I am using it (and not abusing it), then how do I fix the quotation nightmare?
Thanks!