Skip to content

Commit

Permalink
Add single GPU tests workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
runame committed Oct 30, 2024
1 parent 614964a commit 0899ade
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/gpu-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: gpu-tests

on: [push, pull_request]

jobs:
gpu-tests:
name: "Python 3.10"
runs-on: 4-core-ubuntu-gpu-t4
steps:
- uses: actions/checkout@v4
- name: Set up and update uv.
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv self update
- name: Install Python.
run: uv python install 3.10
- name: Create venv and install the package.
run: |
uv venv && source .venv/bin/activate
uv pip install -e ".[dev]"
- name: Run tests.
run: |
source .venv/bin/activate
make test-gpu
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ We actively welcome your pull requests for existing optimizers.
1. Fork the repo and create your branch from `main`. Install the package inside of your Python environment with `pip install -e ".[dev]"`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes. To run the subset of the tests that can be run on CPU use `make test`; to run the subset of tests that require four GPUs use `make test-gpu`.
4. Ensure the test suite passes. To run the subset of the tests that can be run on CPU use `make test`; to run the tests for a single GPU use `make test-gpu` and to run the subset of tests that require 2-4 GPUs use `make test-multi-gpu`.
5. Make sure your code lints. You can use `make lint` and `make format` to automatically lint and format the code where possible.
6. If you haven't already, complete the Contributor License Agreement ("CLA").

Expand Down
4 changes: 4 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ test:
@torchrun --standalone --nnodes=1 --nproc_per_node=2 -m unittest distributed_shampoo/utils/gpu_tests/shampoo_ddp_distributor_test.py

test-gpu:
@python3 -m unittest discover -s distributed_shampoo/gpu_tests/ -p "*_test.py"
@python3 -m unittest distributed_shampoo/utils/gpu_tests/shampoo_dist_utils_test.py

test-multi-gpu:
@torchrun --standalone --nnodes=1 --nproc_per_node=2 -m unittest discover -s distributed_shampoo/gpu_tests/ -p "*_test.py"
@torchrun --standalone --nnodes=1 --nproc_per_node=2 -m unittest distributed_shampoo/utils/gpu_tests/shampoo_dist_utils_test.py
@torchrun --standalone --nnodes=1 --nproc_per_node=2 -m unittest distributed_shampoo/utils/gpu_tests/shampoo_ddp_distributor_test.py
Expand Down

0 comments on commit 0899ade

Please sign in to comment.