Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions pylops_mpi/DistributedArray.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def mask(self):

Returns
-------
engine : :obj:`list`
mask : :obj:`list`
"""
return self._mask

Expand Down Expand Up @@ -288,11 +288,7 @@ def rank(self):
-------
rank : :obj:`int`
"""
# cp.cuda.Device().id will give local rank
# It works ok in the single-node multi-gpu environment.
# But in multi-node environment, the function will break.
# So we have to use MPI.COMM_WORLD() in both cases of base_comm (MPI and NCCL)
return MPI.COMM_WORLD.Get_rank()
return self.base_comm.Get_rank()

@property
def size(self):
Expand All @@ -303,7 +299,7 @@ def size(self):
-------
size : :obj:`int`
"""
return MPI.COMM_WORLD.Get_size()
return self.base_comm.Get_size()

@property
def axis(self):
Expand Down Expand Up @@ -812,8 +808,8 @@ def __init__(self, distarrays: List, base_comm: MPI.Comm = MPI.COMM_WORLD):
self.distarrays = distarrays
self.narrays = len(distarrays)
self.base_comm = base_comm
self.rank = MPI.COMM_WORLD.Get_rank()
self.size = MPI.COMM_WORLD.Get_size()
self.rank = base_comm.Get_rank()
self.size = base_comm.Get_size()

def __getitem__(self, index):
return self.distarrays[index]
Expand Down
3 changes: 1 addition & 2 deletions pylops_mpi/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# isort: skip_file

# currently dottest create circular dependency with DistributedArray.py
# from .dottest import *
from .dottest import *
from .deps import *
2 changes: 1 addition & 1 deletion pylops_mpi/utils/dottest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np

from pylops_mpi.DistributedArray import DistributedArray
from pylops_mpi import DistributedArray
from pylops.utils.backend import to_numpy


Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ python_files = tests/*.py tests_nccl/*.py
[flake8]
ignore = E203, E501, W503, E402
per-file-ignores =
__init__.py: F401, F403, F405
__init__.py: F401, F403, F405
max-line-length = 88
2 changes: 1 addition & 1 deletion tests/test_fredholm.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def test_Fredholm1(par):
y_adj_dist = Fop_MPI.H @ y_dist
y_adj = y_adj_dist.asarray()
# Dot test
dottest(Fop_MPI, x, y_dist, par["nsl"] * par["nx"] * par["nz"],par["nsl"] * par["ny"] * par["nz"])
dottest(Fop_MPI, x, y_dist, par["nsl"] * par["nx"] * par["nz"], par["nsl"] * par["ny"] * par["nz"])

if rank == 0:
Fop = pylops.signalprocessing.Fredholm1(
Expand Down
1 change: 0 additions & 1 deletion tutorials/mdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"""

import numpy as np
from scipy.signal import filtfilt
from matplotlib import pyplot as plt
from mpi4py import MPI

Expand Down