Skip to content

Commit 7b97da7

Browse files
authored
[MPIPreferences] Allow passing extra dirs to use_system_binary (#832)
1 parent 8902644 commit 7b97da7

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

.github/workflows/UnitTests.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,7 @@ jobs:
165165

166166
- name: Install MPI via homebrew
167167
run: |
168-
brew install "${MPI}"
169-
echo "DYLD_FALLBACK_LIBRARY_PATH=$(brew --prefix ${MPI})/lib" >> "${GITHUB_ENV}"
170-
env:
171-
MPI: ${{ matrix.mpi }}
168+
brew install "${{ matrix.mpi }}"
172169
173170
- uses: julia-actions/setup-julia@v1
174171
with:
@@ -186,7 +183,9 @@ jobs:
186183
shell: julia --color=yes --project=. {0}
187184
run: |
188185
using MPIPreferences
189-
MPIPreferences.use_system_binary()
186+
mpi_prefix = readchomp(`brew --prefix ${{ matrix.mpi }}`)
187+
libdir = joinpath(mpi_prefix, "lib")
188+
MPIPreferences.use_system_binary(; extra_paths=[libdir])
190189
191190
- uses: julia-actions/julia-runtest@v1
192191
env:

lib/MPIPreferences/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MPIPreferences"
22
uuid = "3da0fdf6-3ccc-4f1b-acd9-58baa6c99267"
33
authors = []
4-
version = "0.1.10"
4+
version = "0.1.11"
55

66
[deps]
77
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"

lib/MPIPreferences/src/MPIPreferences.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ end
119119
"""
120120
use_system_binary(;
121121
library_names = ["libmpi", "libmpi_ibm", "msmpi", "libmpich", "libmpi_cray", "libmpitrampoline"],
122+
extra_paths = String[],
122123
mpiexec = "mpiexec",
123124
abi = nothing,
124125
vendor = nothing,
@@ -135,6 +136,9 @@ Options:
135136
If the library isn't in the library search path, you can specify the full path
136137
to the library.
137138
139+
- `extra_paths`: indicate extra directories where to search for the MPI library,
140+
besides the default ones of the dynamic linker.
141+
138142
- `mpiexec`: the MPI launcher executable. The default is `mpiexec`, but some
139143
clusters require using the scheduler launcher interface (e.g. `srun` on Slurm,
140144
`aprun` on PBS). It is also possible to pass a [`Cmd`
@@ -159,6 +163,7 @@ Options:
159163
"""
160164
function use_system_binary(;
161165
library_names=["libmpi", "libmpi_ibm", "msmpi", "libmpich", "libmpi_cray", "libmpitrampoline"],
166+
extra_paths=String[],
162167
mpiexec="mpiexec",
163168
abi=nothing,
164169
vendor=nothing,
@@ -186,12 +191,14 @@ function use_system_binary(;
186191

187192
# Set `ZES_ENABLE_SYSMAN` to work around https://github.com/open-mpi/ompi/issues/10142
188193
libmpi = withenv("ZES_ENABLE_SYSMAN" => "1") do
189-
find_library(library_names)
194+
find_library(library_names, extra_paths)
190195
end
191196
if libmpi == ""
192197
error("""
193198
MPI library could not be found with the following name(s):
194199
$(library_names)
200+
in the following extra directories (in addition to the default ones):
201+
$(extra_paths)
195202
If you want to try different name(s) for the MPI library, use
196203
MPIPreferences.use_system_binary(; library_names=[...])""")
197204
end

0 commit comments

Comments
 (0)