-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
Allow one to specify an ABI file via MPIPreferences #600
base: master
Are you sure you want to change the base?
Allow one to specify an ABI file via MPIPreferences #600
Conversation
should we just make it the |
I don't think we can we use that for Platform support. I am not sure if MPIPreferences is the right place. I would just add it as a preference setting to MPI.jl |
I thought about it but decided against it. To me, using this is a last resort when all other options fail. Thus I would not pollute the
Really? I thought that |
My reasoning is that the information in MPIPreferences.jl is used by other packages (that's why we separated it), but which mpiconst file to load is really only relevant to MPI.jl |
OK. How would you design the API? Add new functions |
I like |
There are two potential downsides (that I know of) with putting the preference in MPI.jl and not MPIPreferences.jl
The first one is maybe not so bad, but the second one needs to be handled imho. The only option I see is that one could check for the ABI files existence and it that fails, output something like @error "Path to ABI file '$abi_file' not found. Fix with `use_custom_abi_file(path)` or `use_default_abi_file()` and restart Julia." without attempting to include it. Any thoughts/suggestions? |
src/consts/consts.jl
Outdated
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 comment
The reason will be displayed to describe this comment to others. Learn more.
I think i would prefer if this branch was only taken if abi == "custom"
or something similar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought of the abi_file
preference as a "one to rule them all" property that just overrides whatever is set as ABI when it comes to loading the ABI file.
I do see the merits of your suggestion, though. However, what if users set abi_file
to something and leave abi
unset? Or set it to something other than custom
? Wouldn't it be confusing if the abi_file
is then ignored? Or should this be handled as an error in the call to use_system_binary
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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 use_system_binary
should handle these cases.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
i'd leave it as nothing
if it is not set.
maybe a slightly longer name (e.g. abi_source_file
?)
also, you need to store it via set_preferences!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd leave it as
nothing
if it is not set.
That won't work, since Nothing
is not a valid TOML type:
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 false
if you'd prefer that.
maybe a slightly longer name (e.g.
abi_source_file
?)
Makes sense, I will do that.
also, you need to store it via
set_preferences!
Thanks, I seem to have forgotten to commit that part 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a slightly longer name (e.g.
abi_source_file
?)
Done in 162653a.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That won't work, since
Nothing
is not a valid TOML type:
Preferences.jl supports it, and it is what is returned when value is not set:
julia> isnothing(load_preference(MPIPreferences, "abi_file"))
true
This is an attempt to fix #574 and to resolve #575. Input welcome.