Advanced

Custom partitions

PartitionedArrays.LocalIndicesType
struct LocalIndices

Container for arbitrary local indices.

Properties

  • n_global::Int: Number of global indices.
  • owner::Int32: Id of the part that stores the local indices
  • local_to_global::Vector{Int}: Global ids of the local indices in this part. local_to_global[i_local] is the global id corresponding to the local index number i_local.
  • local_to_owner::Vector{Int32}: Owners of the local ids. local_to_owner[i_local]is the id of the owner of the local index number i_local.

Supertype hierarchy

LocalIndices <: AbstractLocalIndices
source
PartitionedArrays.LocalIndicesMethod
LocalIndices(n_global,owner,local_to_global,local_to_owner)

Build an instance of LocalIndices from the underlying properties n_global, owner, local_to_global, and local_to_owner. The types of these variables need to match the type of the properties in LocalIndices.

source
PartitionedArrays.OwnAndGhostIndicesType
OwnAndGhostIndices

Container for local indices stored as own and ghost indices separately. Local indices are defined by concatenating own and ghost ones.

Properties

  • own::OwnIndices: Container for the own indices.
  • ghost::GhostIndices: Container for the ghost indices.
  • global_to_owner: [optional: it can be nothing] Vector containing the owner of each global id.

Supertype hierarchy

OwnAndGhostIndices{A} <: AbstractLocalIndices

where A=typeof(global_to_owner).

source
PartitionedArrays.OwnIndicesType
struct OwnIndices

Container for own indices.

Properties

  • n_global::Int: Number of global indices
  • owner::Int32: Id of the part that owns these indices
  • own_to_global::Vector{Int}: Global ids of the indices owned by this part. own_to_global[i_own] is the global id corresponding to the own index number i_own.

Supertype hierarchy

OwnIndices <: Any
source
PartitionedArrays.GhostIndicesType
struct GhostIndices

Container for ghost indices.

Properties

  • n_global::Int: Number of global indices
  • ghost_to_global::Vector{Int}: Global ids of the ghost indices in this part. ghost_to_global[i_ghost] is the global id corresponding to the ghost index number i_ghost.
  • ghost_to_owner::Vector{Int32}: Owners of the ghost ids. ghost_to_owner[i_ghost]is the id of the owner of the ghost index number i_ghost.

Supertype hierarchy

GhostIndices <: Any
source

Transform partitions

PartitionedArrays.replace_ghostFunction
replace_ghost(indices,gids,owners)

Replaces the ghost indices in indices with global ids in gids and owners in owners. Returned object takes ownership of gids and owners. This method only makes sense if indices stores ghost ids in separate vectors like in OwnAndGhostIndices. gids should be unique and not being owned by indices.

source
PartitionedArrays.union_ghostFunction
union_ghost(indices,gids,owners)

Make the union of the ghost indices in indices with the global indices gids and owners owners. Return an object of the same type as indices with the new ghost indices and the same own indices as in indices. The result does not take ownership of gids and owners.

source
PartitionedArrays.find_ownerFunction
find_owner(index_partition,global_ids)

Find the owners of the global ids in global_ids. The input global_ids is a vector of vectors distributed over the same parts as index_partition. Each part will look for the owners in parallel, when using a parallel back-end.

Example

julia> using PartitionedArrays

julia> rank = LinearIndices((4,));

julia> index_partition = uniform_partition(rank,10)
4-element Vector{PartitionedArrays.LocalIndicesWithConstantBlockSize{1}}:
 [1, 2]
 [3, 4]
 [5, 6, 7]
 [8, 9, 10]

julia> gids = [[3],[4,5],[7,2],[9,10,1]]
4-element Vector{Vector{Int64}}:
 [3]
 [4, 5]
 [7, 2]
 [9, 10, 1]

julia> find_owner(index_partition,gids)
4-element Vector{Vector{Int32}}:
 [2]
 [2, 3]
 [3, 1]
 [4, 4, 1]
source

Transform indices

Local vector storage

PartitionedArrays.OwnAndGhostVectorsType
struct OwnAndGhostVectors{A,C,T}

Vector type that stores the local values of a PVector instance using a vector of own values, a vector of ghost values, and a permutation. This is not the default data layout of PVector (which is a plain vector), but corresponds to the layout of distributed vectors in other packages, such as PETSc. Use this type to avoid duplicating memory when passing data to these other packages.

Properties

  • own_values::A: The vector of own values.
  • ghost_values::A: The vector of ghost values.
  • permumation::C: A permutation vector such that vcat(own_values,ghost_values)[permutation] corresponds to the local values.

Supertype hierarchy

OwnAndGhostVectors{A,C,T} <: AbstractVector{T}
source

Assembly

PartitionedArrays.assembly_graphFunction
assembly_graph(index_partition;kwargs...)

Return an instance of ExchangeGraph representing the communication graph needed to perform assembly of distributed vectors defined on the index partition index_partition. kwargs are delegated to ExchangeGraph in order to find the receiving neighbors from the sending ones.

Equivalent to

neighbors = assembly_neighbors(index_partition;kwargs...)
ExchangeGraph(neighbors...)
source
PartitionedArrays.assembly_neighborsFunction
neigs_snd, neigs_rcv = assembly_neighbors(index_partition;kwargs...)

Return the ids of the neighbor parts from we send and receive data respectively in the assembly of distributed vectors defined on the index partition index_partition. partition index_partition. kwargs are delegated to ExchangeGraph in order to find the receiving neighbors from the sending ones.

source
PartitionedArrays.assembly_local_indicesFunction
ids_snd, ids_rcv = assembly_local_indices(index_partition)

Return the local ids to be sent and received in the assembly of distributed vectors defined on the index partition index_partition.

Local values corresponding to the local indices in ids_snd[i] (respectively ids_rcv[i]) are sent to part neigs_snd[i] (respectively neigs_rcv[i]), where neigs_snd, neigs_rcv = assembly_neighbors(index_partition).

source