Skip to content

Commit 75b7fcb

Browse files
Normalize OVPhysX asset benchmarks
2 parents fdb7294 + 3c2ca66 commit 75b7fcb

8 files changed

Lines changed: 109 additions & 46 deletions

File tree

source/isaaclab/isaaclab/benchmark/method_benchmark.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@ class MethodBenchmarkRunnerConfig:
8585

8686
def __post_init__(self) -> None:
8787
"""Validate benchmark workload sizes."""
88-
for field_name in ("num_iterations", "num_instances", "num_bodies", "num_joints"):
88+
for field_name in ("num_iterations", "num_instances", "num_bodies"):
8989
if getattr(self, field_name) <= 0:
9090
raise ValueError(f"{field_name} must be greater than zero")
91+
if self.num_joints < 0:
92+
raise ValueError("num_joints must be non-negative")
9193
if self.warmup_steps < 0:
9294
raise ValueError("warmup_steps must be non-negative")
9395

source/isaaclab/test/benchmark/test_method_benchmark.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
("warmup_steps", -1),
2424
("num_instances", 0),
2525
("num_bodies", 0),
26-
("num_joints", 0),
26+
("num_joints", -1),
2727
),
2828
)
2929
def test_config_rejects_invalid_workload_sizes(field: str, value: int) -> None:
@@ -32,6 +32,13 @@ def test_config_rejects_invalid_workload_sizes(field: str, value: int) -> None:
3232
MethodBenchmarkRunnerConfig(**{field: value})
3333

3434

35+
def test_config_accepts_zero_joints_for_rigid_assets() -> None:
36+
"""Rigid-object benchmarks should represent their zero-joint workload accurately."""
37+
config = MethodBenchmarkRunnerConfig(num_joints=0)
38+
39+
assert config.num_joints == 0
40+
41+
3542
def _runner(*, num_iterations: int = 3, warmup_steps: int = 0) -> MethodBenchmarkRunner:
3643
runner = object.__new__(MethodBenchmarkRunner)
3744
runner._config = MethodBenchmarkRunnerConfig(

source/isaaclab_ovphysx/benchmark/assets/benchmark_articulation.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,18 @@
3535
parser.add_argument("--num_joints", type=int, default=11, help="Number of joints")
3636
parser.add_argument("--mode", type=str, default="all", help="Benchmark mode (all, torch_list, torch_tensor, warp_mask)")
3737
parser.add_argument("--device", type=str, default="cuda:0", help="Device for tensors")
38-
parser.add_argument("--output_dir", type=str, default=".", help="Output directory for results")
39-
parser.add_argument("--backend", type=str, default="json", choices=["json", "osmo", "omniperf"], help="Metrics backend")
38+
parser.add_argument(
39+
"--output_path", "--output_dir", dest="output_path", type=str, default=".", help="Output directory for results"
40+
)
41+
parser.add_argument(
42+
"--benchmark_formatter",
43+
"--backend",
44+
dest="benchmark_formatter",
45+
type=str,
46+
default="json",
47+
choices=["json", "osmo", "omniperf", "summary"],
48+
help="Metrics formatter",
49+
)
4050
parser.add_argument("--no_shape_checks", action="store_true", help="Disable shape/dtype assertions")
4151

4252
args = parser.parse_args()
@@ -50,7 +60,7 @@
5060
from isaaclab_ovphysx.test.mock_interfaces import MockOvPhysxBindingSet
5161

5262
from isaaclab.assets.articulation.articulation_cfg import ArticulationCfg
53-
from isaaclab.test.benchmark import MethodBenchmarkDefinition, MethodBenchmarkRunner, MethodBenchmarkRunnerConfig
63+
from isaaclab.benchmark import MethodBenchmarkDefinition, MethodBenchmarkRunner, MethodBenchmarkRunnerConfig
5464

5565
# Suppress deprecation warnings during benchmarking
5666
warnings.filterwarnings("ignore", category=DeprecationWarning)
@@ -1225,8 +1235,8 @@ def main():
12251235
runner = MethodBenchmarkRunner(
12261236
benchmark_name="ovphysx_articulation_benchmark",
12271237
config=config,
1228-
backend_type=args.backend,
1229-
output_path=args.output_dir,
1238+
backend_type=args.benchmark_formatter,
1239+
output_path=args.output_path,
12301240
use_recorders=True,
12311241
)
12321242

@@ -1239,8 +1249,6 @@ def main():
12391249
runner.run_benchmarks(FILL_BENCHMARKS, articulation)
12401250
runner.finalize()
12411251

1242-
# Close the simulation app
1243-
12441252

12451253
if __name__ == "__main__":
12461254
main()

source/isaaclab_ovphysx/benchmark/assets/benchmark_articulation_data.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,18 @@
3232
parser.add_argument("--num_bodies", type=int, default=12, help="Number of bodies")
3333
parser.add_argument("--num_joints", type=int, default=11, help="Number of joints")
3434
parser.add_argument("--device", type=str, default="cuda:0", help="Device for tensors")
35-
parser.add_argument("--output_dir", type=str, default=".", help="Output directory for results")
36-
parser.add_argument("--backend", type=str, default="json", choices=["json", "osmo", "omniperf"], help="Metrics backend")
35+
parser.add_argument(
36+
"--output_path", "--output_dir", dest="output_path", type=str, default=".", help="Output directory for results"
37+
)
38+
parser.add_argument(
39+
"--benchmark_formatter",
40+
"--backend",
41+
dest="benchmark_formatter",
42+
type=str,
43+
default="json",
44+
choices=["json", "osmo", "omniperf", "summary"],
45+
help="Metrics formatter",
46+
)
3747

3848
args = parser.parse_args()
3949

@@ -42,7 +52,7 @@
4252

4353
from isaaclab_ovphysx.test.mock_interfaces import MockOvPhysxBindingSet, MockOvPhysxView
4454

45-
from isaaclab.test.benchmark import MethodBenchmarkRunner, MethodBenchmarkRunnerConfig
55+
from isaaclab.benchmark import MethodBenchmarkRunner, MethodBenchmarkRunnerConfig
4656

4757
# Suppress deprecation warnings during benchmarking
4858
warnings.filterwarnings("ignore", category=DeprecationWarning)
@@ -161,12 +171,12 @@
161171
PROPERTY_DEPENDENCIES = {
162172
"root_link_lin_vel_w": ["root_link_vel_w"],
163173
"root_link_ang_vel_w": ["root_link_vel_w"],
164-
"root_link_lin_vel_b": ["root_link_vel_b"],
165-
"root_link_ang_vel_b": ["root_link_vel_b"],
174+
"root_link_lin_vel_b": ["root_link_lin_vel_w", "root_link_quat_w"],
175+
"root_link_ang_vel_b": ["root_link_ang_vel_w", "root_link_quat_w"],
166176
"root_com_pos_w": ["root_com_pose_w"],
167177
"root_com_quat_w": ["root_com_pose_w"],
168-
"root_com_lin_vel_b": ["root_com_vel_b"],
169-
"root_com_ang_vel_b": ["root_com_vel_b"],
178+
"root_com_lin_vel_b": ["root_com_lin_vel_w", "root_link_quat_w"],
179+
"root_com_ang_vel_b": ["root_com_ang_vel_w", "root_link_quat_w"],
170180
"root_com_lin_vel_w": ["root_com_vel_w"],
171181
"root_com_ang_vel_w": ["root_com_vel_w"],
172182
"root_link_pos_w": ["root_link_pose_w"],
@@ -253,8 +263,8 @@ def gen_mock_data(_cfg: MethodBenchmarkRunnerConfig) -> dict:
253263
runner = MethodBenchmarkRunner(
254264
benchmark_name="ovphysx_articulation_data_benchmark",
255265
config=config,
256-
backend_type=args.backend,
257-
output_path=args.output_dir,
266+
backend_type=args.benchmark_formatter,
267+
output_path=args.output_path,
258268
use_recorders=True,
259269
)
260270
runner.run_property_benchmarks(

source/isaaclab_ovphysx/benchmark/assets/benchmark_rigid_object.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,18 @@
3434
parser.add_argument("--num_bodies", type=int, default=1, help="Number of bodies")
3535
parser.add_argument("--mode", type=str, default="all", help="Benchmark mode (all, torch_list, torch_tensor, warp_mask)")
3636
parser.add_argument("--device", type=str, default="cuda:0", help="Device for tensors")
37-
parser.add_argument("--output_dir", type=str, default=".", help="Output directory for results")
38-
parser.add_argument("--backend", type=str, default="json", choices=["json", "osmo", "omniperf"], help="Metrics backend")
37+
parser.add_argument(
38+
"--output_path", "--output_dir", dest="output_path", type=str, default=".", help="Output directory for results"
39+
)
40+
parser.add_argument(
41+
"--benchmark_formatter",
42+
"--backend",
43+
dest="benchmark_formatter",
44+
type=str,
45+
default="json",
46+
choices=["json", "osmo", "omniperf", "summary"],
47+
help="Metrics formatter",
48+
)
3949
parser.add_argument("--no_shape_checks", action="store_true", help="Disable shape/dtype assertions")
4050

4151
args = parser.parse_args()
@@ -49,7 +59,7 @@
4959
from isaaclab_ovphysx.test.mock_interfaces import MockOvPhysxBindingSet
5060

5161
from isaaclab.assets.rigid_object.rigid_object_cfg import RigidObjectCfg
52-
from isaaclab.test.benchmark import MethodBenchmarkDefinition, MethodBenchmarkRunner, MethodBenchmarkRunnerConfig
62+
from isaaclab.benchmark import MethodBenchmarkDefinition, MethodBenchmarkRunner, MethodBenchmarkRunnerConfig
5363

5464
# Suppress deprecation warnings during benchmarking
5565
warnings.filterwarnings("ignore", category=DeprecationWarning)
@@ -561,8 +571,8 @@ def main():
561571
runner = MethodBenchmarkRunner(
562572
benchmark_name="ovphysx_rigid_object_benchmark",
563573
config=config,
564-
backend_type=args.backend,
565-
output_path=args.output_dir,
574+
backend_type=args.benchmark_formatter,
575+
output_path=args.output_path,
566576
use_recorders=True,
567577
)
568578

@@ -575,8 +585,6 @@ def main():
575585
runner.run_benchmarks(FILL_BENCHMARKS, rigid_object)
576586
runner.finalize()
577587

578-
# Close the simulation app
579-
580588

581589
if __name__ == "__main__":
582590
main()

source/isaaclab_ovphysx/benchmark/assets/benchmark_rigid_object_collection.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,18 @@
3434
parser.add_argument("--num_bodies", type=int, default=3, help="Number of bodies (object types)")
3535
parser.add_argument("--mode", type=str, default="all", help="Benchmark mode (all, torch_list, torch_tensor, warp_mask)")
3636
parser.add_argument("--device", type=str, default="cuda:0", help="Device for tensors")
37-
parser.add_argument("--output_dir", type=str, default=".", help="Output directory for results")
38-
parser.add_argument("--backend", type=str, default="json", choices=["json", "osmo", "omniperf"], help="Metrics backend")
37+
parser.add_argument(
38+
"--output_path", "--output_dir", dest="output_path", type=str, default=".", help="Output directory for results"
39+
)
40+
parser.add_argument(
41+
"--benchmark_formatter",
42+
"--backend",
43+
dest="benchmark_formatter",
44+
type=str,
45+
default="json",
46+
choices=["json", "osmo", "omniperf", "summary"],
47+
help="Metrics formatter",
48+
)
3949
parser.add_argument("--no_shape_checks", action="store_true", help="Disable shape/dtype assertions")
4050

4151
args = parser.parse_args()
@@ -49,7 +59,7 @@
4959
from isaaclab_ovphysx.test.mock_interfaces import MockOvPhysxBindingSet
5060

5161
from isaaclab.assets.rigid_object_collection.rigid_object_collection_cfg import RigidObjectCollectionCfg
52-
from isaaclab.test.benchmark import MethodBenchmarkDefinition, MethodBenchmarkRunner, MethodBenchmarkRunnerConfig
62+
from isaaclab.benchmark import MethodBenchmarkDefinition, MethodBenchmarkRunner, MethodBenchmarkRunnerConfig
5363

5464
# Suppress deprecation warnings during benchmarking
5565
warnings.filterwarnings("ignore", category=DeprecationWarning)
@@ -589,8 +599,8 @@ def main():
589599
runner = MethodBenchmarkRunner(
590600
benchmark_name="ovphysx_rigid_object_collection_benchmark",
591601
config=config,
592-
backend_type=args.backend,
593-
output_path=args.output_dir,
602+
backend_type=args.benchmark_formatter,
603+
output_path=args.output_path,
594604
use_recorders=True,
595605
)
596606

@@ -603,8 +613,6 @@ def main():
603613
runner.run_benchmarks(FILL_BENCHMARKS, collection)
604614
runner.finalize()
605615

606-
# Close the simulation app
607-
608616

609617
if __name__ == "__main__":
610618
main()

source/isaaclab_ovphysx/benchmark/assets/benchmark_rigid_object_collection_data.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,18 @@
3131
parser.add_argument("--num_instances", type=int, default=4096, help="Number of instances")
3232
parser.add_argument("--num_bodies", type=int, default=3, help="Number of bodies (object types)")
3333
parser.add_argument("--device", type=str, default="cuda:0", help="Device for tensors")
34-
parser.add_argument("--output_dir", type=str, default=".", help="Output directory for results")
35-
parser.add_argument("--backend", type=str, default="json", choices=["json", "osmo", "omniperf"], help="Metrics backend")
34+
parser.add_argument(
35+
"--output_path", "--output_dir", dest="output_path", type=str, default=".", help="Output directory for results"
36+
)
37+
parser.add_argument(
38+
"--benchmark_formatter",
39+
"--backend",
40+
dest="benchmark_formatter",
41+
type=str,
42+
default="json",
43+
choices=["json", "osmo", "omniperf", "summary"],
44+
help="Metrics formatter",
45+
)
3646

3747
args = parser.parse_args()
3848

@@ -41,7 +51,7 @@
4151

4252
from isaaclab_ovphysx.test.mock_interfaces import MockOvPhysxBindingSet, MockOvPhysxView
4353

44-
from isaaclab.test.benchmark import MethodBenchmarkRunner, MethodBenchmarkRunnerConfig
54+
from isaaclab.benchmark import MethodBenchmarkRunner, MethodBenchmarkRunnerConfig
4555

4656
# Suppress deprecation warnings during benchmarking
4757
warnings.filterwarnings("ignore", category=DeprecationWarning)
@@ -172,8 +182,8 @@ def gen_mock_data(_cfg: MethodBenchmarkRunnerConfig) -> dict:
172182
runner = MethodBenchmarkRunner(
173183
benchmark_name="ovphysx_rigid_object_collection_data_benchmark",
174184
config=config,
175-
backend_type=args.backend,
176-
output_path=args.output_dir,
185+
backend_type=args.benchmark_formatter,
186+
output_path=args.output_path,
177187
use_recorders=True,
178188
)
179189
runner.run_property_benchmarks(

source/isaaclab_ovphysx/benchmark/assets/benchmark_rigid_object_data.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,18 @@
3030
parser.add_argument("--warmup_steps", type=int, default=10, help="Number of warmup steps")
3131
parser.add_argument("--num_instances", type=int, default=4096, help="Number of instances")
3232
parser.add_argument("--device", type=str, default="cuda:0", help="Device for tensors")
33-
parser.add_argument("--output_dir", type=str, default=".", help="Output directory for results")
34-
parser.add_argument("--backend", type=str, default="json", choices=["json", "osmo", "omniperf"], help="Metrics backend")
33+
parser.add_argument(
34+
"--output_path", "--output_dir", dest="output_path", type=str, default=".", help="Output directory for results"
35+
)
36+
parser.add_argument(
37+
"--benchmark_formatter",
38+
"--backend",
39+
dest="benchmark_formatter",
40+
type=str,
41+
default="json",
42+
choices=["json", "osmo", "omniperf", "summary"],
43+
help="Metrics formatter",
44+
)
3545

3646
args = parser.parse_args()
3747

@@ -40,7 +50,7 @@
4050

4151
from isaaclab_ovphysx.test.mock_interfaces import MockOvPhysxBindingSet, MockOvPhysxView
4252

43-
from isaaclab.test.benchmark import MethodBenchmarkRunner, MethodBenchmarkRunnerConfig
53+
from isaaclab.benchmark import MethodBenchmarkRunner, MethodBenchmarkRunnerConfig
4454

4555
# Suppress deprecation warnings during benchmarking
4656
warnings.filterwarnings("ignore", category=DeprecationWarning)
@@ -111,12 +121,12 @@
111121
PROPERTY_DEPENDENCIES = {
112122
"root_link_lin_vel_w": ["root_link_vel_w"],
113123
"root_link_ang_vel_w": ["root_link_vel_w"],
114-
"root_link_lin_vel_b": ["root_link_vel_b"],
115-
"root_link_ang_vel_b": ["root_link_vel_b"],
124+
"root_link_lin_vel_b": ["root_link_lin_vel_w", "root_link_quat_w"],
125+
"root_link_ang_vel_b": ["root_link_ang_vel_w", "root_link_quat_w"],
116126
"root_com_pos_w": ["root_com_pose_w"],
117127
"root_com_quat_w": ["root_com_pose_w"],
118-
"root_com_lin_vel_b": ["root_com_vel_b"],
119-
"root_com_ang_vel_b": ["root_com_vel_b"],
128+
"root_com_lin_vel_b": ["root_com_lin_vel_w", "root_link_quat_w"],
129+
"root_com_ang_vel_b": ["root_com_ang_vel_w", "root_link_quat_w"],
120130
"root_com_lin_vel_w": ["root_com_vel_w"],
121131
"root_com_ang_vel_w": ["root_com_vel_w"],
122132
"root_link_pos_w": ["root_link_pose_w"],
@@ -202,8 +212,8 @@ def gen_mock_data(_cfg: MethodBenchmarkRunnerConfig) -> dict:
202212
runner = MethodBenchmarkRunner(
203213
benchmark_name="ovphysx_rigid_object_data_benchmark",
204214
config=config,
205-
backend_type=args.backend,
206-
output_path=args.output_dir,
215+
backend_type=args.benchmark_formatter,
216+
output_path=args.output_path,
207217
use_recorders=True,
208218
)
209219
runner.run_property_benchmarks(

0 commit comments

Comments
 (0)