Skip to content

Commit

Permalink
[MPIPreferences] Allow passing extra dirs to use_system_binary
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano committed Apr 29, 2024
1 parent 3f98462 commit 2193bbb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/UnitTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,7 @@ jobs:

- name: Install MPI via homebrew
run: |
brew install "${MPI}"
echo "DYLD_FALLBACK_LIBRARY_PATH=$(brew --prefix ${MPI})/lib" >> "${GITHUB_ENV}"
env:
MPI: ${{ matrix.mpi }}
brew install "${{ matrix.mpi }}"
- uses: julia-actions/setup-julia@v1
with:
Expand All @@ -186,7 +183,9 @@ jobs:
shell: julia --color=yes --project=. {0}
run: |
using MPIPreferences
MPIPreferences.use_system_binary()
mpi_prefix = readchomp(`brew --prefix ${{ matrix.mpi }}`)
libdir = joinpath(mpi_prefix, "lib")
MPIPreferences.use_system_binary(; locations=[libdir])
- uses: julia-actions/julia-runtest@v1
env:
Expand Down
2 changes: 1 addition & 1 deletion lib/MPIPreferences/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MPIPreferences"
uuid = "3da0fdf6-3ccc-4f1b-acd9-58baa6c99267"
authors = []
version = "0.1.10"
version = "0.1.11"

[deps]
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Expand Down
7 changes: 6 additions & 1 deletion lib/MPIPreferences/src/MPIPreferences.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ end
"""
use_system_binary(;
library_names = ["libmpi", "libmpi_ibm", "msmpi", "libmpich", "libmpi_cray", "libmpitrampoline"],
locations = String[],
mpiexec = "mpiexec",
abi = nothing,
vendor = nothing,
Expand All @@ -135,6 +136,9 @@ Options:
If the library isn't in the library search path, you can specify the full path
to the library.
- `locations`: indicate extra directories where to search for the MPI library,
besides the default ones of the dynamic linker.
- `mpiexec`: the MPI launcher executable. The default is `mpiexec`, but some
clusters require using the scheduler launcher interface (e.g. `srun` on Slurm,
`aprun` on PBS). It is also possible to pass a [`Cmd`
Expand All @@ -159,6 +163,7 @@ Options:
"""
function use_system_binary(;
library_names=["libmpi", "libmpi_ibm", "msmpi", "libmpich", "libmpi_cray", "libmpitrampoline"],
locations=String[],
mpiexec="mpiexec",
abi=nothing,
vendor=nothing,
Expand Down Expand Up @@ -186,7 +191,7 @@ function use_system_binary(;

# Set `ZES_ENABLE_SYSMAN` to work around https://github.com/open-mpi/ompi/issues/10142
libmpi = withenv("ZES_ENABLE_SYSMAN" => "1") do
find_library(library_names)
find_library(library_names, locations)
end
if libmpi == ""
error("""
Expand Down

0 comments on commit 2193bbb

Please sign in to comment.