pylops_mpi.basicoperators.MPIVStack#
- class pylops_mpi.basicoperators.MPIVStack(ops, base_comm=<mpi4py.MPI.Intracomm object>, dtype=None)[source]#
MPI VStack Operator
Create a vertical stack of a set of linear operators using MPI. Each rank must initialize this operator by providing one or more linear operators which will be computed within each rank. Both model and data vectors are of
pylops_mpi.DistributedArray
type.- Parameters:
- ops
list
One or more
pylops.LinearOperator
to be vertically stacked.- base_comm
mpi4py.MPI.Comm
, optional Base MPI Communicator. Defaults to
mpi4py.MPI.COMM_WORLD
.- dtype
str
, optional Type of elements in input array.
- ops
- Attributes:
- shape
tuple
Operator shape
- shape
- Raises:
- ValueError
If
ops
have different number of columns
Notes
An MPIVStack is composed of N linear operators stacked vertically, represented by L. Each rank has one or more
pylops.LinearOperator
, which we represent here compactly as \(\mathbf{L}_i\) for rank \(i\).Each operator performs forward mode operations using its corresponding model vector, denoted as m. This vector is effectively a
pylops_mpi.DistributedArray
withpylops_mpi.Partition.BROADCAST
i.e. broadcasted at all ranks in such a way that the global shape is equal to the local shape of the array and these local shapes agree with the corresponding linear operators.Afterwards, the forward mode of each operator is collected from each rank in a
pylops_mpi.DistributedArray
, represented by d.\[\begin{split}\begin{bmatrix} \mathbf{d}_1 \\ \mathbf{d}_2 \\ \vdots \\ \mathbf{d}_n \end{bmatrix} = \begin{bmatrix} \mathbf{L}_1 \\ \mathbf{L}_2 \\ \vdots \\ \mathbf{L}_n \end{bmatrix} m\end{split}\]Likewise for the adjoint mode, each operator performs adjoint operations using its corresponding model vector, denoted as m which is a
pylops_mpi.DistributedArray
withpylops_mpi.Partition.SCATTER
i.e. partitioned at each rank.Afterwards, a collective reduction operation is performed where adjoint values from linear operators are summed up, and the final sum is broadcasted to all processes in the communicator, represented by d.
\[\begin{split}d = \begin{bmatrix} \mathbf{L}_1^H & \mathbf{L}_2^H & \ldots & \mathbf{L}_n^H \end{bmatrix} \begin{bmatrix} \mathbf{m}_1 \\ \mathbf{m}_2 \\ \vdots \\ \mathbf{m}_n \end{bmatrix}\end{split}\]Methods
__init__
(ops[, base_comm, dtype])adjoint
()Adjoint MPI LinearOperator
conj
()Complex conjugate operator
dot
(x)Matrix Vector Multiplication
matvec
(x)Matrix-vector multiplication.
rmatvec
(x)Adjoint Matrix-vector multiplication.
transpose
()Transposition of MPI LinearOperator