NVIDIA/nvbench

Add example showing how to parse additional arguments

Offen

#87 geöffnet am 10.05.2022

 (6 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Cuda (115 Forks)auto 404
P2: nice to havearea: examplesgood first issuetype: enhancement

Repository-Metriken

Stars
 (914 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

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