-
-
Notifications
You must be signed in to change notification settings - Fork 123
Allow one to specify an ABI file via MPIPreferences #600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 5 commits
3c1670f
9b7091e
edaf03b
904d252
ff29239
13af812
573ae38
162653a
8022f57
9a5d0a9
b4de3bd
ff798c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,10 @@ else | |
error("Unknown binary: $binary") | ||
end | ||
|
||
# Default is empty string, indicating that the information in `abi` should be used to load the | ||
# correct ABI file | ||
const abi_file = @load_preference("abi_file", "") | ||
|
||
module System | ||
export libmpi, mpiexec | ||
using Preferences | ||
|
@@ -94,6 +98,7 @@ end | |
library_names = ["libmpi", "libmpi_ibm", "msmpi", "libmpich", "libmpitrampoline"], | ||
mpiexec = "mpiexec", | ||
abi = nothing, | ||
abi_file = nothing, | ||
export_prefs = false, | ||
force = true) | ||
|
||
|
@@ -115,6 +120,10 @@ Options: | |
- `abi`: the ABI of the MPI library. By default this is determined automatically | ||
using [`identify_abi`](@ref). See [`abi`](@ref) for currently supported values. | ||
|
||
- `abi_file`: the ABI file for the MPI library. By default, for ABIs supported by MPI.jl, the | ||
corresponding ABI file is loaded automatically. This argument allows one to override the | ||
automatic selection, e.g., to provide an ABI file for an MPI ABI unknown to MPI.jl. | ||
|
||
- `export_prefs`: if `true`, the preferences into the `Project.toml` instead of `LocalPreferences.toml`. | ||
|
||
- `force`: if `true`, the preferences are set even if they are already set. | ||
|
@@ -123,6 +132,7 @@ function use_system_binary(; | |
library_names=["libmpi", "libmpi_ibm", "msmpi", "libmpich", "libmpitrampoline"], | ||
mpiexec="mpiexec", | ||
abi=nothing, | ||
abi_file=nothing, | ||
export_prefs=false, | ||
force=true, | ||
) | ||
|
@@ -137,6 +147,11 @@ function use_system_binary(; | |
if isnothing(abi) | ||
abi = identify_abi(libmpi) | ||
end | ||
if isnothing(abi_file) | ||
abi_file = "" | ||
else | ||
abi_file = abspath(abi_file) | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'd leave it as maybe a slightly longer name (e.g. also, you need to store it via There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That won't work, since julia> TOML.print(Dict{String,Any}("abi_file" => nothing))
ERROR: type `Nothing` is not a valid TOML type, pass a conversion function to `TOML.print This is also the reason why used the empty string as a sentinel. I could also use
Makes sense, I will do that.
Thanks, I seem to have forgotten to commit that part 🙈 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Done in 162653a. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Preferences.jl supports it, and it is what is returned when value is not set:
|
||
if mpiexec isa Cmd | ||
mpiexec = collect(mpiexec) | ||
end | ||
|
@@ -149,7 +164,7 @@ function use_system_binary(; | |
force=force | ||
) | ||
|
||
@warn "The underlying MPI implementation has changed. You will need to restart Julia for this change to take effect" binary libmpi abi mpiexec | ||
@warn "The underlying MPI implementation has changed. You will need to restart Julia for this change to take effect" binary libmpi abi abi_file mpiexec | ||
|
||
if VERSION <= v"1.6.5" || VERSION == v"1.7.0" | ||
@warn """ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,18 +27,23 @@ macro const_ref(name, T, expr) | |
:(const $(esc(name)) = Ref{$T}()) | ||
end | ||
|
||
@static if MPIPreferences.abi == "MPICH" | ||
include("mpich.jl") | ||
elseif MPIPreferences.abi == "OpenMPI" | ||
include("openmpi.jl") | ||
elseif MPIPreferences.abi == "MicrosoftMPI" | ||
include("microsoftmpi.jl") | ||
elseif MPIPreferences.abi == "MPItrampoline" | ||
include("mpitrampoline.jl") | ||
elseif MPIPreferences.abi == "HPE MPT" | ||
include("mpt.jl") | ||
# If `abi_file` is empty, choose ABI file based on ABI string, otherwise load the specified file | ||
@static if MPIPreferences.abi_file == "" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think i would prefer if this branch was only taken if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought of the I do see the merits of your suggestion, though. However, what if users set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that this option will be rarely used (and is untested), I would be extremely reluctant to make it the "one to rule them all". The configuration is complicated in any case (which is part of the reason I am reluctant to add this functionality), but I would prefer that any requirements be very explicit. The logic in |
||
@static if MPIPreferences.abi == "MPICH" | ||
include("mpich.jl") | ||
elseif MPIPreferences.abi == "OpenMPI" | ||
include("openmpi.jl") | ||
elseif MPIPreferences.abi == "MicrosoftMPI" | ||
include("microsoftmpi.jl") | ||
elseif MPIPreferences.abi == "MPItrampoline" | ||
include("mpitrampoline.jl") | ||
elseif MPIPreferences.abi == "HPE MPT" | ||
include("mpt.jl") | ||
else | ||
error("Unknown MPI ABI $(MPIPreferences.abi)") | ||
end | ||
else | ||
error("Unknown MPI ABI $(MPIPreferences.abi)") | ||
include(MPIPreferences.abi_file) | ||
end | ||
|
||
# Initialize the ref constants from the library. | ||
|
Uh oh!
There was an error while loading. Please reload this page.