Skip to content

Commit 6613fc3

Browse files
committed
Fix some errors on Travis* Add oversubscribe option if needed* Clean exit on cman* oclint conflict on macOS
1 parent 443f2b1 commit 6613fc3

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

conf/travis-install-mpi.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ case "$os" in
1414
Darwin)
1515
brew update
1616
brew upgrade cmake
17+
brew cask uninstall oclint # Prevent conflict with gcc
1718
case "$MPI_IMPL" in
1819
mpich|mpich3)
1920
brew install mpich

src/cman.jl

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,12 @@ end
245245

246246
# Kill a worker
247247
function kill(mgr::MPIManager, pid::Int, config::WorkerConfig)
248-
# Do nothing, as the worker will self-terminate after calling MPI.Finalize
249-
Base.set_worker_state(Base.Worker(pid), Base.W_TERMINATED)
248+
# Exit the worker to avoid EOF errors on the workers
249+
@spawnat pid begin
250+
MPI.Finalize()
251+
exit()
252+
end
253+
Distributed.set_worker_state(Distributed.Worker(pid), Distributed.W_TERMINATED)
250254
end
251255

252256
# Set up a connection to a worker
@@ -418,14 +422,7 @@ end
418422
function stop_main_loop(mgr::MPIManager)
419423
if mgr.mode == TCP_TRANSPORT_ALL
420424
# Shut down all workers
421-
for i in workers()
422-
if i != myid()
423-
@spawnat i begin
424-
MPI.Finalize()
425-
exit()
426-
end
427-
end
428-
end
425+
rmprocs(workers())
429426
# Poor man's flush of the send queue
430427
sleep(1)
431428
put!(mgr.initiate_shutdown, nothing)

test/runtests.jl

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,34 @@ const coverage_opts =
1414
JL_LOG_USER => "user",
1515
JL_LOG_ALL => "all")
1616

17+
# Files to run without mpiexec
18+
juliafiles = ["test_cman_julia.jl"]
19+
# Files to run with mpiexec -n 1
20+
singlefiles = []
21+
1722
function runtests()
1823
nprocs = clamp(Sys.CPU_CORES, 2, 4)
1924
exename = joinpath(JULIA_HOME, Base.julia_exename())
2025
testdir = dirname(@__FILE__)
21-
istest(f) = endswith(f, ".jl") && f != "runtests.jl"
26+
istest(f) = endswith(f, ".jl") && startswith(f, "test_")
2227
testfiles = sort(filter(istest, readdir(testdir)))
28+
29+
extra_args = []
30+
if contains(readlines(open(`mpiexec --version`)[1])[1], "OpenRTE")
31+
push!(extra_args,"--oversubscribe")
32+
end
33+
2334
nfail = 0
2435
print_with_color(:white, "Running MPI.jl tests\n")
2536
for f in testfiles
2637
try
2738
coverage_opt = coverage_opts[Base.JLOptions().code_coverage]
28-
if f == "test_cman_julia.jl"
39+
if f singlefiles
40+
run(`mpiexec $extra_args -n 1 $exename --code-coverage=$coverage_opt $(joinpath(testdir, f))`)
41+
elseif f juliafiles
2942
run(`$exename --code-coverage=$coverage_opt $(joinpath(testdir, f))`)
3043
else
31-
run(`mpiexec -n $nprocs $exename --code-coverage=$coverage_opt $(joinpath(testdir, f))`)
44+
run(`mpiexec $extra_args -n $nprocs $exename --code-coverage=$coverage_opt $(joinpath(testdir, f))`)
3245
end
3346
Base.with_output_color(:green,STDOUT) do io
3447
println(io,"\tSUCCESS: $f")

test/test_cman_julia.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ using MPI
33

44
# Start workers via `mpiexec` that communicate among themselves via MPI;
55
# communicate with the workers via TCP
6-
mgr = MPI.MPIManager(np=4)
6+
if contains(readlines(open(`mpiexec --version`)[1])[1], "OpenRTE")
7+
mgr = MPI.MPIManager(np=4, mpirun_cmd=`mpiexec --oversubscribe -n 4`)
8+
else
9+
mgr = MPI.MPIManager(np=4)
10+
end
711
addprocs(mgr)
812

913
refs = []

0 commit comments

Comments
 (0)