Skip to content

Commit 96070b7

Browse files
authored
docstrings for one-sided operations (#466)
* docstrings for one-sided operations * amend docstring of `Buffer`
1 parent fa4260c commit 96070b7

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

docs/src/onesided.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44
MPI.Win_create
55
MPI.Win_create_dynamic
66
MPI.Win_allocate_shared
7+
MPI.Get
8+
MPI.Put
9+
MPI.Accumulate
10+
MPI.Get_accumulate
711
```

src/buffers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const IN_PLACE = InPlace()
9292
MPI.Buffer
9393
9494
An MPI buffer for communication with a single rank. It is used for point-to-point
95-
communication and some collective operations.
95+
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).
9696
9797
# Fields
9898
$(DocStringExtensions.FIELDS)

src/onesided.jl

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,16 @@ end
146146

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

149+
"""
150+
Get(origin, target_rank::Integer, [target_disp::Integer], win::Win)
151+
152+
Copies data from the memory window `win` on the remote rank `target_rank` into `origin`
153+
(with diplacement `target_disp`) using remote memory access.
154+
`origin` can be a [`Buffer`](@ref), or any object for which `Buffer(origin)` is defined.
155+
156+
# External links
157+
$(_doc_external("MPI_Get"))
158+
"""
149159
function Get(origin_buf::Buffer, target_rank::Integer, target_disp::Integer, win::Win)
150160
# int MPI_Get(void *origin_addr, int origin_count,
151161
# MPI_Datatype origin_datatype, int target_rank,
@@ -161,6 +171,16 @@ Get(origin, target_rank::Integer, target_disp::Integer, win::Win) =
161171
Get(origin, target_rank::Integer, win::Win) =
162172
Get(origin, target_rank, 0, win)
163173

174+
"""
175+
Put(origin, target_rank::Integer, [target_disp::Integer], win::Win)
176+
177+
Copies data from `origin` into memory window `win` on remote rank `target_rank`
178+
(with diplacement `target_disp`) using remote memory access.
179+
`origin` can be a [`Buffer`](@ref), or any object for which [`Buffer_send(origin)`](@ref) is defined.
180+
181+
# External links
182+
$(_doc_external("MPI_Put"))
183+
"""
164184
function Put(origin_buf::Buffer, target_rank::Integer, target_disp::Integer, win::Win)
165185
# int MPI_Put(const void *origin_addr, int origin_count,
166186
# MPI_Datatype origin_datatype, int target_rank,
@@ -188,6 +208,19 @@ function Fetch_and_op(sourceval, returnval, target_rank::Integer, target_disp::I
188208
sourceval, returnval, Datatype(T), target_rank, target_disp, op, win)
189209
end
190210

211+
"""
212+
Accumulate(origin, target_rank::Integer, target_disp::Integer, op::Op, win::Win)
213+
214+
Combine the content of the `origin` buffer into the target buffer (specified by `win` and
215+
displacement `target_disp`) with reduction operator `op` on the remote rank
216+
`target_rank` using remote memory access.
217+
218+
`origin` can be a [`Buffer`](@ref), or any object for which [`Buffer_send(origin)`](@ref) is defined.
219+
`op` can be any predefined [`Op`](@ref) (custom operators are not supported).
220+
221+
# External links
222+
$(_doc_external("MPI_Accumulate"))
223+
"""
191224
function Accumulate(origin_buf::Buffer, target_rank::Integer, target_disp::Integer, op::Op, win::Win)
192225
# int MPI_Accumulate(const void *origin_addr, int origin_count,
193226
# MPI_Datatype origin_datatype, int target_rank,
@@ -201,6 +234,20 @@ end
201234
Accumulate(origin, target_rank::Integer, target_disp::Integer, op::Op, win::Win) =
202235
Accumulate(Buffer_send(origin), target_rank, target_disp, op, win)
203236

237+
"""
238+
Get_accumulate(origin, result, target_rank::Integer, target_disp::Integer, op::Op, win::Win)
239+
240+
Combine the content of the `origin` buffer into the target buffer (specified by `win` and
241+
displacement `target_disp`) with reduction operator `op` on the remote
242+
rank `target_rank` using remote memory access. `Get_accumulate` also returns the
243+
content of the target buffer _before_ accumulation into the `result` buffer.
244+
245+
`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.
246+
`op` can be any predefined [`Op`](@ref) (custom operators are not supported).
247+
248+
# External links
249+
$(_doc_external("MPI_Get_accumulate"))
250+
"""
204251
function Get_accumulate(origin_buf::Buffer, result_buf::Buffer, target_rank::Integer, target_disp::Integer, op::Op, win::Win)
205252
# int MPI_Get_accumulate(const void *origin_addr, int origin_count,
206253
# MPI_Datatype origin_datatype, void *result_addr,

0 commit comments

Comments
 (0)