Skip to content

Commit 49d18e8

Browse files
authored
Switch JULIA_MPIEXEC_ARGS back to runtime and apply if JLL is used (#411)
Fixed #410.
1 parent 00a3f56 commit 49d18e8

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ env:
3232
- MPI_IMPL=none
3333
- MPI_IMPL=none
3434
JULIA_MPI_BINARY=OpenMPI_jll
35-
JULIA_MPIEXEC_TEST_ARGS="--oversubscribe"
35+
JULIA_MPIEXEC_ARGS="--oversubscribe"
3636
- MPI_IMPL=mpich
3737
JULIA_MPI_BINARY=system
3838
- MPI_IMPL=openmpi
3939
JULIA_MPI_BINARY=system
40-
JULIA_MPIEXEC_TEST_ARGS="--oversubscribe"
40+
JULIA_MPIEXEC_ARGS="--oversubscribe"
4141
- MPI_IMPL=intelmpi
4242
JULIA_MPI_BINARY=system
4343
- MPI_IMPL=mpich
@@ -46,7 +46,7 @@ env:
4646
- MPI_IMPL=openmpi
4747
JULIA_MPI_BINARY=system
4848
JULIA_MPI_ABI=unknown
49-
JULIA_MPIEXEC_TEST_ARGS="--oversubscribe"
49+
JULIA_MPIEXEC_ARGS="--oversubscribe"
5050

5151
matrix:
5252
allow_failures: # issue 262

deps/build.jl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ if haskey(ENV, "JULIA_MPIEXEC")
4646
if ENV["JULIA_MPIEXEC"] == ""
4747
delete!(config, "mpiexec")
4848
else
49-
config["mpiexec"] = [ENV["JULIA_MPIEXEC"], Base.shell_split(get(ENV, "JULIA_MPIEXEC_ARGS", ""))...]
49+
config["mpiexec"] = ENV["JULIA_MPIEXEC"]
5050
end
5151
update_config = true
5252
end
53+
5354

5455
if update_config
5556
open(config_toml, write=true) do f
@@ -67,7 +68,7 @@ if binary == "system"
6768
library = ["libmpi", "libmpi_ibm", "msmpi", "libmpich"]
6869
end
6970
path = get(config, "path", "")
70-
mpiexec = get(config, "mpiexec", [path == "" ? "mpiexec" : joinpath(path, "bin", "mpiexec")])
71+
mpiexec = get(config, "mpiexec", path == "" ? "mpiexec" : joinpath(path, "bin", "mpiexec"))
7172
abi = get(config, "abi", "")
7273

7374
const libmpi = find_library(library, path == "" ? [] : [joinpath(path, "lib")])
@@ -117,7 +118,7 @@ if binary == "system"
117118
const libmpi = $libmpi
118119
const mpiexec_cmd = $mpiexec_cmd
119120
const mpiexec_path = mpiexec_cmd[1]
120-
mpiexec(fn) = fn(mpiexec_cmd)
121+
_mpiexec(fn) = fn(mpiexec_cmd)
121122
$abi_incl
122123

123124
using Requires
@@ -141,12 +142,12 @@ elseif binary == ""
141142
deps = quote
142143
if Sys.iswindows()
143144
using MicrosoftMPI_jll
144-
const mpiexec = MicrosoftMPI_jll.mpiexec
145+
const _mpiexec = MicrosoftMPI_jll.mpiexec
145146
const mpiexec_path = MicrosoftMPI_jll.mpiexec_path
146147
include("consts_microsoftmpi.jl")
147148
else
148149
using MPICH_jll
149-
const mpiexec = MPICH_jll.mpiexec
150+
const _mpiexec = MPICH_jll.mpiexec
150151
const mpiexec_path = MPICH_jll.mpiexec_path
151152
include("consts_mpich.jl")
152153
end
@@ -166,7 +167,7 @@ elseif binary == "MPICH_jll"
166167
deps = quote
167168
using MPICH_jll
168169
include("consts_mpich.jl")
169-
const mpiexec = MPICH_jll.mpiexec
170+
const _mpiexec = MPICH_jll.mpiexec
170171
const mpiexec_path = MPICH_jll.mpiexec_path
171172
__init__deps() = nothing
172173
end
@@ -175,7 +176,7 @@ elseif binary == "OpenMPI_jll"
175176
deps = quote
176177
using OpenMPI_jll
177178
include("consts_openmpi.jl")
178-
const mpiexec = OpenMPI_jll.mpiexec
179+
const _mpiexec = OpenMPI_jll.mpiexec
179180
const mpiexec_path = OpenMPI_jll.mpiexec_path
180181

181182
function __init__deps()
@@ -190,7 +191,7 @@ elseif binary == "MicrosoftMPI_jll"
190191
deps = quote
191192
using MicrosoftMPI_jll
192193
include("consts_microsoftmpi.jl")
193-
const mpiexec = MicrosoftMPI_jll.mpiexec
194+
const _mpiexec = MicrosoftMPI_jll.mpiexec
194195
const mpiexec_path = MicrosoftMPI_jll.mpiexec_path
195196

196197
__init__deps() = nothing

src/environment.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ A wrapper function for the MPI launcher executable. Calls `fn(cmd)`, where `cmd`
88
The behaviour of `mpiexec` can be controlled by the following environment variables:
99
1010
- `JULIA_MPIEXEC`: the name or path of the launcher executable (set at compile time).
11-
- `JULIA_MPIEXEC_ARGS`: additional arguments that are passed to the launcher. These are space seperated, supporting the same quoting rules as
12-
Julia `Cmd` objects. These can be modified at run time.
11+
- `JULIA_MPIEXEC_ARGS`: additional arguments that are passed to the launcher. These are
12+
space seperated, supporting the same quoting rules as Julia `Cmd` objects. These can be
13+
modified at run time.
1314
1415
# Usage
1516
@@ -20,8 +21,9 @@ hello world
2021
hello world
2122
```
2223
"""
23-
mpiexec
24-
24+
function mpiexec(fn)
25+
_mpiexec(cmd -> fn(`$cmd $(Base.shell_split(get(ENV, "JULIA_MPIEXEC_ARGS", "")))`))
26+
end
2527

2628
const REFCOUNT = Threads.Atomic{Int}(-1)
2729

test/runtests.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,16 @@ if Sys.isunix()
1515
include("mpiexecjl.jl")
1616
end
1717

18-
mpiexec_args = Base.shell_split(get(ENV, "JULIA_MPIEXEC_TEST_ARGS", ""))
19-
2018
nprocs_str = get(ENV, "JULIA_MPI_TEST_NPROCS","")
2119
nprocs = nprocs_str == "" ? clamp(Sys.CPU_THREADS, 2, 4) : parse(Int, nprocs_str)
2220
testdir = @__DIR__
2321
istest(f) = endswith(f, ".jl") && startswith(f, "test_")
2422
testfiles = sort(filter(istest, readdir(testdir)))
2523

26-
@info "Running MPI tests" ArrayType nprocs mpiexec_args
24+
@info "Running MPI tests" ArrayType nprocs
2725

2826
@testset "$f" for f in testfiles
2927
mpiexec() do cmd
30-
cmd = `$cmd $mpiexec_args`
3128
if f == "test_spawn.jl"
3229
run(`$cmd -n 1 $(Base.julia_cmd()) $(joinpath(testdir, f))`)
3330
elseif f == "test_threads.jl"

0 commit comments

Comments
 (0)