Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename get/set_errorhandler to errhandler #504

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions docs/src/reference/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ MPI.infoval
## Error handler objects

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

## Miscellaneous
Expand Down
3 changes: 3 additions & 0 deletions src/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,6 @@ import Base: @deprecate
dims .= Dims_create(nnodes, dims), false)
@deprecate(Cart_coords!(comm::Comm, rank::Integer, coords::MPIBuffertype{Cint}),
coords .= Cart_coords(comm, rank), false)

@deprecate(get_errorhandler(obj), get_errhandler(obj), false)
@deprecate(set_errorhandler!(obj, errhandler), set_errhandler!(obj, errhandler), false)
2 changes: 1 addition & 1 deletion src/environment.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function Init(;threadlevel=:serialized, finalize_atexit=true, errors_return=true

run_init_hooks()
if errors_return
set_default_error_handler_return()
set_default_errhandler_return()
end
_warn_if_wrong_mpi()
end
Expand Down
36 changes: 18 additions & 18 deletions src/errhandler.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 Down Expand Up @@ -31,56 +31,56 @@ function free(errh::Errhandler)
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 [`Errhandler`](@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 = Errhandler()
@mpichk ccall((:MPI_Comm_get_errhandler, libmpi), Cint, (MPI_Comm, Ptr{MPI_Errhandler}), comm, errh)
return errh
end
function get_errorhandler(win::Win)
function get_errhandler(win::Win)
errh = Errhandler()
@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 = Errhandler()
@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::Errhandler)
MPI.set_errorhandler!(win::MPI.Win, errh::Errhandler)
MPI.set_errorhandler!(file::MPI.File.FileHandle, errh::Errhandler)
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 [`Errhandler`](@ref) for the relevant MPI object.

# See also
- [`get_errorhandler`](@ref)
- [`get_errhandler`](@ref)
"""
function set_errorhandler!(comm::Comm, errh::Errhandler)
function set_errhandler!(comm::Comm, errh::Errhandler)
@mpichk ccall((:MPI_Comm_set_errhandler, libmpi), Cint, (MPI_Comm, MPI_Errhandler), comm, errh)
return nothing
end
function set_errorhandler!(win::Win, errh::Errhandler)
function set_errhandler!(win::Win, errh::Errhandler)
@mpichk ccall((:MPI_Win_set_errhandler, libmpi), Cint, (MPI_Win, MPI_Errhandler), win, errh)
return nothing
end
function set_errorhandler!(file::File.FileHandle, errh::Errhandler)
function set_errhandler!(file::File.FileHandle, errh::Errhandler)
@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