Skip to content

Commit

Permalink
[TESTS] Enable parallel pytest in CI for CUDA (triton-lang#1905)
Browse files Browse the repository at this point in the history
Run most of the pytest in parallel, this allows to speed up CI from
36min to 10min for A100 and 22min to 6min for H100. Some tests still
need to run serially like runtime tests.
  • Loading branch information
ThomasRaoux authored Jul 6, 2023
1 parent b45baa5 commit 787cdff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
python3 -m pip install --upgrade pip
python3 -m pip install cmake==3.24
python3 -m pip install --no-build-isolation -vvv '.[tests]'
python3 -m pip install pytest-xdist
- name: Run lit tests
if: ${{ env.BACKEND == 'CUDA'}}
Expand All @@ -82,7 +83,9 @@ jobs:
if: ${{ env.BACKEND == 'CUDA'}}
run: |
cd python/test/unit
python3 -m pytest
python3 -m pytest -n 8 --ignore=runtime
# run runtime tests serially to avoid race condition with cache handling.
python3 -m pytest runtime/
- name: Create artifacts archive
if: ${{(matrix.runner[0] == 'self-hosted') && (matrix.runner[1] == 'V100' || matrix.runner[1] == 'A100' || matrix.runner[1] == 'H100')}}
Expand Down
10 changes: 6 additions & 4 deletions python/test/unit/operators/test_cross_entropy.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ def test_op(M, N, dtype, mode):
# backward pass
elif mode == 'backward':
dy = torch.randn_like(tt_y)
# triton backward
tt_y.backward(dy)
tt_dx = x.grad.clone()
# run torch first to make sure cuda context is initialized
# torch backward
x.grad.zero_()
th_y.backward(dy)
th_dx = x.grad.clone()
# triton backward
x.grad.zero_()
tt_y.backward(dy)
tt_dx = x.grad.clone()

torch.testing.assert_allclose(th_dx, tt_dx)

0 comments on commit 787cdff

Please sign in to comment.