|
1 | 1 | name: GPU Test |
2 | | -description: Compile kernels on CPU, then run tests on GPU inside apptainer |
3 | | - |
4 | | -inputs: |
5 | | - arch: |
6 | | - description: 'Target SM architecture (e.g. 90 for H100, 100 for B300)' |
7 | | - required: true |
| 2 | +description: Compile and run tests inside apptainer |
8 | 3 |
|
9 | 4 | runs: |
10 | 5 | using: composite |
11 | 6 | steps: |
12 | | - - name: Compile kernels (CPU only) |
13 | | - shell: bash |
14 | | - run: | |
15 | | - CACHE_DIR=$HOME/.quack_cache_${{ github.run_id }} |
16 | | - mkdir -p "$CACHE_DIR" |
17 | | - apptainer exec --writable-tmpfs \ |
18 | | - --bind "$CACHE_DIR":/cache \ |
19 | | - ~/attention_26.03.07.sif bash -c " |
20 | | - export PYTHONPATH=\$PWD:\$PYTHONPATH && |
21 | | - export QUACK_CACHE_DIR=/cache && |
22 | | - export QUACK_ARCH=${{ inputs.arch }} && |
23 | | - export CUTE_DSL_ARCH=sm_${{ inputs.arch }}a && |
24 | | - pytest tests/ --compile-only -n 24 |
25 | | - " |
26 | | -
|
27 | | - - name: Run tests (GPU) |
| 7 | + - name: Compile and run tests |
28 | 8 | shell: bash |
29 | 9 | run: | |
30 | | - CACHE_DIR=$HOME/.quack_cache_${{ github.run_id }} |
31 | | - apptainer exec --nv --writable-tmpfs \ |
32 | | - --bind "$CACHE_DIR":/cache \ |
33 | | - ~/attention_26.03.07.sif bash -c " |
| 10 | + apptainer exec --nv --writable-tmpfs ~/attention_26.03.07.sif bash -c " |
34 | 11 | export PYTHONPATH=\$PWD:\$PYTHONPATH && |
35 | | - export QUACK_CACHE_DIR=/cache && |
| 12 | + export QUACK_CACHE_DIR=\$HOME/.quack_cache && |
| 13 | + pytest tests/ --compile-only -n 24 && |
36 | 14 | FREE_GPUS=\$(nvidia-smi --query-gpu=index,memory.free --format=csv,noheader,nounits | awk -F', ' '\$2 >= 40000 {print \$1}' | paste -sd,) && |
37 | 15 | if [ -z \"\$FREE_GPUS\" ]; then echo 'No GPUs with >= 40GB free memory'; exit 1; fi && |
38 | 16 | echo \"Running tests on GPUs: \$FREE_GPUS\" && |
39 | 17 | NUM_GPUS=\$(echo \"\$FREE_GPUS\" | tr ',' '\n' | wc -l) && |
40 | 18 | CUDA_VISIBLE_DEVICES=\$FREE_GPUS pytest tests/ -n \$NUM_GPUS |
41 | 19 | " |
42 | | -
|
43 | | - - name: Clean up cache |
44 | | - if: always() |
45 | | - shell: bash |
46 | | - run: rm -rf "$HOME/.quack_cache_${{ github.run_id }}" |
0 commit comments