Skip to content

Commit cf580ee

Browse files
authored
support -launcher=fork for mpi (#392)
1 parent deed560 commit cf580ee

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
run: srun -p pvc-shared scripts/devcloud-build.sh
106106
- name: Test
107107
# mpi does not like the way SLURM sets environment variables
108-
run: srun -p pvc-shared /usr/bin/env -i scripts/devcloud-run.sh
108+
run: srun -p pvc-shared scripts/devcloud-run.sh
109109

110110
publish:
111111
needs: [checks, clang, gcc, icpx]

CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
2020
option(ENABLE_SYCL "Build sycl shp examples" OFF)
2121
option(ENABLE_CUDA "Build for cuda" OFF)
2222
option(ENABLE_FORMAT "Build with format library" ON)
23+
option(ENABLE_MPIFORK "Use MPI fork launcher" OFF)
2324
option(GCC_TOOLCHAIN, "GCC toolchain to be used by clang-based compilers" OFF)
2425

2526
#
@@ -28,6 +29,10 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
2829
set(CMAKE_CXX_EXTENSIONS OFF)
2930
set(CMAKE_CXX_STANDARD 20)
3031

32+
if(ENABLE_MPIFORK)
33+
set(MPIEXEC_LAUNCHFLAGS "-launcher=fork")
34+
endif()
35+
3136
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
3237
add_compile_options(-fconcepts-diagnostics-depth=10)
3338
endif()
@@ -142,9 +147,12 @@ FetchContent_Declare(
142147
FetchContent_MakeAvailable(mdspan)
143148

144149
function(add_mpi_test test_name name processes)
145-
add_test(NAME ${test_name}
146-
COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${processes}
147-
${MPIEXEC_PREFLAGS} ./${name} ${ARGN} COMMAND_EXPAND_LISTS)
150+
add_test(
151+
NAME ${test_name}
152+
COMMAND
153+
${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${processes}
154+
${MPIEXEC_PREFLAGS} ${MPIEXEC_LAUNCHFLAGS} ./${name} ${ARGN}
155+
COMMAND_EXPAND_LISTS)
148156
endfunction()
149157

150158
install(DIRECTORY include DESTINATION ${CMAKE_INSTALL_PREFIX})

scripts/devcloud-build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
set -e
88
hostname
99
source /opt/intel/oneapi/setvars.sh
10-
cmake -B build -DENABLE_SYCL=on
10+
# devcloud requires --launcher=fork for mpi
11+
cmake -B build -DENABLE_SYCL=on -DENABLE_MPIFORK=on
1112
make -C build -j

scripts/devcloud-run.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ set -e
88
hostname
99
source /opt/intel/oneapi/setvars.sh
1010

11-
# we clear the environment to make mpi work, add back error output
12-
export CTEST_OUTPUT_ON_FAILURE=1
13-
1411
# default sycl device will be GPU, if available. Only use 1 GPU:
1512
# workaround for devcloud multi-card not working
1613
ONEAPI_DEVICE_SELECTOR=level_zero:0 make -C build test

0 commit comments

Comments
 (0)