Skip to content

Commit b371a1d

Browse files
committed
Remove prefix so we can compare benchmarks
1 parent 65b30e4 commit b371a1d

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

cuda_bindings/benchmarks/README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,30 @@ sudo $(pixi run -e wheel -- which python) -m pyperf system tune
3232
To run the benchmarks combine the environment and task:
3333

3434
```bash
35-
3635
# Run the Python benchmarks in the wheel environment
3736
pixi run -e wheel bench
3837

3938
# Run the Python benchmarks in the source environment
4039
pixi run -e source bench
4140

42-
# Run the C++ benchmarks (environment is irrelavant here)
41+
# Run the C++ benchmarks
4342
pixi run -e wheel bench-cpp
4443
```
4544

46-
## pyperf JSON
45+
Both runners automatically save results to JSON files in the benchmarks
46+
directory: `results-python.json` and `results-cpp.json`.
4747

48-
The benchmarks are run using [pyperf](https://pyperf.readthedocs.io/en/latest/).
49-
The results are written to a JSON file in the format expected by pyperf.
48+
## Output JSON and analysis
5049

51-
The C++ benchmarks also generate a valid JSON file, in the same format.
50+
The benchmarks are run using [pyperf](https://pyperf.readthedocs.io/en/latest/).
51+
Both Python and C++ results are saved in pyperf-compatible JSON format,
52+
which can be analyzed with pyperf commands:
5253

53-
```
54-
pixi run -e wheel bench-cpp -0 cpp.json
54+
```bash
55+
# Show results and statistics
56+
pixi run -e wheel -- python -m pyperf stats results-python.json
57+
pixi run -e wheel -- python -m pyperf stats results-cpp.json
5558

56-
pixi run -e wheel pyperf stats cpp.json
59+
# Compare C++ vs Python results
60+
pixi run -e wheel -- python -m pyperf compare_to results-cpp.json results-python.json
5761
```

cuda_bindings/benchmarks/benchmarks/cpp/bench_ctx_device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static void check_cu(CUresult status, const char* message) {
2323
int main(int argc, char** argv) {
2424
bench::Options options = bench::parse_args(argc, argv);
2525
if (options.benchmark_name.empty()) {
26-
options.benchmark_name = "cpp.ctx_device.ctx_get_current";
26+
options.benchmark_name = "ctx_device.ctx_get_current";
2727
}
2828

2929
// Setup: init CUDA and create a context

cuda_bindings/benchmarks/benchmarks/cpp/bench_pointer_attributes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static void check_cu(CUresult status, const char* message) {
2323
int main(int argc, char** argv) {
2424
bench::Options options = bench::parse_args(argc, argv);
2525
if (options.benchmark_name.empty()) {
26-
options.benchmark_name = "cpp.pointer_attributes.pointer_get_attribute";
26+
options.benchmark_name = "pointer_attributes.pointer_get_attribute";
2727
}
2828

2929
// Setup: init CUDA, allocate memory

cuda_bindings/benchmarks/runner/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def load_module(module_path: Path) -> ModuleType:
3030
def benchmark_id(module_name: str, function_name: str) -> str:
3131
module_suffix = module_name.removeprefix("bench_")
3232
suffix = function_name.removeprefix("bench_")
33-
return f"bindings.{module_suffix}.{suffix}"
33+
return f"{module_suffix}.{suffix}"
3434

3535

3636
def discover_benchmarks() -> dict[str, Callable[[int], float]]:

0 commit comments

Comments
 (0)