Skip to content

Commit

Permalink
docstrings for one-sided operations (#466)
Browse files Browse the repository at this point in the history
* docstrings for one-sided operations
* amend docstring of `Buffer`
  • Loading branch information
joachimbrand authored Apr 22, 2021
1 parent fa4260c commit 96070b7
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/src/onesided.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
MPI.Win_create
MPI.Win_create_dynamic
MPI.Win_allocate_shared
MPI.Get
MPI.Put
MPI.Accumulate
MPI.Get_accumulate
```
2 changes: 1 addition & 1 deletion src/buffers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const IN_PLACE = InPlace()
MPI.Buffer
An MPI buffer for communication with a single rank. It is used for point-to-point
communication and some collective operations.
and one-sided operations, as well as some collective operations. Operations will implicitly construct a `Buffer` when required via the generic constructor, but it can be advantageous to manually construct `Buffer`s when doing so incurs additional overhead, for example when using a non-predefined [`MPI.Datatype`](@ref).
# Fields
$(DocStringExtensions.FIELDS)
Expand Down
47 changes: 47 additions & 0 deletions src/onesided.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ end

# TODO: add some sort of "remote buffer": a way to specify different datatypes/counts

"""
Get(origin, target_rank::Integer, [target_disp::Integer], win::Win)
Copies data from the memory window `win` on the remote rank `target_rank` into `origin`
(with diplacement `target_disp`) using remote memory access.
`origin` can be a [`Buffer`](@ref), or any object for which `Buffer(origin)` is defined.
# External links
$(_doc_external("MPI_Get"))
"""
function Get(origin_buf::Buffer, target_rank::Integer, target_disp::Integer, win::Win)
# int MPI_Get(void *origin_addr, int origin_count,
# MPI_Datatype origin_datatype, int target_rank,
Expand All @@ -161,6 +171,16 @@ Get(origin, target_rank::Integer, target_disp::Integer, win::Win) =
Get(origin, target_rank::Integer, win::Win) =
Get(origin, target_rank, 0, win)

"""
Put(origin, target_rank::Integer, [target_disp::Integer], win::Win)
Copies data from `origin` into memory window `win` on remote rank `target_rank`
(with diplacement `target_disp`) using remote memory access.
`origin` can be a [`Buffer`](@ref), or any object for which [`Buffer_send(origin)`](@ref) is defined.
# External links
$(_doc_external("MPI_Put"))
"""
function Put(origin_buf::Buffer, target_rank::Integer, target_disp::Integer, win::Win)
# int MPI_Put(const void *origin_addr, int origin_count,
# MPI_Datatype origin_datatype, int target_rank,
Expand Down Expand Up @@ -188,6 +208,19 @@ function Fetch_and_op(sourceval, returnval, target_rank::Integer, target_disp::I
sourceval, returnval, Datatype(T), target_rank, target_disp, op, win)
end

"""
Accumulate(origin, target_rank::Integer, target_disp::Integer, op::Op, win::Win)
Combine the content of the `origin` buffer into the target buffer (specified by `win` and
displacement `target_disp`) with reduction operator `op` on the remote rank
`target_rank` using remote memory access.
`origin` can be a [`Buffer`](@ref), or any object for which [`Buffer_send(origin)`](@ref) is defined.
`op` can be any predefined [`Op`](@ref) (custom operators are not supported).
# External links
$(_doc_external("MPI_Accumulate"))
"""
function Accumulate(origin_buf::Buffer, target_rank::Integer, target_disp::Integer, op::Op, win::Win)
# int MPI_Accumulate(const void *origin_addr, int origin_count,
# MPI_Datatype origin_datatype, int target_rank,
Expand All @@ -201,6 +234,20 @@ end
Accumulate(origin, target_rank::Integer, target_disp::Integer, op::Op, win::Win) =
Accumulate(Buffer_send(origin), target_rank, target_disp, op, win)

"""
Get_accumulate(origin, result, target_rank::Integer, target_disp::Integer, op::Op, win::Win)
Combine the content of the `origin` buffer into the target buffer (specified by `win` and
displacement `target_disp`) with reduction operator `op` on the remote
rank `target_rank` using remote memory access. `Get_accumulate` also returns the
content of the target buffer _before_ accumulation into the `result` buffer.
`origin` can be a [`Buffer`](@ref), or any object for which `Buffer_send(origin)` is defined, `result` can be a [`Buffer`](@ref), or any object for which `Buffer(result)` is defined.
`op` can be any predefined [`Op`](@ref) (custom operators are not supported).
# External links
$(_doc_external("MPI_Get_accumulate"))
"""
function Get_accumulate(origin_buf::Buffer, result_buf::Buffer, target_rank::Integer, target_disp::Integer, op::Op, win::Win)
# int MPI_Get_accumulate(const void *origin_addr, int origin_count,
# MPI_Datatype origin_datatype, void *result_addr,
Expand Down

0 comments on commit 96070b7

Please sign in to comment.