Skip to content

Commit

Permalink
[MPIPreferences] Allow passing extra dirs to use_system_binary (#832)
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano authored Apr 29, 2024
1 parent 8902644 commit 7b97da7
Show file tree
Hide file tree
Showing 3 changed files with 13 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(; extra_paths=[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
9 changes: 8 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"],
extra_paths = 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.
- `extra_paths`: 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"],
extra_paths=String[],
mpiexec="mpiexec",
abi=nothing,
vendor=nothing,
Expand Down Expand Up @@ -186,12 +191,14 @@ 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, extra_paths)
end
if libmpi == ""
error("""
MPI library could not be found with the following name(s):
$(library_names)
in the following extra directories (in addition to the default ones):
$(extra_paths)
If you want to try different name(s) for the MPI library, use
MPIPreferences.use_system_binary(; library_names=[...])""")
end
Expand Down

2 comments on commit 7b97da7

@giordano
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register subdir=lib/MPIPreferences

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/105856

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a MPIPreferences-v0.1.11 -m "<description of version>" 7b97da711b90f2c0769ffe513a946958b4ec8ae1
git push origin MPIPreferences-v0.1.11

Please sign in to comment.