Add example showing how to parse additional arguments
Nobody has claimed this yet.
- 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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