From 4a790ecb4522b62bf0f032262fd846370ef7bf74 Mon Sep 17 00:00:00 2001 From: Tucker Hartland Date: Thu, 6 Feb 2025 11:04:38 -0800 Subject: [PATCH] updating CMake file, including an option to use srun in order to run tests on machines that use the slurm scheduler and wherein mpirun is not available (#707) --- CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f0422167..3b10c505 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ option(HIOP_USE_EIGEN "Build with Eigen support" ON) option(HIOP_USE_MPI "Build with MPI support" ON) option(HIOP_USE_GPU "Build with support for GPUs - CUDA or HIP libraries" OFF) option(HIOP_TEST_WITH_BSUB "Use `jsrun` instead of `mpirun` commands when running tests" OFF) +option(HIOP_TEST_WITH_SLURM "Use `srun` instead of `mpirun` commands when running tests" OFF) option(HIOP_USE_RAJA "Build with portability abstraction library RAJA" OFF) option(HIOP_USE_AXOM "Build with AXOM to use Sidre for scalable checkpointing" OFF) option(HIOP_DEEPCHECKS "Extra checks and asserts in the code with a high penalty on performance" OFF) @@ -480,9 +481,15 @@ if(HIOP_TEST_WITH_BSUB) set(RUNCMD ${RUNCMD} "-g" "1") endif() else() - set(MPICMD "mpirun") +# If running on a slurm scheduler, use srun command to make sure we are +# requesting the correct resources. + if(HIOP_TEST_WITH_SLURM) + set(MPICMD "srun") + else() + set(MPICMD "mpirun") + endif() if(HIOP_USE_MPI) - set(RUNCMD "mpirun" "-n" "1") + set(RUNCMD ${MPICMD} "-n" "1") set(RUNCMD ${RUNCMD} ${HIOP_EXTRA_MPI_FLAGS}) set(MPICMD ${MPICMD} ${HIOP_EXTRA_MPI_FLAGS}) else()