Skip to content

docs: add custom argument example - #470

Open
efegokdemir wants to merge 5 commits into
NVIDIA:mainfrom
efegokdemir:codex/issue-87-custom-args-example
Open

efegokdemir wants to merge 5 commits into
NVIDIA:mainfrom
efegokdemir:codex/issue-87-custom-args-example

Conversation

@efegokdemir

@efegokdemir efegokdemir commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #87 by adding a focused example for applications that need to consume their own command-line arguments before NVBench parses the remaining options.

Changes

  • Add a CPU-only custom_args.cu example using NVBENCH_MAIN_CUSTOM_ARGS_HANDLER.
  • Parse and remove a required-value --iterations option before handing arguments to NVBench.
  • Validate missing, malformed, zero, and negative values with a clear error.
  • Register the example in the CMake example target and README example list.

Testing

  • git diff --check origin/main...HEAD — passed.
  • Static example wiring/content assertions — passed.
  • clang-format --dry-run --Werror examples/custom_args.cu — passed.
  • CUDA example compilation — not run: nvcc is not installed in this environment.
  • CMake configuration — not run: cmake is not installed in this environment.

Notes

The example uses the existing customization hook and keeps the benchmark CPU-only so the argument-handling pattern is easy to run and inspect without requiring a GPU at runtime. AI assistance was used during implementation; the final diff and validation were reviewed manually.

Signed-off-by: Efe Gökdemir <efe@rexcode.co.uk>
@copy-pr-bot

copy-pr-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Signed-off-by: Efe Gökdemir <efe@rexcode.co.uk>
Comment thread examples/custom_args.cu Resolved
@oleksandr-pavlyk

Copy link
Copy Markdown
Collaborator

I think a big drawback of current approach for handling custom arguments is lack of their discoverability via CLI.

Implementing that is outside of this PR's scope though.

Signed-off-by: Efe Gökdemir <gokdemirefe1903@gmail.com>
Signed-off-by: Efe Gökdemir <gokdemirefe1903@gmail.com>
@oleksandr-pavlyk

Copy link
Copy Markdown
Collaborator

/ok to test 46d8baa

Signed-off-by: Efe Gökdemir <gokdemirefe1903@gmail.com>

This branch has not been deployed

No deployments
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 example showing how to parse additional arguments

2 participants