Skip to content

Commit ad165d7

Browse files
committed
fix identify_abi
1 parent e02b93f commit ad165d7

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

lib/MPIPreferences/src/MPIPreferences.jl

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ function use_system_binary(;
4848
error("MPI library could not be found")
4949
end
5050
if isnothing(abi)
51-
versionstring = Get_library_version(libmpi)
52-
impl, version = identify_implementation(versionstring)
53-
abi = identify_abi(impl, version)
51+
abi = identify_abi(libmpi)
5452
end
5553
if mpiexec isa Cmd
5654
mpiexec = collect(mpiexec)
@@ -63,12 +61,14 @@ function use_system_binary(;
6361
)
6462
end
6563

64+
6665
"""
67-
Get_library_version(libmpi)
66+
identify_abi(libmpi)
6867
69-
Get the version string of the MPI library.
68+
Identify the MPI implementation from the library version string
7069
"""
71-
function Get_library_version(libmpi)
70+
function identify_abi(libmpi)
71+
# 1) query MPI_Get_version
7272
# There is no way to query at runtime what the length of the buffer should be.
7373
# https://github.com/mpi-forum/mpi-issues/issues/159
7474
# 8192 is the maximum value of MPI_MAX_LIBRARY_VERSION_STRING across known
@@ -82,16 +82,9 @@ function Get_library_version(libmpi)
8282

8383
@assert buflen[] < 8192
8484
resize!(buf, buflen[])
85-
return String(buf)
86-
end
87-
85+
version_string = String(buf)
8886

89-
"""
90-
identify_abi(version_string)
91-
92-
Identify the MPI implementation from the library version string
93-
"""
94-
function identify_abi(version_string::String)
87+
# 2) try to identify the MPI implementation
9588
impl = "unknown"
9689
version = v"0"
9790

@@ -143,22 +136,30 @@ function identify_abi(version_string::String)
143136
if (m = match(r"CRAY MPICH version (\d+.\d+.\d+)", version_string)) !== nothing
144137
version = VersionNumber(m.captures[1])
145138
end
139+
elseif startswith(version_string, "FUJITSU MPI")
140+
impl = "FujitsuMPI"
141+
# "FUJITSU MPI Library 4.0.0 (4.0.1fj4.0.0)\0"
142+
if (m = match(r"^FUJITSU MPI Library (\d+.\d+.\d+)", version_string)) !== nothing
143+
version = VersionNumber(m.captures[1])
144+
end
146145
end
147-
148-
# determine the abi from the implementation + version
146+
# 3) determine the abi from the implementation + version
149147
if (impl == "MPICH" && version >= v"3.1" ||
150148
impl == "IntelMPI" && version > v"2014" ||
151149
impl == "MVAPICH" && version >= v"2" ||
152150
impl == "CrayMPICH" && version >= v"7")
153151
# https://www.mpich.org/abi/
154152
abi = "MPICH"
155-
elseif impl == "OpenMPI" || impl == "IBMSpectrumMPI"
153+
elseif impl == "OpenMPI" || impl == "IBMSpectrumMPI" || impl == "FujitsuMPI"
156154
abi = "OpenMPI"
157155
elseif impl == "MicrosoftMPI"
158156
abi = "MicrosoftMPI"
159157
else
160158
abi = "unknown"
161159
end
160+
161+
@info "MPI implementation" libmpi version_string impl version abi
162+
162163
return abi
163164
end
164165

0 commit comments

Comments
 (0)