Skip to content

Commit 0034d78

Browse files
authored
Reduce CI time (#4015)
1 parent 71452a4 commit 0034d78

23 files changed

Lines changed: 696 additions & 130 deletions

.github/workflows/aws_gpu_benchmarks.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,13 @@ jobs:
149149
# Keep resolution 128 in the shared benchmark for nightly ASV collection.
150150
NEWTON_ASV_PR_GATE: "1"
151151
run: |
152-
# Gate this PR job on directly measured runtimes only.
153-
uvx --with virtualenv asv continuous \
154-
--launch-method spawn \
155-
--interleave-rounds \
156-
--append-samples \
157-
--no-only-changed \
158-
-e \
159-
-b 'Fast\w*\.time_' \
160-
-b 'Fast(?!NewtonOverhead)\w*\.track_simulate(\(|$)' \
161-
-b 'Fast\w*\.track_(mean|p95)_\w*(time|ms)(\(|$)' \
162-
${{ inputs.base_ref }} \
163-
${{ inputs.ref }}
152+
# The PR environment intentionally omits PyTorch: fast DR Legs metrics
153+
# disable policy inference, and no selected benchmark imports it.
154+
#
155+
# Keep representative camera output modes and teleop tail latency;
156+
# full ASV collection retains every metric. Interleave rounds across
157+
# revisions to control cold-start and ordering bias.
158+
python asv/run_pr_benchmarks.py ${{ inputs.base_ref }} ${{ inputs.ref }}
164159
continue-on-error: true
165160
id: benchmark
166161

asv.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"default_benchmark_timeout": 600,
1616
"build_command": ["python -m build --wheel -o {build_cache_dir} {build_dir}"],
1717
"install_command": [
18-
"in-dir={env_dir} python -m pip install {wheel_file}[dev] --extra-index-url=https://pypi.nvidia.com/",
1918
"in-dir={env_dir} python -m pip install warp-lang==1.17.0.dev20260807 mujoco==3.11.0 mujoco-warp==3.11.0 --extra-index-url=https://pypi.nvidia.com/",
19+
"in-dir={env_dir} python -m pip install {wheel_file}[examples] --extra-index-url=https://pypi.nvidia.com/",
2020
"python -m pip install torch==2.10.0+cu130 --index-url https://download.pytorch.org/whl/cu130",
2121
"python -m pip install 'asv_runner<0.3.0'"
2222
]

asv/benchmarks/benchmark_config.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 The Newton Developers
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
import os
5+
6+
7+
def pr_gate_repeat(default: int, pr_repeat: int = 3) -> int:
8+
"""Return a bounded PR sample count without changing full ASV runs."""
9+
if os.environ.get("NEWTON_ASV_PR_GATE"):
10+
return min(default, pr_repeat)
11+
return default

asv/benchmarks/simulation/bench_cloth.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66

77
wp.config.log_level = wp.LOG_WARNING
88

9+
import os
10+
import sys
11+
12+
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
13+
sys.path.append(parent_dir)
14+
15+
from benchmark_config import pr_gate_repeat
16+
917
import newton.examples
1018
from newton.examples.cloth.example_cloth_franka import Example as ExampleClothManipulation
1119
from newton.examples.cloth.example_cloth_twist import Example as ExampleClothTwist
@@ -33,7 +41,7 @@ def time_simulate(self):
3341

3442

3543
class FastExampleClothTwist:
36-
repeat = 5
44+
repeat = pr_gate_repeat(5)
3745
number = 1
3846

3947
def setup(self):

asv/benchmarks/simulation/bench_contacts.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@
88
wp.config.log_level = wp.LOG_WARNING
99

1010
import importlib
11+
import os
12+
import sys
1113
from typing import ClassVar
1214

1315
import numpy as np
1416

17+
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
18+
sys.path.append(parent_dir)
19+
20+
from benchmark_config import pr_gate_repeat
21+
1522
import newton.examples
1623
from newton.viewer import ViewerNull
1724

@@ -267,7 +274,7 @@ class FastConvexCollision:
267274

268275
params = (CONVEX_COLLISION_CASES,)
269276
param_names: ClassVar[list[str]] = ["case"]
270-
repeat = 5
277+
repeat = pr_gate_repeat(5)
271278
number = 1
272279

273280
def setup(self, case):

asv/benchmarks/simulation/bench_ik.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
1717
sys.path.append(parent_dir)
1818

19+
from benchmark_config import pr_gate_repeat
1920
from benchmark_ik import build_ik_solver, create_franka_model, eval_success, fk_targets, random_solutions
2021

2122

@@ -89,7 +90,7 @@ def teardown(self, batch_size):
8990

9091
class FastIKSolve(_IKBenchmark):
9192
params = ([512],)
92-
repeat = 6
93+
repeat = pr_gate_repeat(6)
9394

9495

9596
if __name__ == "__main__":

asv/benchmarks/simulation/bench_inverse_dynamics.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
1919
sys.path.append(parent_dir)
2020

21+
from benchmark_config import pr_gate_repeat
2122
from benchmark_inverse_dynamics import create_franka_model, set_default_pose
2223

2324

@@ -127,7 +128,7 @@ class FastInverseDynamics(_InverseDynamicsBenchmark):
127128
``eval_inverse_dynamics_force`` on a model replicating the Franka arm
128129
across ``WORLD_COUNT`` worlds (default 1024)."""
129130

130-
repeat = 6
131+
repeat = pr_gate_repeat(6)
131132

132133

133134
if __name__ == "__main__":

asv/benchmarks/simulation/bench_mujoco.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ class FastAllegro(_KpiBenchmark):
329329
environment = "None"
330330

331331
def setup_cache(self):
332+
if os.environ.get("NEWTON_ASV_PR_GATE"):
333+
self.num_frames = 200
334+
self.samples = 1
332335
return self._collect_metrics()
333336

334337

asv/benchmarks/simulation/bench_quadruped_xpbd.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
1414
sys.path.append(parent_dir)
1515

16+
from benchmark_config import pr_gate_repeat
1617
from benchmark_metric_tracks import _SimulationMetricTracksUnparameterized
1718
from benchmark_metrics import (
1819
collect_simulation_metrics,
@@ -33,7 +34,7 @@ def _create_example(num_frames, world_count):
3334

3435

3536
class FastExampleQuadrupedXPBD:
36-
repeat = 10
37+
repeat = pr_gate_repeat(10)
3738
number = 1
3839

3940
def setup(self):

asv/benchmarks/simulation/bench_selection.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,21 @@
77
wp.config.enable_backward = False
88
wp.config.log_level = wp.LOG_WARNING
99

10+
import os
11+
import sys
12+
13+
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
14+
sys.path.append(parent_dir)
15+
16+
from benchmark_config import pr_gate_repeat
17+
1018
import newton
1119
import newton.examples
1220
from newton.examples.selection.example_selection_cartpole import Example
1321

1422

1523
class FastExampleSelectionCartpoleMuJoCo:
16-
repeat = 10
24+
repeat = pr_gate_repeat(10)
1725
number = 1
1826

1927
def setup(self):

0 commit comments

Comments
 (0)