Back-ends
MPI
PartitionedArrays.MPIArray
— TypeMPIArray{T,N}
Represent an array of element type T
and number of dimensions N
, where each item in the array is stored in a separate MPI process. I.e., each MPI rank stores only one item. For arrays that can store more than one item per rank see PVector
or PSparseMatrix
. This struct implements the Julia array interface. However, using setindex!
and getindex!
is disabled for performance reasons (communication cost).
Properties
The fields of this struct (and the inner constructors) are private. To generate an instance of MPIArray
use function distribute_with_mpi
.
Supertype hierarchy
MPIArray{T,N} <: AbstractArray{T,N}
PartitionedArrays.distribute_with_mpi
— Methoddistribute_with_mpi(a;comm::MPI.Comm=MPI.COMM_WORLD,duplicate_comm=true)
Create an MPIArray
instance by distributing the items in the collection a
over the ranks of the given MPI communicator comm
. Each rank receives exactly one item, thus length(a)
and the communicator size need to match. For arrays that can store more than one item per rank see PVector
or PSparseMatrix
. If duplicate_comm=false
the result will take ownership of the given communicator. Otherwise, a copy will be done with MPI.Comm_dup(comm)
.
This function calls MPI.Init()
if MPI is not initialized yet.
PartitionedArrays.find_rcv_ids_ibarrier
— MethodImplements Alg. 2 in https://dl.acm.org/doi/10.1145/1837853.1693476 The algorithm's complexity is claimed to be O(log(p))
PartitionedArrays.with_mpi
— Methodwith_mpi(f;comm=MPI.COMM_WORLD,duplicate_comm=true)
Call f(a->distribute_with_mpi(a;comm,duplicate_comm))
and abort MPI if there was an error. This is the safest way of running the function f
using MPI.
This function calls MPI.Init()
if MPI is not initialized yet.
Debug
PartitionedArrays.DebugArray
— Typestruct DebugArray{T,N}
Data structure that emulates the limitations of MPIArray
, but that can be used on a standard sequential (a.k.a. serial) Julia session. This struct implements the Julia array interface. Like for MPIArray
, using setindex!
and getindex
on DebugArray
is disabled since this will not be efficient in actual parallel runs (communication cost).
Properties
The fields of this struct are private.
Supertype hierarchy
DebugArray{T,N} <: AbstractArray{T,N}
PartitionedArrays.DebugArray
— MethodDebugArray(a)
Create a DebugArray{T,N}
data object from the items in collection a
, where T=eltype(a)
and N=ndims(a)
. If a::Array{T,N}
, then the result takes ownership of the input. Otherwise, a copy of the input is created.
PartitionedArrays.with_debug
— Methodwith_debug(f)
Call f(DebugArray)
.