Skip to content

Commit 8b19ed3

Browse files
authored
Merge pull request #181 from mrava87/ci-gputests
ci: added nccl tests to cupy GA
2 parents 935f5d6 + b479ebc commit 8b19ed3

2 files changed

Lines changed: 42 additions & 3 deletions

File tree

.github/workflows/build_cupy.yml

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: PyLops-MPI (CuPy)
33
on: [push, pull_request]
44

55
jobs:
6-
build:
6+
build-mpi:
77
strategy:
88
matrix:
99
rank: ['2','4']
@@ -32,6 +32,39 @@ jobs:
3232
- name: Tests with pytest
3333
run: |
3434
export CUPY_PYLOPS=1; export TEST_CUPY_PYLOPS=1; export PYLOPS_MPI_CUDA_AWARE=0
35-
export PYTEST=.venv-pylops/bin/pytest
36-
srun --account=yuxilab -n ${{matrix.rank}} -N 1 --gres=gpu:L40S:${{matrix.rank}} $PYTEST
35+
export PYTEST=".venv-pylops/bin/pytest tests/ --with-mpi"
36+
srun --account=yuxilab --mpi=pmix -n ${{matrix.rank}} -N 1 --gres=gpu:L40S:${{matrix.rank}} $PYTEST
37+
echo "done!"
38+
39+
build-nccl:
40+
strategy:
41+
matrix:
42+
rank: ['2','4']
43+
runs-on: self-hosted
44+
steps:
45+
- name: Check out source repository
46+
uses: actions/checkout@v4
47+
- name: Set up Python environment and Install dependencies and pylops
48+
run: |
49+
python3 -m venv .venv-pylops
50+
# write install scripts
51+
cat << 'EOF' > pylops_tests.sh
52+
#!/bin/bash
53+
PYTHON=.venv-pylops/bin/python3
54+
PIP=.venv-pylops/bin/pip
55+
ls $PYTHON
56+
ls $PIP
57+
$PIP install --upgrade pip setuptools
58+
$PIP install flake8 pytest setuptools-scm
59+
$PIP install -r requirements-dev.txt
60+
$PIP install cupy-cuda12x nvidia-nccl-cu12
61+
$PYTHON -m setuptools_scm
62+
$PIP install .
63+
EOF
64+
srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash pylops_tests.sh
65+
- name: Tests with pytest
66+
run: |
67+
export CUPY_PYLOPS=1;
68+
export PYTEST=".venv-pylops/bin/pytest tests_nccl/ --with-mpi"
69+
srun --account=yuxilab --mpi=pmix -n ${{matrix.rank}} -N 1 --gres=gpu:L40S:${{matrix.rank}} $PYTEST
3770
echo "done!"

tests_nccl/test_ncclutils_nccl.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from pylops_mpi.utils._nccl import initialize_nccl_comm, nccl_allgather
1212
from pylops_mpi.utils._common import _prepare_allgather_inputs, _unroll_allgather_recv
13+
from pylops_mpi.utils.deps import nccl_enabled
1314

1415
np.random.seed(42)
1516

@@ -18,6 +19,11 @@
1819
par1 = {'n': 3, 'dtype': np.float64}
1920

2021

22+
def test_nccl_enabled():
23+
"""Test nccl_enabled is True (ensures that the tests are effectively
24+
run with NCCL and not with the MPI fallack)"""
25+
assert nccl_enabled
26+
2127
@pytest.mark.mpi(min_size=2)
2228
@pytest.mark.parametrize("par", [(par1), ])
2329
def test_allgather_samesize(par):

0 commit comments

Comments
 (0)