1212
1313
1414class MPILinearOperator :
15- """Common interface for performing matrix-vector products in distributed fashion.
15+ """MPI-enabled PyLops Linear Operator
1616
17- This class provides methods to perform matrix-vector product and adjoint matrix-vector
18- products using MPI.
17+ Common interface for performing matrix-vector products in distributed fashion.
1918
20- .. note:: End users of pylops-mpi should not use this class directly but simply
21- use operators that are already implemented. This class is meant for
22- developers only, it has to be used as the parent class of any new operator
23- developed within pylops-mpi.
19+ In practice, this class provides methods to perform matrix-vector and
20+ adjoint matrix-vector products between any :obj:`pylops.LinearOperator`
21+ (which must be the same across ranks) and a :class:`pylops_mpi.DistributedArray`
22+ with ``Partition.BROADCAST`` and ``Partition.UNSAFE_BROADCAST`` partition. It
23+ internally handles the extraction of the local array from the distributed array
24+ and the creation of the output :class:`pylops_mpi.DistributedArray`.
25+
26+ Note that whilst this operator could also be used with different
27+ :obj:`pylops.LinearOperator` across ranks, and with a
28+ :class:`pylops_mpi.DistributedArray` with ``Partition.SCATTER``, it is however
29+ reccomended to use the :class:`pylops_mpi.basicoperators.MPIBlockDiag` operator
30+ instead as this can also handle distributed arrays with subcommunicators.
2431
2532 Parameters
2633 ----------
27- Op : :obj:`pylops.LinearOperator`, optional
28- Linear Operator. Defaults to ``None`` .
34+ Op : :obj:`pylops.LinearOperator`
35+ PyLops Linear Operator to wrap .
2936 shape : :obj:`tuple(int, int)`, optional
3037 Shape of the MPI Linear Operator. Defaults to ``None``.
3138 dtype : :obj:`str`, optional
@@ -35,7 +42,7 @@ class MPILinearOperator:
3542
3643 """
3744
38- def __init__ (self , Op : Optional [ LinearOperator ] = None , shape : Optional [ShapeLike ] = None ,
45+ def __init__ (self , Op : LinearOperator , shape : Optional [ShapeLike ] = None ,
3946 dtype : Optional [DTypeLike ] = None , base_comm : MPI .Comm = MPI .COMM_WORLD ):
4047 if Op :
4148 self .Op = Op
0 commit comments