Skip to content

Commit

Permalink
Adjust MPI_Status immutable for MPICH 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasnoack committed Jul 27, 2016
1 parent 1ecb3aa commit de82cc6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
7 changes: 6 additions & 1 deletion src/MPI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ Libdl.dlopen(libmpi, Libdl.RTLD_GLOBAL)
# implementations I'm aware of. The MPI_Get_library_version function doesn't allow us two query the length.
sbuf = Array(UInt8, 8192)
n = Ref{Cint}()
mjr, mnr = Ref{Cint}(), Ref{Cint}()

ccall((:MPI_Get_library_version, libmpi), Cint, (Ptr{UInt8}, Ref{Cint}), sbuf, n)
MPIString = String(sbuf[1:n[] - 1])
ccall((:MPI_Get_version, libmpi), Cint, (Ref{Cint}, Ref{Cint}), mjr, mnr)

const MPIString = String(sbuf[1:n[] - 1])
const MPIVersion = VersionNumber(mjr[], mnr[])

# Load header file information for linked MPI implementation
if ismatch(r"Open MPI", MPIString)
Expand Down
39 changes: 32 additions & 7 deletions src/mpich.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,35 @@ ROOT = Cint(-3)
ANY_TAG = Cint(-1)
UNDEFINED = Cint(-32766)

immutable Status
count_lo::Cint
count_hi_and_cancelled::Cint
source::Cint
tag::Cint
error::Cint
end
if MPIVersion < v"3.0.0"

error("Your version of MPICH is too old.")

elseif MPIVersion < v"3.1.0"

# MPICH decided to make life miserable and allow the size of Status struct to be modified
# in configure so we'll have to search to see if the struct is deviating from the default
if ismatch(r"EXTRA_STATUS_DECL", MPIString) || ismatch(r"MPI_Count", MPIString)
error("Status stuct has non-standard layout. Cannot proceed.")
end

immutable Status
source::Cint
tag::Cint
error::Cint
count::Clonglong
cancelled::Cint
abi_slush_fund::NTuple{2,Cint}
end

else

immutable Status
count_lo::Cint
count_hi_and_cancelled::Cint
source::Cint
tag::Cint
error::Cint
end

end

0 comments on commit de82cc6

Please sign in to comment.