Skip to content

Commit ed662e5

Browse files
committed
fix tests
1 parent bfe1753 commit ed662e5

File tree

7 files changed

+46
-49
lines changed

7 files changed

+46
-49
lines changed

.github/workflows/UnitTests.yml

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,15 @@ jobs:
9090
with:
9191
version: ${{ matrix.julia_version }}
9292

93-
# https://discourse.julialang.org/t/recommendation-cache-julia-artifacts-in-ci-services/35484
94-
- name: Cache artifacts
95-
uses: actions/cache@v1
96-
env:
97-
cache-name: cache-artifacts
98-
with:
99-
path: ~/.julia/artifacts
100-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
101-
restore-keys: |
102-
${{ runner.os }}-test-${{ env.cache-name }}-
103-
${{ runner.os }}-test-
104-
${{ runner.os }}-
93+
- uses: julia-actions/cache@v1
10594

106-
- name: "add MPIPreferences"
107-
run: julia --project -e 'using Pkg; Pkg.develop(path="lib/MPIPreferences")'
108-
- name: "Use system binary"
109-
run: julia --project -e 'using MPIPreferences; MPIPreferences.use_system_binary()'
95+
- name: add MPIPreferences, use system
96+
shell: julia --color=yes --project=test {0}
97+
run: |
98+
using Pkg
99+
Pkg.develop(path="lib/MPIPreferences")
100+
using MPIPreferences
101+
MPIPreferences.use_system_binary(export_prefs=true)
110102
- uses: julia-actions/julia-buildpkg@latest
111103
- uses: julia-actions/julia-runtest@latest
112104
env:
@@ -153,16 +145,14 @@ jobs:
153145

154146
- uses: julia-actions/cache@v1
155147

156-
- name: add MPIPreferences
157-
shell: julia --color=yes --project=. {0}
148+
- name: add MPIPreferences, use system
149+
shell: julia --color=yes --project=test {0}
158150
run: |
159151
using Pkg
160152
Pkg.develop(path="lib/MPIPreferences")
161-
- name: Use system binary
162-
shell: julia --color=yes --project=. {0}
163-
run: |
164153
using MPIPreferences
165-
MPIPreferences.use_system_binary()
154+
MPIPreferences.use_system_binary(export_prefs=true)
155+
166156
- uses: julia-actions/julia-buildpkg@latest
167157
- uses: julia-actions/julia-runtest@latest
168158

@@ -221,18 +211,7 @@ jobs:
221211
with:
222212
version: ${{ matrix.julia_version }}
223213

224-
# https://discourse.julialang.org/t/recommendation-cache-julia-artifacts-in-ci-services/35484
225-
- name: Cache artifacts
226-
uses: actions/cache@v1
227-
env:
228-
cache-name: cache-artifacts
229-
with:
230-
path: ~/.julia/artifacts
231-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
232-
restore-keys: |
233-
${{ runner.os }}-test-${{ env.cache-name }}-
234-
${{ runner.os }}-test-
235-
${{ runner.os }}-
214+
- uses: julia-actions/cache@v1
236215

237216
# we can't use the usual actions here as we need to ensure the environment variables are set
238217
- name: "Build package"

Project.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,3 @@ Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
2222
DocStringExtensions = "0.8"
2323
Requires = "~0.5, 1.0"
2424
julia = "1.6"
25-
26-
[extras]
27-
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
28-
DoubleFloats = "497a8b3b-efae-58df-a0af-a86822472b78"
29-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
30-
31-
[targets]
32-
test = ["CUDA", "DoubleFloats", "Test"]

lib/MPIPreferences/src/MPIPreferences.jl

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ elseif binary == "MPICH_jll"
1313
elseif binary == "OpenMPI_jll"
1414
"OpenMPI"
1515
elseif binary == "MPItrampoline_jll"
16-
"MPItrampoline"
16+
"MPIwrapper"
1717
else
1818
error("Unknown binary: $binary")
1919
end
@@ -26,21 +26,25 @@ module System
2626
mpiexec(f) = f(`$mpiexec_path`)
2727
end
2828

29-
function use_jll_binary(binary = Sys.iswindows() ? "MicrosoftMPI_jll" : "MPICH_jll")
29+
function use_jll_binary(binary = Sys.iswindows() ? "MicrosoftMPI_jll" : "MPICH_jll";export_prefs=false, force=true)
3030
binary in ["MicrosoftMPI_jll", "MPICH_jll", "OpenMPI_jll", "MPItrampoline_jll"] ||
3131
error("Unknown jll: $binary")
32-
@set_preferences!(
32+
set_preferences!(MPIPreferences,
3333
"binary" => binary,
3434
"libmpi" => nothing,
3535
"abi" => nothing,
36-
"mpiexec" => nothing
36+
"mpiexec" => nothing;
37+
export_prefs=export_prefs,
38+
force=force
3739
)
3840
end
3941

4042
function use_system_binary(;
4143
library=["libmpi", "libmpi_ibm", "msmpi", "libmpich", "libmpitrampoline"],
4244
mpiexec="mpiexec",
4345
abi=nothing,
46+
export_prefs=false,
47+
force=true,
4448
)
4549

4650
libmpi = find_library(library)
@@ -53,11 +57,13 @@ function use_system_binary(;
5357
if mpiexec isa Cmd
5458
mpiexec = collect(mpiexec)
5559
end
56-
@set_preferences!(
60+
set_preferences!(MPIPreferences,
5761
"binary" => "system",
5862
"libmpi" => libmpi,
5963
"abi" => abi,
6064
"mpiexec" => mpiexec,
65+
export_prefs=export_prefs,
66+
force=force
6167
)
6268
end
6369

@@ -142,6 +148,12 @@ function identify_abi(libmpi)
142148
if (m = match(r"^FUJITSU MPI Library (\d+.\d+.\d+)", version_string)) !== nothing
143149
version = VersionNumber(m.captures[1])
144150
end
151+
elseif startswith(version_string, "MPIwrapper")
152+
impl = "MPIwrapper"
153+
# MPIwrapper 2.2.2
154+
if (m = match(r"^MPIwrapper Version:\t(\d+.\d+.\d+\w*)", version_string)) !== nothing
155+
version = VersionNumber(m.captures[1])
156+
end
145157
end
146158
# 3) determine the abi from the implementation + version
147159
if (impl == "MPICH" && version >= v"3.1" ||
@@ -154,6 +166,8 @@ function identify_abi(libmpi)
154166
abi = "OpenMPI"
155167
elseif impl == "MicrosoftMPI"
156168
abi = "MicrosoftMPI"
169+
elseif impl == "MPIwrapper"
170+
abi = "MPIwrapper"
157171
else
158172
abi = "unknown"
159173
end

src/MPI.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ elseif MPIPreferences.binary == "OpenMPI_jll"
4242
import OpenMPI_jll: libmpi, mpiexec
4343
elseif MPIPreferences.binary == "MicrosoftMPI_jll"
4444
import MicrosoftMPI_jll: libmpi, mpiexec
45+
elseif MPIPreferences.binary == "MPItrampoline_jll"
46+
import MPItrampoline_jll: libmpi, mpiexec
47+
const libmpiconstants = MPItrampoline_jll.libload_time_mpi_constants_path
4548
else
4649
error("Unknown MPI binary: $(MPIPreferences.binary)")
4750
end

src/consts/consts.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ elseif MPIPreferences.abi == "OpenMPI"
3333
include("openmpi.jl")
3434
elseif MPIPreferences.abi == "MicrosofMPI"
3535
include("microsoftmpi.jl")
36-
elseif MPIPreferences.abi == "MPItrampoline"
37-
include("mpitrampoline.jl")
36+
elseif MPIPreferences.abi == "MPIwrapper"
37+
include("mpiwrapper.jl")
3838
else
3939
error("Unknown MPI ABI")
4040
end

test/Project.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[deps]
2+
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
3+
DoubleFloats = "497a8b3b-efae-58df-a0af-a86822472b78"
4+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
5+
MPIPreferences = "3da0fdf6-3ccc-4f1b-acd9-58baa6c99267"

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
using Test, MPI
22

3+
using MPIPreferences
4+
5+
@show MPIPreferences.abi MPIPreferences.binary
6+
37
# load test packages to trigger precompilation
48
using DoubleFloats
59
if get(ENV, "JULIA_MPI_TEST_ARRAYTYPE", "") == "CuArray"

0 commit comments

Comments
 (0)