pylops_mpi.DistributedArray#

class pylops_mpi.DistributedArray(global_shape, base_comm=<mpi4py.MPI.Intracomm object>, partition=Partition.SCATTER, axis=0, local_shapes=None, mask=None, engine='numpy', dtype=<class 'numpy.float64'>)[source]#

Distributed Numpy Arrays

Multidimensional NumPy-like distributed arrays. It brings NumPy arrays to high-performance computing.

Warning

When setting the partition of the DistributedArray to pylops_mpi.Partition.BROADCAST, it is crucial to be aware that any attempts to make arrays different from rank to rank will be overwritten by the actions of rank 0. This is accomplished internally by broadcasting the content of rank 0 every time a modification of the array is attempted. Such a behaviour does however incur a cost as communication may be not needed if the user ensures not to modify the content of the array in different ranks in a different way. To avoid broadcasting, one can use pylops_mpi.Partition.UNSAFE_BROADCAST instead.

Parameters:
global_shapetuple or int

Shape of the global array.

base_commmpi4py.MPI.Comm, optional

MPI Communicator over which array is distributed. Defaults to mpi4py.MPI.COMM_WORLD.

partitionPartition, optional

Broadcast, UnsafeBroadcast, or Scatter the array. Defaults to Partition.SCATTER.

axisint, optional

Axis along which distribution occurs. Defaults to 0.

local_shapeslist, optional

List of tuples or integers representing local shapes at each rank.

masklist, optional

Mask defining subsets of ranks to consider when performing ‘global’ operations on the distributed array such as dot product or norm.

enginestr, optional

Engine used to store array (numpy or cupy)

dtypestr, optional

Type of elements in input array. Defaults to numpy.float64.

Methods

__init__(global_shape[, base_comm, ...])

add(dist_array)

Distributed Addition of arrays

add_ghost_cells([cells_front, cells_back])

Add ghost cells to the DistributedArray along the axis of partition at each rank.

asarray()

Global view of the array

conj()

Distributed conj() method

copy()

Creates a copy of the DistributedArray

dot(dist_array)

Distributed Dot Product

iadd(dist_array)

Distributed In-place Addition of arrays

multiply(dist_array)

Distributed Element-wise multiplication

norm([ord, axis])

Distributed numpy.linalg.norm method

ravel([order])

Return a flattened DistributedArray

to_dist(x[, base_comm, partition, axis, ...])

Convert A Global Array to a Distributed Array

zeros_like()

Creates a copy of the DistributedArray filled with zeros

Examples using pylops_mpi.DistributedArray#

CGLS Solver

CGLS Solver

Derivatives

Derivatives

Distributed Array

Distributed Array

MPILinearOperator

MPILinearOperator

Multi-Dimensional Convolution

Multi-Dimensional Convolution

Stacked Array

Stacked Array

Stacking Operators

Stacking Operators

Least-squares Migration

Least-squares Migration

Multi-Dimensional Deconvolution

Multi-Dimensional Deconvolution

Post Stack Inversion - 3D

Post Stack Inversion - 3D