12
12
13
13
14
14
class MPILinearOperator :
15
- """Common interface for performing matrix-vector products in distributed fashion.
15
+ """MPI-enabled PyLops Linear Operator
16
16
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.
19
18
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.
24
31
25
32
Parameters
26
33
----------
27
- Op : :obj:`pylops.LinearOperator`, optional
28
- Linear Operator. Defaults to ``None`` .
34
+ Op : :obj:`pylops.LinearOperator`
35
+ PyLops Linear Operator to wrap .
29
36
shape : :obj:`tuple(int, int)`, optional
30
37
Shape of the MPI Linear Operator. Defaults to ``None``.
31
38
dtype : :obj:`str`, optional
@@ -35,7 +42,7 @@ class MPILinearOperator:
35
42
36
43
"""
37
44
38
- def __init__ (self , Op : Optional [ LinearOperator ] = None , shape : Optional [ShapeLike ] = None ,
45
+ def __init__ (self , Op : LinearOperator , shape : Optional [ShapeLike ] = None ,
39
46
dtype : Optional [DTypeLike ] = None , base_comm : MPI .Comm = MPI .COMM_WORLD ):
40
47
if Op :
41
48
self .Op = Op
0 commit comments