22# DeepSpeed CI - AWS L40S GPU Full Tests (PyTorch Latest)
33#
44# Runs the full DeepSpeed unit test suite on AWS self-hosted runners.
5- # Uses 4x NVIDIA L40S GPUs on g6e.12xlarge instances.
5+ # Prefers 4x NVIDIA L40S GPUs on g6e.12xlarge instances, with AWS-side
6+ # fallback to 8x A100 nodes when L40S capacity is unavailable.
67#
78# This workflow runs:
89# - Parallel tests with pytest-xdist (-n 8)
910# - Sequential tests marked with @pytest.mark.sequential
10- #
11- # Nightly schedule: skips if no new commits since last successful run.
11+ # - Nightly schedule: skips if no new commits since last successful run
1212# ###############################################################################
1313
1414name : aws-torch-latest-full
2626 check-changes :
2727 name : Check for new commits
2828 runs-on : ubuntu-latest
29- # Only check on schedule; workflow_dispatch always runs
3029 if : github.event_name == 'schedule'
3130 outputs :
3231 has_changes : ${{ steps.check.outputs.has_changes }}
@@ -38,28 +37,26 @@ jobs:
3837 run : |
3938 default_branch="${{ github.event.repository.default_branch }}"
4039
41- # Get the HEAD SHA of the last successful run of this workflow
4240 last_sha=$(gh api \
4341 "repos/${{ github.repository }}/actions/workflows/aws-torch-latest-full.yml/runs?status=success&branch=${default_branch}&per_page=1" \
4442 --jq '.workflow_runs[0].head_sha // empty')
4543
4644 current_sha="${{ github.sha }}"
4745
4846 if [ -z "$last_sha" ]; then
49- echo "No previous successful run found — running tests"
47+ echo "No previous successful run found - running tests"
5048 echo "has_changes=true" >> "$GITHUB_OUTPUT"
5149 elif [ "$last_sha" = "$current_sha" ]; then
52- echo "No new commits since last successful run ($last_sha) — skipping"
50+ echo "No new commits since last successful run ($last_sha) - skipping"
5351 echo "has_changes=false" >> "$GITHUB_OUTPUT"
5452 else
55- echo "New commits detected: $last_sha -> $current_sha — running tests"
53+ echo "New commits detected: $last_sha -> $current_sha - running tests"
5654 echo "has_changes=true" >> "$GITHUB_OUTPUT"
5755 fi
5856
5957 unit-tests :
6058 name : Unit Tests (Full)
6159 needs : [check-changes]
62- # Run if: (a) workflow_dispatch, or (b) schedule with new commits
6360 if : |
6461 always() &&
6562 (github.event_name == 'workflow_dispatch' || needs.check-changes.outputs.has_changes == 'true')
@@ -134,8 +131,30 @@ jobs:
134131 echo "CUTLASS_PATH: $CUTLASS_PATH"
135132 ls -la $CUTLASS_PATH/include/ | head -5
136133
134+ - name : Detect GPU architecture
135+ run : |
136+ python - <<'PY'
137+ import os
138+ import torch
139+
140+ torch.cuda.init()
141+ major, minor = torch.cuda.get_device_capability(0)
142+ arch = f"{major}.{minor}"
143+ gpu_count = torch.cuda.device_count()
144+ gpu_name = torch.cuda.get_device_name(0)
145+
146+ with open(os.environ["GITHUB_ENV"], "a", encoding="utf-8") as env_file:
147+ env_file.write(f"TORCH_CUDA_ARCH_LIST={arch}\n")
148+ env_file.write(f"GPU_COUNT={gpu_count}\n")
149+
150+ print(f"Detected GPU: {gpu_name}")
151+ print(f"Detected compute capability: {arch}")
152+ print(f"Detected GPU count: {gpu_count}")
153+ PY
154+
137155 - name : Install DeepSpeed
138156 run : |
157+ echo "Using TORCH_CUDA_ARCH_LIST=$TORCH_CUDA_ARCH_LIST"
139158 # Initialize CUDA before install so setup.py can detect NCCL version
140159 python -c "import torch; torch.cuda.init(); print(f'NCCL version: {torch.cuda.nccl.version()}')"
141160 # Use --no-build-isolation so setup.py can access pre-installed PyTorch
@@ -148,7 +167,7 @@ jobs:
148167
149168 - name : Unit tests (parallel)
150169 run : |
151- export TORCH_CUDA_ARCH_LIST="8.9 "
170+ echo "Running parallel tests with TORCH_CUDA_ARCH_LIST=$TORCH_CUDA_ARCH_LIST on $GPU_COUNT GPUs "
152171 cd tests
153172 # Skip tests requiring unavailable hardware or known issues:
154173 # - nvme checkpointing: no nvme device
@@ -166,7 +185,7 @@ jobs:
166185
167186 - name : Unit tests (sequential)
168187 run : |
169- export TORCH_CUDA_ARCH_LIST="8.9 "
188+ echo "Running sequential tests with TORCH_CUDA_ARCH_LIST=$TORCH_CUDA_ARCH_LIST on $GPU_COUNT GPUs "
170189 cd tests
171190 rm -rf /mnt/aio/pytest
172191 pytest --instafail --timeout 600 --forked -m 'sequential' --basetemp=/mnt/aio/pytest unit/ \
0 commit comments