Skip to content

Store jsonbin sidecar paths relative to JSON output file location#405

Open
oleksandr-pavlyk wants to merge 4 commits into
NVIDIA:mainfrom
oleksandr-pavlyk:store-sidecar-binary-file-path-relative-to-json-file-path
Open

Store jsonbin sidecar paths relative to JSON output file location#405
oleksandr-pavlyk wants to merge 4 commits into
NVIDIA:mainfrom
oleksandr-pavlyk:store-sidecar-binary-file-path-relative-to-json-file-path

Conversation

@oleksandr-pavlyk

Copy link
Copy Markdown
Collaborator

Closes #404

Keep --jsonbin sidecar files written next to the JSON output file, but record their filenames relative to the JSON file directory. This makes generated JSON and its sidecar directories relocatable as a unit and avoids embedding the benchmark process working-directory relationship into the JSON payload.

Add a focused json_printer test that verifies sample-time and sample-frequency sidecars are written beside the JSON file while summary filename fields contain JSON-relative paths.

Keep --jsonbin sidecar files written next to the JSON output file, but record
their filenames relative to the JSON file directory. This makes generated JSON
and its sidecar directories relocatable as a unit and avoids embedding the
benchmark process working-directory relationship into the JSON payload.

Add a focused json_printer test that verifies sample-time and sample-frequency
sidecars are written beside the JSON file while summary filename fields contain
JSON-relative paths.
@oleksandr-pavlyk

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved JSON “sidecar” binary output to use more reliable, JSON-relative paths.
    • Ensure the output directory exists before writing and handle write failures more gracefully (including omitting filename/size when a sidecar can’t be produced).
  • Tests

    • Expanded JSON-printer test coverage to confirm generated filename metadata is correct and referenced .bin files exist.
    • Added a failure-case test to verify correct summary omission and a single warning log when output cannot be written.

Walkthrough

The PR separates binary sidecar write paths from JSON-relative filename metadata, updates both sidecar-producing branches to use the shared helper, and adds tests plus build registration covering success and failure cases.

Changes

JSON-relative sidecar path handling

Layer / File(s) Summary
Path helpers and directory checks
nvbench/json_printer.cu
Adds std::system_error usage and helper types/functions to derive sidecar write paths and JSON-relative summary paths, then create or validate the target output directory with non-throwing filesystem error handling.
Sidecar writer and json_printer integration
nvbench/json_printer.cu
Introduces a shared helper that writes JSON binary sidecars, removes partial files on failure, and populates summary metadata from the JSON-relative path; sample_times and sample_freqs now call that helper.
Test coverage and build registration
testing/CMakeLists.txt, testing/json_printer.cu
Adds a dedicated nvbench test source, filesystem test scaffolding, a success case that checks JSON-relative filenames and file existence, and a failure case that checks metadata omission and warning logging.

Assessment against linked issues

Objective Addressed Explanation
Store sidecar filenames relative to the JSON file path in JSON output [#404]
Keep writing sidecar files next to the JSON output file [#404]
Validate the behavior with tests [#404]

No out-of-scope changes found.


Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]

This comment was marked as resolved.

Extract the duplicated sample-times and sample-frequencies jsonbin
sidecar write paths into a shared helper. This keeps directory creation,
file writing, warning logging, summary metadata, and write-duration
logging in one place for both sidecar types.
Cover the case where the expected sidecar directory path collides with a
regular file. Verify that json_printer keeps descriptive summary metadata
but omits filename and size when the sidecar file was not written.

Register printer and verify output.
Factor repeated optional benchmark-printer logging in write_jsonbin_sidecar
into a local helper used by both warning and success paths.

Also tidy the jsonbin summary names for sample time and frequency sidecar
files.
@oleksandr-pavlyk

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

This comment was marked as outdated.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e6bdac4b-ae58-48b5-a928-55cc842fec5e

📥 Commits

Reviewing files that changed from the base of the PR and between d483a5b and 93e5512.

📒 Files selected for processing (3)
  • nvbench/json_printer.cu
  • testing/CMakeLists.txt
  • testing/json_printer.cu

Comment thread nvbench/json_printer.cu
@oleksandr-pavlyk

Copy link
Copy Markdown
Collaborator Author

The work was motivated by failure to ingest JSON file and sidecar binary files when using #386 while JSON files were generated by running CCCL benchmarks from devcontainer.

Commands used to reproduce
./bin/cub.bench.bitonic_sort.warp_keys.base -d 1 --cold-warmup-runs 16 --min-samples 100 --stopping-criterion entropy --min-r2 0.88 --jsonbin ../../../perf_data/warp-bitonic-sort-run1.json
./bin/cub.bench.bitonic_sort.warp_keys.base -d 1 --cold-warmup-runs 16 --min-samples 100 --stopping-criterion entropy --min-r2 0.88 --jsonbin ../../../perf_data/warp-bitonic-sort-run2.json

PYTHONPATH=./_deps/nvbench-src/python/scripts python ./_deps/nvbench-src/python/scripts/nvbench_compare.py ../../../perf_data/warp-bitonic-sort-run1.json ../../../perf_data/warp-bitonic-sort-run2.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NVBench --jsonbin should generate binary sidecar filenames relative to path of JSON file

1 participant