Skip to content

Commit 838ed0b

Browse files
committed
feat: moved _send to Distributed
1 parent 64854bb commit 838ed0b

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

pylops_mpi/Distributed.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from mpi4py import MPI
44
from pylops.utils import deps as pylops_deps # avoid namespace crashes with pylops_mpi.utils
5-
from pylops_mpi.utils._mpi import mpi_allreduce
5+
from pylops_mpi.utils._mpi import mpi_allreduce, mpi_send
66
from pylops_mpi.utils import deps
77

88
cupy_message = pylops_deps.cupy_import("the DistributedArray module")
@@ -43,3 +43,15 @@ def _allreduce_subcomm(self, send_buf, recv_buf=None, op: MPI.Op = MPI.SUM):
4343
else:
4444
return mpi_allreduce(self.sub_comm, send_buf,
4545
recv_buf, self.engine, op)
46+
47+
def _send(self, send_buf, dest, count=None, tag=0):
48+
"""Send operation
49+
"""
50+
if deps.nccl_enabled and self.base_comm_nccl:
51+
if count is None:
52+
count = send_buf.size
53+
nccl_send(self.base_comm_nccl, send_buf, dest, count)
54+
else:
55+
mpi_send(self.base_comm,
56+
send_buf, dest, count, tag=tag,
57+
engine=self.engine)

pylops_mpi/DistributedArray.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -507,18 +507,6 @@ def _allgather_subcomm(self, send_buf, recv_buf=None):
507507
return self.sub_comm.allgather(send_buf)
508508
self.sub_comm.Allgather(send_buf, recv_buf)
509509

510-
def _send(self, send_buf, dest, count=None, tag=0):
511-
"""Send operation
512-
"""
513-
if deps.nccl_enabled and self.base_comm_nccl:
514-
if count is None:
515-
count = send_buf.size
516-
nccl_send(self.base_comm_nccl, send_buf, dest, count)
517-
else:
518-
mpi_send(self.base_comm,
519-
send_buf, dest, count, tag=tag,
520-
engine=self.engine)
521-
522510
def _recv(self, recv_buf=None, source=0, count=None, tag=0):
523511
"""Receive operation
524512
"""

0 commit comments

Comments
 (0)