Skip to content

Commit 046e293

Browse files
committed
MPI_Abi_get_version: New function
1 parent 518f8f0 commit 046e293

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

src/api/api.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,13 @@ include("generated_api.jl")
144144
# MPI <5. Once we regenerate the API for MPI 5.0, this should go away
145145
# again.
146146
function MPI_Abi_get_version(major, minor)
147-
@mpicall ccall((:MPI_Abi_get_version, libmpi), Cint, (Ptr{Cint}, Ptr{Cint}), major, minor)
147+
try
148+
@mpicall ccall((:MPI_Abi_get_version, libmpi), Cint, (Ptr{Cint}, Ptr{Cint}), major, minor)
149+
catch
150+
# This is an older MPI implementation which does not support the MPI ABI.
151+
major[] = -1
152+
minor[] = -1
153+
end
148154
end
149155

150156
for handle in [

src/implementations.jl

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,35 @@ function Get_version()
7070
VersionNumber(major[], minor[])
7171
end
7272

73+
"""
74+
MPI_VERSION :: VersionNumber
75+
76+
The supported version of the MPI standard.
77+
78+
# External links
79+
$(_doc_external("MPI_Get_version"))
80+
"""
81+
const MPI_VERSION = Get_version()
82+
83+
7384
function Abi_get_version()
7485
major = Ref{Cint}()
7586
minor = Ref{Cint}()
7687
API.MPI_Abi_get_version(major, minor)
88+
major[] == -1 && return nothing
7789
VersionNumber(major[], minor[])
7890
end
7991

8092
"""
81-
MPI_VERSION :: VersionNumber
93+
MPI_ABI_VERSION :: Union{Nothing,VersionNumber}
8294
83-
The supported version of the MPI standard.
95+
The supported version of the MPI ABI standard.
8496
8597
# External links
86-
$(_doc_external("MPI_Get_version"))
98+
$(_doc_external("MPI_Abi_get_version"))
8799
"""
88-
const MPI_VERSION = Get_version()
100+
const MPI_ABI_VERSION = Abi_get_version()
101+
89102

90103
using PkgVersion
91104
"""
@@ -122,6 +135,7 @@ function versioninfo(io::IO=stdout)
122135
println(io, " libmpi: ", API.libmpi)
123136
println(io, " libmpi dlpath: ", Libdl.dlpath(API.libmpi))
124137
println(io, " MPI version: ", Get_version())
138+
println(io, " MPI ABI version: ", Abi_get_version())
125139
println(io, " Library version: ")
126140
for line in split(Get_library_version(), '\n')
127141
println(io, " ", line)

0 commit comments

Comments
 (0)