Skip to content

Commit

Permalink
rename get/set_errorhandler to errhandler
Browse files Browse the repository at this point in the history
fixes #500
  • Loading branch information
simonbyrne committed Aug 28, 2021
1 parent 82bff4a commit 8542c97
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 24 deletions.
4 changes: 2 additions & 2 deletions docs/src/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ MPI.infoval

```@docs
MPI.ErrorHandler
MPI.get_errorhandler
MPI.set_errorhandler!
MPI.get_errhandler
MPI.set_errhandler!
```

4 changes: 4 additions & 0 deletions src/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,7 @@ import Base: @deprecate

@deprecate(Accumulate(origin, rank, disp, op, win), Accumulate!(origin, rank, disp, op, win), false)
@deprecate(Get_accumulate(origin, result, rank, disp, op, win), Get_accumulate!(origin, result, rank, disp, op, win), false)


@deprecate(MPI.get_errorhandler(obj), MPI.get_errhandler(obj), false)
@deprecate(MPI.set_errorhandler!(obj, errhandler), MPI.set_errhandler!(obj, errhandler), false)
38 changes: 19 additions & 19 deletions src/errorhandler.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
MPI.Errhandler
MPI.ErrorHandler
An MPI error handler object. Currently only two are supported:
Expand All @@ -19,57 +19,57 @@ function free(errh::ErrorHandler)
return nothing
end

function set_default_error_handler_return()
set_errorhandler!(COMM_SELF, ERRORS_RETURN)
set_errorhandler!(COMM_WORLD, ERRORS_RETURN)
function set_default_errhandler_return()
set_errhandler!(COMM_SELF, ERRORS_RETURN)
set_errhandler!(COMM_WORLD, ERRORS_RETURN)
end

"""
MPI.get_errorhandler(comm::MPI.Comm)
MPI.get_errorhandler(win::MPI.Win)
MPI.get_errorhandler(file::MPI.File.FileHandle)
MPI.get_errhandler(comm::MPI.Comm)
MPI.get_errhandler(win::MPI.Win)
MPI.get_errhandler(file::MPI.File.FileHandle)
Get the current [`ErrorHandler`](@ref) for the relevant MPI object.
# See also
- [`set_errorhandler!`](@ref)
- [`set_errhandler!`](@ref)
"""
function get_errorhandler(comm::Comm)
function get_errhandler(comm::Comm)
errh = ErrorHandler(ERRORS_ARE_FATAL.val)
@mpichk ccall((:MPI_Comm_get_errhandler, libmpi), Cint, (MPI_Comm, Ptr{MPI_Errhandler}), comm, errh)
finalizer(free, errh)
return errh
end
function get_errorhandler(win::Win)
errh = ErrorHandler(ERRORS_ARE_FATAL.val)
function get_errhandler(win::Win)
errh = v(ERRORS_ARE_FATAL.val)
@mpichk ccall((:MPI_Win_get_errhandler, libmpi), Cint, (MPI_Win, Ptr{MPI_Errhandler}), win, errh)
return errh
end
function get_errorhandler(file::File.FileHandle)
function get_errhandler(file::File.FileHandle)
errh = ErrorHandler(ERRORS_ARE_FATAL.val)
@mpichk ccall((:MPI_File_get_errhandler, libmpi), Cint, (MPI_File, Ptr{MPI_Errhandler}), file, errh)
return errh
end

"""
MPI.set_errorhandler!(comm::MPI.Comm, errh::ErrorHandler)
MPI.set_errorhandler!(win::MPI.Win, errh::ErrorHandler)
MPI.set_errorhandler!(file::MPI.File.FileHandle, errh::ErrorHandler)
MPI.set_errhandler!(comm::MPI.Comm, errh::Errhandler)
MPI.set_errhandler!(win::MPI.Win, errh::Errhandler)
MPI.set_errhandler!(file::MPI.File.FileHandle, errh::Errhandler)
Set the [`ErrorHandler`](@ref) for the relevant MPI object.
# See also
- [`get_errorhandler`](@ref)
- [`get_errhandler`](@ref)
"""
function set_errorhandler!(comm::Comm, errh::ErrorHandler)
function set_errhandler!(comm::Comm, errh::ErrorHandler)
@mpichk ccall((:MPI_Comm_set_errhandler, libmpi), Cint, (MPI_Comm, MPI_Errhandler), comm, errh)
return nothing
end
function set_errorhandler!(win::Win, errh::ErrorHandler)
function set_errhandler!(win::Win, errh::ErrorHandler)
@mpichk ccall((:MPI_Win_set_errhandler, libmpi), Cint, (MPI_Win, MPI_Errhandler), win, errh)
return nothing
end
function set_errorhandler!(file::File.FileHandle, errh::ErrorHandler)
function set_errhandler!(file::File.FileHandle, errh::ErrorHandler)
@mpichk ccall((:MPI_File_set_errhandler, libmpi), Cint, (MPI_File, MPI_Errhandler), file, errh)
return nothing
end
Expand Down
6 changes: 3 additions & 3 deletions test/test_errorhandler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ using MPI, Test
MPI.Init()

@test MPI.ERRORS_ARE_FATAL != MPI.ERRORS_RETURN
@test MPI.get_errorhandler(MPI.COMM_SELF) == MPI.ERRORS_RETURN
@test MPI.get_errhandler(MPI.COMM_SELF) == MPI.ERRORS_RETURN
@test_throws MPI.MPIError MPI.Send(rand(10), 2, 0, MPI.COMM_SELF)

MPI.set_errorhandler!(MPI.COMM_SELF, MPI.ERRORS_ARE_FATAL)
@test MPI.get_errorhandler(MPI.COMM_SELF) == MPI.ERRORS_ARE_FATAL
MPI.set_errhandler!(MPI.COMM_SELF, MPI.ERRORS_ARE_FATAL)
@test MPI.get_errhandler(MPI.COMM_SELF) == MPI.ERRORS_ARE_FATAL

0 comments on commit 8542c97

Please sign in to comment.