Skip to content

Commit 47917bf

Browse files
committed
Added documentation for the find_rcv_ids machinery
1 parent fe32c1c commit 47917bf

7 files changed

Lines changed: 34 additions & 11 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ LocalPreferences.toml
99
docs/build/
1010
tmp/
1111
docs/src/examples.md
12+
docs/src/jacobi_tutorial.md
1213

1314
HPCG/src/results/
1415

docs/src/reference/backends.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
```@autodocs
66
Modules = [PartitionedArrays]
77
Pages = ["mpi_array.jl"]
8+
Filter = t -> string(t) != "find_rcv_ids_ibarrier"
89
```
910

1011
## Debug

docs/src/reference/primitives.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ gather
88
gather!
99
allocate_gather
1010
```
11+
1112
## Scatter
1213

1314
```@docs
@@ -45,7 +46,8 @@ ExchangeGraph(snd)
4546
exchange
4647
exchange!
4748
allocate_exchange
49+
default_find_rcv_ids
50+
set_default_find_rcv_ids
51+
find_rcv_ids_gather_scatter
52+
find_rcv_ids_ibarrier
4853
```
49-
50-
51-

src/PartitionedArrays.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export ExchangeGraph
5858
export exchange
5959
export exchange!
6060
export allocate_exchange
61+
export default_find_rcv_ids
6162
export find_rcv_ids_gather_scatter
6263
export setup_non_blocking_reduction
6364
export non_blocking_reduction

src/mpi_array.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,12 @@ function default_find_rcv_ids(::MPIArray)
671671
end
672672

673673
"""
674-
Implements Alg. 2 in https://dl.acm.org/doi/10.1145/1837853.1693476
675-
The algorithm's complexity is claimed to be O(log(p))
674+
find_rcv_ids_ibarrier(snd_ids::MPIArray)
675+
676+
Finds the `rcv` side of an `ExchangeGraph` out of the `snd` side information.
677+
678+
This strategy implements Alg. 2 in https://dl.acm.org/doi/10.1145/1837853.1693476.
679+
The algorithm's complexity is claimed to be O(log(p)).
676680
"""
677681
function find_rcv_ids_ibarrier(snd_ids::MPIArray{<:AbstractVector{T}}) where T
678682
comm = snd_ids.comm

src/preferences.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
Sets the default algorithm to discover communication neighbors. The available algorithms are:
66
77
- `gather_scatter`: Gathers neighbors in a single processor, builds the communications graph
8-
and then scatters the information back to all processors.
8+
and then scatters the information back to all processors. See [`find_rcv_ids_gather_scatter`](@ref).
99
10-
- `ibarrier`: Implements Alg. 2 in https://dl.acm.org/doi/10.1145/1837853.1693476
10+
- `ibarrier`: Implements Alg. 2 in https://dl.acm.org/doi/10.1145/1837853.1693476. See [`find_rcv_ids_ibarrier`](@ref).
1111
1212
Feature only available in Julia 1.6 and later due to restrictions from `Preferences.jl`.
1313
"""

src/primitives.jl

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,13 @@ function Base.show(io::IO,k::MIME"text/plain",data::ExchangeGraph)
762762
println(io,typeof(data)," with $(length(data.snd)) nodes")
763763
end
764764

765+
"""
766+
default_find_rcv_ids(::AbstractArray)
767+
768+
Provides a default function to find the `rcv` side of an
769+
`ExchangeGraph` out of the `snd` side information.
770+
Its behaviour can be statically changed using [`set_default_find_rcv_ids`](@ref).
771+
"""
765772
function default_find_rcv_ids(::AbstractArray)
766773
find_rcv_ids_gather_scatter
767774
end
@@ -779,10 +786,11 @@ are set to `snd`. Otherwise, either the optional `neighbors` or
779786
`neighbors` is also an `ExchangeGraph`
780787
that contains a super set of the outgoing and incoming neighbors
781788
associated with `snd`. It is used to find the incoming neighbors `rcv`
782-
efficiently. If `neighbors` are not provided, then `find_rcv_ids`
789+
efficiently. If `neighbors` are not provided, then `find_rcv_ids`
783790
is used (either the user-provided or a default one).
784791
`find_rcv_ids` is a function that implements an algorithm to find the
785-
rcv side of the exchange graph out of the snd side information.
792+
rcv side of the exchange graph out of the snd side information. It
793+
defaults to [`default_find_rcv_ids`](@ref).
786794
"""
787795
function ExchangeGraph(snd;
788796
rcv=nothing,
@@ -836,8 +844,14 @@ function ExchangeGraph_impl_with_find_rcv_ids(snd_ids::AbstractArray,find_rcv_id
836844
ExchangeGraph(snd_ids,rcv_ids)
837845
end
838846

839-
# This strategy gathers the communication graph into one process
840-
# and then scatters back the receivers
847+
"""
848+
find_rcv_ids_gather_scatter(snd_ids::AbstractArray)
849+
850+
Finds the `rcv` side of an `ExchangeGraph` out of the `snd` side information.
851+
852+
This strategy gathers the communication graph into one process
853+
and then scatters back the receivers.
854+
"""
841855
function find_rcv_ids_gather_scatter(snd_ids::AbstractArray)
842856
snd_ids_main = gather(snd_ids)
843857
rcv_ids_main = map(snd_ids_main) do snd_ids_main

0 commit comments

Comments
 (0)