Skip to content

Commit a61dd4e

Browse files
authored
Merge pull request #671 from mrava87/doc-cupytest
build: added make rules for tests on gpu and more on documentation
2 parents a859393 + 40624af commit a61dd4e

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ that the both old and new tests pass successfully:
6363
make tests
6464
```
6565
66+
If you have access to a GPU, it is advised also that old and new tests run with the CuPy
67+
backend pass successfully:
68+
```
69+
make tests_gpu
70+
```
71+
6672
4. Run flake8 to check the quality of your code:
6773
```
6874
make lint

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PIP := $(shell command -v pip3 2> /dev/null || command which pip 2> /dev/null)
22
PYTHON := $(shell command -v python3 2> /dev/null || command which python 2> /dev/null)
33

4-
.PHONY: install dev-install dev-install_gpu install_conda dev-install_conda dev-install_conda_arm tests doc docupdate servedoc lint typeannot coverage
4+
.PHONY: install dev-install dev-install_gpu install_conda dev-install_conda dev-install_conda_arm tests tests_cpu_ongpu tests_gpu doc docupdate servedoc lint typeannot coverage
55

66
pipcheck:
77
ifndef PIP
@@ -42,9 +42,20 @@ dev-install_conda_gpu:
4242
conda env create -f environment-dev-gpu.yml && conda activate pylops_gpu && pip install -e .
4343

4444
tests:
45+
# Run tests with CPU
4546
make pythoncheck
4647
pytest
4748

49+
tests_cpu_ongpu:
50+
# Run tests with CPU on a system with GPU (and CuPy installed)
51+
make pythoncheck
52+
export CUPY_PYLOPS=0 && export TEST_CUPY_PYLOPS=0 && pytest
53+
54+
tests_gpu:
55+
# Run tests with GPU (requires CuPy to be installed)
56+
make pythoncheck
57+
export TEST_CUPY_PYLOPS=1 && pytest
58+
4859
doc:
4960
cd docs && rm -rf source/api/generated && rm -rf source/gallery &&\
5061
rm -rf source/tutorials && rm -rf build && make html && cd ..

docs/source/contributing.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ that the both old and new tests pass successfully:
7575
7676
>> make tests
7777
78+
If you have access to a GPU, it is advised also that old and new tests run with the CuPy
79+
backend pass successfully:
80+
81+
.. code-block:: bash
82+
83+
>> make tests_gpu
84+
7885
4. Run flake8 to check the quality of your code:
7986

8087
.. code-block:: bash

docs/source/gpu.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@ be also wrapped into a :class:`pylops.JaxOperator`.
3232
See below for a comphrensive list of supported operators and additional functionalities for both the
3333
``cupy`` and ``jax`` backends.
3434

35+
Install dependencies
36+
--------------------
37+
GPU-enabled development environments can created using ``conda``
38+
39+
.. code-block:: bash
40+
41+
>> make dev-install_conda_gpu
42+
43+
or ``pip``
44+
45+
.. code-block:: bash
46+
47+
>> make dev-install_gpu
48+
3549
3650
Examples
3751
--------

0 commit comments

Comments
 (0)