-
-
Notifications
You must be signed in to change notification settings - Fork 124
Add a lightweight MPIABI sub-package that controls the MPI ABI #529
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
Conversation
I seem to recall that the .so version number is baked into the binaries, so maybe not. |
using Preferences | ||
|
||
function known_abis() | ||
return (:MicrosoftMPI, :MPICH, :OpenMPI, :MPItrampoline) |
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.
should we make these all lowercase?
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 JLLWrapper&Co normalize these to lower-case. I don't have a strong preference.
$(known_abis()) | ||
""") | ||
end | ||
@set_preferences!("abi" => abi) |
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.
In #524, I suggested the following:
# binary = "" (default) | "system" | "MPICH_jll" | "OpenMPI_jll" | "MicrosoftMPI_jll"
# path = "" (default) | top-level directory location
# library = "" (default) | library name/path | list of library names/paths
# abi = "" (default) | "MPICH" | "OpenMPI" | "MicrosoftMPI" | "unknown"
# mpiexec = "" (default) | executable name/path
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.
path
, library
, mpiexec
are dependent on which actual MPI installation is being loaded and the intention is for this to be used to choose which MPI installation to be loaded.
The question is: Do we bifurcate along the _jll
package used or along the ABI used. Thinking about the library versioning issue I think we need to make this mean with _jll
is being used by MPI.jl (which is a shame) I would like it to be the ABI.
Right now if the ABI is set to OpenMPI
we will load OpenMPI_jll
as part of LAMMPS_jll
, so that would not be compatible with binary==system && abi==openmpi
IIUC, except if we also set libmpi_path
for OpenMPI_jll
?
But then we could still run into a library version mismatch?
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.
How do you figure out the ABI without knowing the library etc?
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's why this package doesn't do it. It is a communication channel for ABI aware JLL
packages.
I was thinking MPI.jl would figure out the details and then set it here.
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.
Ah: so how would this work? a user would call MPI.set_library(...)
, which would find the library and set the preferences (in MPI.jl), and also call MPIABI.set_abi(...)
?
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.
Yeah, pretty much.
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.
There are some advantages to setting them all in the same package:
- it's easier to ensure that they stay in sync (e.g. that the preferences are set in the same location)
- it might help avoid an unnecessary round of precompilation
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.
Yeah I making this up here as we go along :)
I don't think we have a good idea of what the best practices should be.
The other extreme is to just use MPI.jl And make all the JLL packages depend on it
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 like the idea of a subpackage, but if e.g. Yggdrasil binaries built against MPICH are only valid for MPICH_jll and not the system MPICH, it would make sense to have binary
in the subpackage. And once you have that, you might as well put them all in the same place.
|
||
using Preferences | ||
|
||
function known_abis() |
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.
Out of curiosity, why a function and not a constant?
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.
constants are just 0-arity
functions, without participation in the cache invalidation scheme xD
const abi = @load_preference("abi", Sys.iswindows() ? :MicrosoftMPI : :MPICH) | ||
|
||
function __init__() | ||
if Sys.iswindows() |
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.
if Sys.iswindows() | |
@static if Sys.iswindows() |
?
@set_preferences!("abi" => abi) | ||
@warn "The MPI abi has changed, you will need to restart Julia for the change to take effect" abi | ||
|
||
if VERSION <= v"1.6.5" || VERSION == v"1.7.0" |
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 @static
also here?
version = "0.1.0" | ||
|
||
[deps] | ||
Preferences = "21216c6a-2e73-6563-6e65-726566657250" |
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.
Compat for Preferences.jl and Julia
@@ -0,0 +1,7 @@ | |||
name = "MPIABI" | |||
uuid = "3da0fdf6-3ccc-4f1b-acd9-58baa6c99267" | |||
authors = [] |
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.
Poor package, no one wants to claim authorship 😔
""" | ||
|
||
uuid = Preferences.get_uuid(@__MODULE__) | ||
project_toml, pkg_name = Preferences.find_first_project_with_uuid(uuid) |
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.
Wouldn't Pkg.add
be much easier? But you probably don't want to require Pkg
just for a workaround?
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 am tempted to fix this in Preferences.jl, which is where I stole this code from.
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.
If version 1.6.5 was already released I would just make that the compat xD
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.
1.6.5 should be very close: https://discourse.julialang.org/t/julia-1-6-5-testing-period/73068
I've been thinking about this a bit more, and prompted by @staticfloat's comment here: JuliaInterop/CxxWrap.jl#309 (comment), could we somehow encapsulate all this (and JuliaPackaging/Yggdrasil#4073) by creating a new MPI_jll package? What I was vaguely thinking is that this would act like an ordinary jll package, but with some extra constants (which could be set by Preferences):
|
Ideally this would also handle the platform PackageSpec stuff (i.e. adding MPI_jll as a PackageSpec would automatically expand the platforms) |
Closed in favor of #541 |
The goal is to have a central source of truth to query the MPI ABI used by Julia and by binary dependencies.
With this we can change the ABI, and after a restart the user will download the appropriate binaries/complain that they are incompatible.
With this I can change JuliaPackaging/Yggdrasil#4073 to contain
and have the LAMMPS_jll use the right ABI.
Open questions are:
cc: @eschnett @staticfloat @simonbyrne