Skip to content

Commit 2d14d06

Browse files
authored
add _format key to MPIPreferences (#648)
1 parent 7b7cac8 commit 2d14d06

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

docs/src/configuration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Preferences are merged across the Julia load path, such that it is feasible to p
6565

6666
```toml
6767
[MPIPreferences]
68+
_format = "1.0"
6869
abi = "OpenMPI"
6970
binary = "system"
7071
libmpi = "/software/mpi/lib/libmpi.so"
@@ -78,6 +79,7 @@ Preferences are merged across the Julia load path, such that it is feasible to p
7879
MPIPreferences = "3da0fdf6-3ccc-4f1b-acd9-58baa6c99267"
7980

8081
[preferences.MPIPreferences]
82+
_format = "1.0"
8183
abi = "OpenMPI"
8284
binary = "system"
8385
libmpi = "/software/mpi/lib/libmpi.so"
@@ -135,7 +137,7 @@ The test suite can also be modified by the following variables:
135137

136138
- `JULIA_MPI_TEST_NPROCS`: How many ranks to use within the tests
137139
- `JULIA_MPI_TEST_ARRAYTYPE`: Set to `CuArray` or `ROCArray` to test the CUDA-aware interface with
138-
[`CUDA.CuArray`](https://github.com/JuliaGPU/CUDA.jl) or the ROCm-aware interface with
140+
[`CUDA.CuArray`](https://github.com/JuliaGPU/CUDA.jl) or the ROCm-aware interface with
139141
[`AMDGPU.ROCArray`](https://github.com/JuliaGPU/AMDGPU.jl) or buffers.
140142
- `JULIA_MPI_TEST_BINARY`: Check that the specified MPI binary is used for the tests
141143
- `JULIA_MPI_TEST_ABI`: Check that the specified MPI ABI is used for the tests

docs/src/reference/mpipreferences.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# MPIPreferences.jl
22

3-
MPIPreferences.jl is a small package used for selecting MPI implementations.
3+
MPIPreferences.jl is a small package based on [Preferences.jl](https://github.com/JuliaPackaging/Preferences.jl/) for selecting MPI implementations.
4+
These choices are compile-time constants, and so any changes will require a Julia restart.
45

56
## Consts
67

@@ -21,3 +22,17 @@ MPIPreferences.use_jll_binary
2122
```@docs
2223
MPIPreferences.identify_abi
2324
```
25+
26+
## Preferences schema
27+
28+
MPIPreferences utilizes the following keys to store information in the Preferences key-value store.
29+
30+
- `_format`: the version number of the schema. Currently only `"1.0"` is supported.
31+
- `binary`: the choice of binary. This should be one of the strings listed in [`MPIPreferences.binary`](@ref).
32+
33+
If `binary == "system"`, then the following keys are also required (otherwise they have no effect):
34+
- `libmpi`: the filename or path of the MPI dynamic library.
35+
- `abi`: The ABI of the MPI implementation. This should be one of the strings listed in [`MPIPreferences.abi`](@ref).
36+
- `mpiexec`: either
37+
- a string corresponding to the MPI launcher executable
38+
- an array of strings, with the first entry being the executable and remaining entried being additional flags that should be used with the executable.

lib/MPIPreferences/src/MPIPreferences.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ module MPIPreferences
22

33
using Preferences, Libdl
44

5+
if !(VersionNumber(@load_preference("_format", "1.0")) <= v"1.0")
6+
error("The preferences attached to MPIPreferences are incompatible with this version of the package.")
7+
end
8+
59
"""
610
MPIPreferences.binary :: String
711
@@ -19,7 +23,7 @@ const binary = @load_preference("binary", Sys.iswindows() ? "MicrosoftMPI_jll" :
1923
"""
2024
MPIPreferences.abi :: String
2125
22-
The ABI of the currently selected binary. Supported values are:
26+
The ABI (application binary interface) of the currently selected binary. Supported values are:
2327
2428
- `"MPICH"`: MPICH-compatible ABI (https://www.mpich.org/abi/)
2529
- `"OpenMPI"`: Open MPI compatible ABI (Open MPI, IBM Spectrum MPI, Fujitsu MPI)
@@ -62,6 +66,7 @@ function use_jll_binary(binary = Sys.iswindows() ? "MicrosoftMPI_jll" : "MPICH_j
6266
binary in ["MicrosoftMPI_jll", "MPICH_jll", "OpenMPI_jll", "MPItrampoline_jll"] ||
6367
error("Unknown jll: $binary")
6468
set_preferences!(MPIPreferences,
69+
"_format" => "1.0",
6570
"binary" => binary,
6671
"libmpi" => nothing,
6772
"abi" => nothing,
@@ -140,6 +145,7 @@ function use_system_binary(;
140145
mpiexec = collect(mpiexec)
141146
end
142147
set_preferences!(MPIPreferences,
148+
"_format" => "1.0",
143149
"binary" => binary,
144150
"libmpi" => libmpi,
145151
"abi" => abi,

0 commit comments

Comments
 (0)