mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-03-14 20:27:24 +00:00
Add new --version option to benchmark executables.
This commit is contained in:
@@ -21,10 +21,12 @@
|
||||
#include <nvbench/benchmark_base.cuh>
|
||||
#include <nvbench/benchmark_manager.cuh>
|
||||
#include <nvbench/csv_printer.cuh>
|
||||
#include <nvbench/git_revision.cuh>
|
||||
#include <nvbench/json_printer.cuh>
|
||||
#include <nvbench/markdown_printer.cuh>
|
||||
#include <nvbench/printer_base.cuh>
|
||||
#include <nvbench/range.cuh>
|
||||
#include <nvbench/version.cuh>
|
||||
|
||||
#include <nvbench/detail/throw.cuh>
|
||||
|
||||
@@ -383,6 +385,11 @@ void option_parser::parse_range(option_parser::arg_iterator_t first,
|
||||
this->print_help_axis();
|
||||
std::exit(0);
|
||||
}
|
||||
else if (arg == "--version")
|
||||
{
|
||||
this->print_version();
|
||||
std::exit(0);
|
||||
}
|
||||
else if (arg == "--list" || arg == "-l")
|
||||
{
|
||||
this->print_list();
|
||||
@@ -531,6 +538,17 @@ std::ostream &option_parser::printer_spec_to_ostream(const std::string &spec)
|
||||
}
|
||||
}
|
||||
|
||||
void option_parser::print_version() const
|
||||
{
|
||||
fmt::print("NVBench v{}.{}.{} ({}:{})\n",
|
||||
NVBENCH_VERSION_MAJOR,
|
||||
NVBENCH_VERSION_MINOR,
|
||||
NVBENCH_VERSION_PATCH,
|
||||
NVBENCH_GIT_BRANCH,
|
||||
NVBENCH_GIT_VERSION);
|
||||
std::exit(0);
|
||||
}
|
||||
|
||||
void option_parser::print_list() const
|
||||
{
|
||||
const auto &bench_mgr = nvbench::benchmark_manager::get();
|
||||
|
||||
@@ -84,6 +84,7 @@ private:
|
||||
|
||||
std::ostream &printer_spec_to_ostream(const std::string &spec);
|
||||
|
||||
void print_version() const;
|
||||
void print_list() const;
|
||||
void print_help() const;
|
||||
void print_help_axis() const;
|
||||
|
||||
Reference in New Issue
Block a user