NVIDIA / NVIDIA/nvbench

Add example showing how to parse additional arguments

Open
#87 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: examples good first issue P2: nice to have type: enhancement
Dominant language
Cuda
Stars
927
Forks
123
Avg merge
2d 10h
Merged PRs (30d)
2

Description

Several users have asked about how to add custom arguments to their benchmarks (e.g. #86).

This is done by implementing an application specific main(argc, argv) function and linking to the nvbench::nvbench CMake target instead of nvbench::main. The custom main will need to parse out additional arguments, and then use the macros defined in main.cuh to parse the remaining args and run NVBench. Something like:

int main(int argc, char** argv)
{
  // parse custom args and remove them from (or rebuild) argc/argv here
  
  NVBENCH_MAIN_BODY(argc, argv);
}

A singleton or some global state is then needed to communicate the custom options to the benchmarks.

We should add an example that shows how to do this.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with nvbench/main.cuh and inspect how the nvbench::nvbench and nvbench::main CMake targets are defined. Add an example with an application-specific main(argc, argv) that removes custom arguments before invoking NVBENCH_MAIN_BODY, and verify that the example builds and demonstrates passing those options to benchmarks.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.