need better support for setting command line flags for mpi tests
- Dominant language
- C++
- Stars
- 296
- Forks
- 66
- Avg merge
- 1h 3m
- Merged PRs (30d)
- 1
Description
Ran into a fun issue in a docker container, openmpi won't let mpiexec run if you are root:
```
debug/tests/blt_mpi_smoke"
3: Test timeout computed to be: 1500
3: --------------------------------------------------------------------------
3: mpiexec has detected an attempt to run as root.
3:
3: Running as root is *strongly* discouraged as any mistake (e.g., in
3: defining TMPDIR) or bug can result in catastrophic damage to the OS
3: file system, leaving your system in an unusable state.
3:
3: We strongly suggest that you run mpiexec as a non-root user.
3:
3: You can override this protection by adding the --allow-run-as-root
3: option to your command line. However, we reiterate our strong advice
3: against doing so - please do so at your own risk.
3: --------------------------------------------------------------------------
1/1 Test #3: blt_mpi_smoke ....................***Failed 0.00 sec
```
I tried to insert some extra args into my mpi tests via MPIEXE MPIEXEC_NUM_PROCS_FLAGS, etc
but b/c of how we are constructing the test command in blt all attempts failed.
```
# Handle mpi
if ( ${arg_NUM_MPI_TASKS} )
set(test_command ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${arg_NUM_MPI_TASKS} ${test_command} )
endif()
```
I think since all of those are discrete args, any injection of spaces undermines us.
CMake's FindMPI also provides:
```
MPIEXEC_PREFLAGS
MPIEXEC_POSTFLAGS
```
We should consider using them.
Contributor guide
Research direction
Search the BLT CMake test-generation code for the shown “Handle mpi” block and inspect how MPIEXEC and related arguments are assembled. Compare that behavior with CMake’s FindMPI MPIEXEC_PREFLAGS and MPIEXEC_POSTFLAGS. Done means MPI tests can pass command-line flags such as --allow-run-as-root without breaking argument boundaries, and the blt_mpi_smoke test can use them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake
- Domain
- build-system, hpc, testing-qa
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100