Skip to content

Commit 032b4a7

Browse files
authored
Merge pull request #899 from unilabsim/ci/isolate-numba-benchmarks
ci: isolate and cache Numba benchmark smoke
2 parents e85f03f + ed0d3c5 commit 032b4a7

5 files changed

Lines changed: 57 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,61 @@ jobs:
8686
- name: Check
8787
run: uv run pyright
8888

89+
benchmark-smoke:
90+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request'
91+
timeout-minutes: 10
92+
runs-on: ubuntu-slim
93+
env:
94+
NUMBA_CACHE_DIR: ${{ github.workspace }}/.cache/numba
95+
# Cached machine code must be portable across hosted runner CPU models.
96+
NUMBA_CPU_NAME: generic
97+
NUMBA_NUM_THREADS: "1"
98+
steps:
99+
- uses: actions/checkout@v6.0.2
100+
with:
101+
ref: ${{ github.event_name == 'workflow_dispatch' && github.ref || format('refs/pull/{0}/merge', github.event.pull_request.number) }}
102+
persist-credentials: false
103+
- name: Install uv
104+
uses: astral-sh/setup-uv@v8.0.0
105+
with:
106+
python-version: '3.11'
107+
# Numba validates disk caches with source mtime and size; hashFiles guards content.
108+
- name: Normalize Numba source timestamps
109+
run: find src/unilab benchmark -type f -name '*numba*.py' -exec touch -d @946684800 {} +
110+
- name: Restore Numba cache
111+
uses: actions/cache@v4
112+
with:
113+
path: ${{ env.NUMBA_CACHE_DIR }}
114+
key: numba-v1-${{ runner.os }}-${{ runner.arch }}-py311-${{ hashFiles('uv.lock', 'src/unilab/**/*numba*.py', 'benchmark/**/*numba*.py') }}
115+
- name: Install dependencies
116+
run: |
117+
uv sync --extra mujoco \
118+
--no-install-package torch \
119+
--no-install-package nvidia-cublas-cu12 \
120+
--no-install-package nvidia-cuda-cupti-cu12 \
121+
--no-install-package nvidia-cuda-nvrtc-cu12 \
122+
--no-install-package nvidia-cuda-runtime-cu12 \
123+
--no-install-package nvidia-cudnn-cu12 \
124+
--no-install-package nvidia-cufft-cu12 \
125+
--no-install-package nvidia-cufile-cu12 \
126+
--no-install-package nvidia-curand-cu12 \
127+
--no-install-package nvidia-cusolver-cu12 \
128+
--no-install-package nvidia-cusparse-cu12 \
129+
--no-install-package nvidia-cusparselt-cu12 \
130+
--no-install-package nvidia-nccl-cu12 \
131+
--no-install-package nvidia-nvjitlink-cu12 \
132+
--no-install-package nvidia-nvtx-cu12 \
133+
--no-install-package triton
134+
uv pip install torch==2.7.0 --index-url https://download.pytorch.org/whl/cpu
135+
- name: Benchmark entrypoint smoke test
136+
run: uv run --no-sync python benchmark/smoke_test.py
137+
- name: Numba benchmark contracts
138+
run: |
139+
uv run --no-sync pytest -q \
140+
benchmark/env/test_g1_joystick_numba_benchmark.py \
141+
benchmark/env/test_g1_motion_tracking_numba_benchmark.py \
142+
benchmark/env/test_numba_random_noise_benchmark.py
143+
89144
test:
90145
if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request'
91146
strategy:
@@ -125,7 +180,5 @@ jobs:
125180
--no-install-package nvidia-nvtx-cu12 \
126181
--no-install-package triton
127182
uv pip install torch==2.7.0 --index-url https://download.pytorch.org/whl/cpu
128-
- name: Benchmark entrypoint smoke test
129-
run: uv run --no-sync python benchmark/smoke_test.py
130183
- name: Test with coverage
131184
run: uv run --no-sync pytest -m "not slow" --cov=src/unilab --cov-report "markdown-append:${GITHUB_STEP_SUMMARY:-/dev/null}" --cov-fail-under=25
File renamed without changes.

tests/benchmark/test_g1_motion_tracking_numba_benchmark.py renamed to benchmark/env/test_g1_motion_tracking_numba_benchmark.py

File renamed without changes.

tests/benchmark/test_numba_random_noise_benchmark.py renamed to benchmark/env/test_numba_random_noise_benchmark.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import math
44

55
import numpy as np
6+
67
from benchmark.env import benchmark_numba_random_noise as bench
78

89

tests/algos/test_offpolicy_double_buffer_runner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,6 +2219,7 @@ def _dummy_exit_immediately() -> None:
22192219
_sys.exit(0)
22202220

22212221

2222+
@pytest.mark.slow
22222223
def test_safe_put_trainer_done_does_not_deadlock_on_real_dead_collector():
22232224
"""End-to-end: real Process exits, _safe_put detects death and raises fast.
22242225

0 commit comments

Comments
 (0)