Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/api/api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ function Base.show(io::IO, err::FeatureLevelError)
print(io, "FeatureLevelError($(err.function_name)): Minimum MPI version is $(err.min_version)")
end

@noinline function mpi_error(err)
throw(MPIError(err))
end


macro mpichk(expr, min_version=nothing)
if !isnothing(min_version) && expr.args[2].head == :tuple
fn = expr.args[2].args[1].value
Expand All @@ -134,7 +139,13 @@ macro mpichk(expr, min_version=nothing)

expr = macroexpand(@__MODULE__, :(@mpicall($expr)))
# MPI_SUCCESS is defined to be 0
:((errcode = $(esc(expr))) == 0 || throw(MPIError(errcode)))
quote
errcode = $(esc(expr))
if errcode != 0
$mpi_error(errcode)
end
nothing
end
end


Expand Down
Loading