Skip to content

Commit 501e581

Browse files
authored
Merge branch 'PyLops:main' into complex-support
2 parents ad7205d + 83c336a commit 501e581

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ doc:
5555
rm -rf source/tutorials && rm -rf build &&\
5656
cd .. && sphinx-build -b html docs/source docs/build
5757

58+
doc_nccl:
59+
cp tutorials_nccl/* tutorials/
60+
cd docs && rm -rf source/api/generated && rm -rf source/gallery &&\
61+
rm -rf source/tutorials && rm -rf source/tutorials && rm -rf build &&\
62+
cd .. && sphinx-build -b html docs/source docs/build
63+
rm tutorials/*_nccl.py
64+
5865
docupdate:
5966
cd docs && make html && cd ..
6067

docs/source/conf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import sys
33
import os
44
import datetime
5-
from sphinx_gallery.sorting import ExampleTitleSortKey
65

76
# Sphinx needs to be able to import the package to use autodoc and get the version number
87
sys.path.insert(0, os.path.abspath("../../pylops_mpi"))
@@ -60,7 +59,7 @@
6059
# Remove the "Download all examples" button from the top level gallery
6160
"download_all_examples": False,
6261
# Sort gallery example by file name instead of number of lines (default)
63-
"within_subsection_order": ExampleTitleSortKey,
62+
"within_subsection_order": "ExampleTitleSortKey",
6463
# directory where function granular galleries are stored
6564
"backreferences_dir": "api/generated/backreferences",
6665
# Modules for which function level galleries are created.

docs/source/installation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Additionally, to use the NCCL engine, the following additional
1919
dependencies are required:
2020

2121
* `CuPy <https://cupy.dev/>`_
22-
* `NCCL <https://docs.cupy.dev/en/stable/install.html#additional-cuda-libraries>`_
22+
* `NCCL <https://docs.cupy.dev/en/stable/install.html#additional-cuda-libraries>`__
2323

2424
We highly encourage using the `Anaconda Python distribution <https://www.anaconda.com/download>`_
2525
or its standalone package manager `Conda <https://docs.conda.io/en/latest/index.html>`_. However,
@@ -120,7 +120,7 @@ If you prefer a ``pip`` installation, we provide the following command
120120
Note that, differently from the ``conda`` command, the above **will not** create a virtual environment.
121121
Make sure you create and activate your environment previously.
122122

123-
Simlarly, if you want to enable `NCCL <https://developer.nvidia.com/nccl>`_ but prefer using pip,
123+
Similarly, if you want to enable `NCCL <https://developer.nvidia.com/nccl>`_ but prefer using pip,
124124
you must first check the CUDA version of your system:
125125

126126
.. code-block:: bash

pylops_mpi/DistributedArray.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ def _send(self, send_buf, dest, count=None, tag=None):
526526
count = send_buf.size
527527
nccl_send(self.base_comm_nccl, send_buf, dest, count)
528528
else:
529-
self.base_comm.Send(send_buf, dest, tag)
529+
self.base_comm.send(send_buf, dest, tag)
530530

531531
def _recv(self, recv_buf=None, source=0, count=None, tag=None):
532532
""" Receive operation
@@ -543,11 +543,8 @@ def _recv(self, recv_buf=None, source=0, count=None, tag=None):
543543
else:
544544
raise ValueError("Using recv with NCCL must also supply receiver buffer ")
545545
else:
546-
# MPI allows a receiver buffer to be optional
547-
if recv_buf is None:
548-
return self.base_comm.recv(source=source, tag=tag)
549-
self.base_comm.Recv(buf=recv_buf, source=source, tag=tag)
550-
return recv_buf
546+
# MPI allows a receiver buffer to be optional and receives as a Python Object
547+
return self.base_comm.recv(source=source, tag=tag)
551548

552549
def _nccl_local_shapes(self, masked: bool):
553550
"""Get the the list of shapes of every GPU in the communicator

tutorials/poststack.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,3 +277,6 @@
277277
axs[5][2].imshow(minv3d_reg[:, :, 220].T, cmap='gist_rainbow', vmin=m.min(), vmax=m.max())
278278
axs[5][2].set_title('Regularized Inverted Model iter x-y')
279279
axs[5][2].axis('tight')
280+
281+
###############################################################################
282+
# To run this tutorial with our NCCL backend, refer to :ref:`sphx_glr_tutorials_poststack_nccl.py`

tutorials_nccl/poststack_nccl.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
from pylops.avo.poststack import PoststackLinearModelling
1616

1717
import pylops_mpi
18-
import pylops_mpi.utils
19-
import pylops_mpi.utils._nccl
2018

2119
###############################################################################
2220
# NCCL communication can be easily initialized with
@@ -198,5 +196,3 @@
198196
axs[5][2].imshow(minv3d_reg[:, :, 220].T.get(), cmap='gist_rainbow', vmin=m.min(), vmax=m.max())
199197
axs[5][2].set_title('Regularized Inverted Model iter x-y')
200198
axs[5][2].axis('tight')
201-
202-
plt.savefig("./poststack_inv_nccl.png")

0 commit comments

Comments
 (0)