Skip to content

Add nvbench-compare-robust --plot-output/--plot-along-output options - #433

Open
oleksandr-pavlyk wants to merge 6 commits into
NVIDIA:mainfrom
oleksandr-pavlyk:add-explicit-plot-output-options-in-compare-script
Open

Add nvbench-compare-robust --plot-output/--plot-along-output options#433
oleksandr-pavlyk wants to merge 6 commits into
NVIDIA:mainfrom
oleksandr-pavlyk:add-explicit-plot-output-options-in-compare-script

Conversation

@oleksandr-pavlyk

@oleksandr-pavlyk oleksandr-pavlyk commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

The intent is to allow producing plotting artifacts in headless environments without relying on Linux-centric "DISPLAY" environment variable and allowing user to select matplotlib's backend via environment variables.

  • Added --plot-output PATH for summary plots (i.e., --plot was specified).
  • Added --plot-along-output PATH_OR_TEMPLATE for --plot-along.
  • Default behavior remains interactive plt.show().
  • Explicit output paths save via fig.savefig(..., dpi=150) and skip plt.show().
  • --plot-along-output supports {benchmark}, {device}, {axis}, {pair} templates.
  • Duplicate plot-along output paths now raise a clear error instead of overwriting.

In addition, plotting data and their manipulation have been decoupled from compare_benches are now performed using PlotCollector class. All plotting-related functionality has been move to helper source file _nvbench_compare_plotting.py residing next to nvbench_compare_robust.py.

Closes #395

The intent is to allow producing plotting artifacts in headless
environments.

Closes NVIDIA#395
@oleksandr-pavlyk

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a177b654-f2cc-4021-9a78-6a94342724a0

📥 Commits

Reviewing files that changed from the base of the PR and between 3d6b530 and e37d351.

📒 Files selected for processing (5)
  • docs/nvbench_compare_robust.md
  • python/scripts/_nvbench_compare_plotting.py
  • python/scripts/nvbench_compare_robust.py
  • python/test/test_nvbench_compare_robust.py
  • python/test/test_nvbench_tooling_deps.py

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added --plot-output and --plot-along-output to save comparison plots to disk (saved output avoids interactive display).
    • Enhanced --plot-along-output templating with {benchmark}, {device}, {axis}, and {pair}, including safe component sanitization and repeat-pair disambiguation.
    • Added collision protection to reject duplicate/overlapping output targets to prevent overwriting.
  • Documentation
    • Expanded nvbench-compare-robust plotting guidance, including interactive vs CI/non-interactive examples and template/output option behavior.
  • Tests
    • Added/extended tests for save-vs-show behavior, template validation/sanitization, CLI wiring, and duplicate-path rejection.

Walkthrough

Changes

The PR adds explicit output paths for summary and --plot-along plots, supports template fields including {benchmark}, {device}, {axis}, and {pair}, prevents duplicate output paths, preserves interactive display when outputs are omitted, and documents and tests the behavior.

Plot output handling

Layer / File(s) Summary
Plot output helpers
python/scripts/_nvbench_compare_plotting.py
Validates and expands plot-along templates, creates parent directories, selects a non-interactive backend for saved plots, and saves or displays figures.
CLI and plot generation integration
python/scripts/nvbench_compare_robust.py, python/scripts/_nvbench_compare_plotting.py
Adds --plot-output and --plot-along-output, validates their plotting-mode requirements, routes output paths through both plotting flows, and rejects collisions.
Behavior validation and documentation
python/test/test_nvbench_compare_robust.py, python/test/test_nvbench_tooling_deps.py, docs/nvbench_compare_robust.md
Tests save/show behavior, template expansion, collision detection, and CLI propagation; includes the plotting module in packaged script checks; documents interactive defaults and file-output options.

Assessment against linked issues

Objective Addressed Explanation
Preserve plt.show() when output options are omitted for both plotting modes [#395]
Save summary and plot-along figures without calling plt.show() when output paths are provided [#395]
Support plot-along templates and reject duplicate output destinations [#395]
Document default interactive and explicit file-output behavior [#395]

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

coderabbitai[bot]

This comment was marked as resolved.

@oleksandr-pavlyk
oleksandr-pavlyk marked this pull request as draft July 23, 2026 18:51
@oleksandr-pavlyk

This comment was marked as outdated.

@coderabbitai

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as resolved.

@oleksandr-pavlyk

This comment was marked as outdated.

@coderabbitai

This comment was marked as outdated.

@oleksandr-pavlyk
oleksandr-pavlyk marked this pull request as ready for review July 24, 2026 13:40
@oleksandr-pavlyk

This comment was marked as outdated.

@coderabbitai

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as resolved.

…related data

Introduced _nvbench_compare_plotting.py helper that contains class
PlotCollector.

PlotCollector owns plotting-related state and rendering, and compare_benches()
interacts with plotting through that collector.

compare_benches() still produces comparison facts, but delegates plotting state
management and rendering to PlotCollector.
@oleksandr-pavlyk
oleksandr-pavlyk force-pushed the add-explicit-plot-output-options-in-compare-script branch from 06becf1 to e37d351 Compare July 24, 2026 17:52
@oleksandr-pavlyk

This comment was marked as outdated.

@coderabbitai

This comment was marked as outdated.

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.

Add explicit plot output options to nvbench-compare

1 participant