Skip to content

Commit

Permalink
[mpiexecjl] Return exit code of the mpiexec process (#834)
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano authored Jun 14, 2024
1 parent d2c81c0 commit 2f88c97
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bin/mpiexecjl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ fi
SCRIPT='
using MPI
ENV["JULIA_PROJECT"] = dirname(Base.active_project())
mpiexec(exe -> run(`$exe $ARGS`))
proc = run(pipeline(`$(mpiexec()) $(ARGS)`; stdout, stderr); wait=false)
wait(proc)
if !iszero(proc.exitcode)
@error "The MPI process failed" proc
end
exit(proc.exitcode)
'

if [ -n "${PROJECT_ARG}" ]; then
Expand Down
5 changes: 5 additions & 0 deletions test/mpiexecjl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,10 @@ using MPI
# Without arguments, or only with the `--project` option, the wrapper will fail
@test !withenv(() -> success(`$(mpiexecjl) --project=$(dir)`), env...)
@test !withenv(() -> success(`$(mpiexecjl)`), env...)
# Test that the wrapper exits with the same exit code as the MPI process
exit_code = 10
p = run(`$(mpiexecjl) -n $(nprocs) --project=$(dir) $(julia) --startup-file=no -e "exit($(exit_code))"`; wait=false)
wait(p)
@test p.exitcode == exit_code
end
end

0 comments on commit 2f88c97

Please sign in to comment.