diff --git a/nvbench/option_parser.cu b/nvbench/option_parser.cu index 6e74391..5662af9 100644 --- a/nvbench/option_parser.cu +++ b/nvbench/option_parser.cu @@ -294,7 +294,13 @@ void option_parser::parse(std::vector args) void option_parser::parse_impl() { - m_global_args.clear(); + m_global_benchmark_args.clear(); + + // Initialize color variable based on env var: + { + const char *var = std::getenv("NVBENCH_COLOR"); + m_color_md_stdout_printer = var && var[0] == '1'; + } this->parse_range(m_args.cbegin(), m_args.cend()); @@ -515,7 +521,8 @@ catch (std::exception &e) void option_parser::replay_global_args() { - this->parse_range(m_global_args.cbegin(), m_global_args.cend()); + this->parse_range(m_global_benchmark_args.cbegin(), + m_global_benchmark_args.cend()); } void option_parser::update_devices(const std::string &devices) @@ -524,8 +531,8 @@ try // If no active benchmark, save args as global. if (m_benchmarks.empty()) { - m_global_args.push_back("-devices"); - m_global_args.push_back(devices); + m_global_benchmark_args.push_back("-devices"); + m_global_benchmark_args.push_back(devices); return; } @@ -564,8 +571,8 @@ try // If no active benchmark, save args as global. if (m_benchmarks.empty()) { - m_global_args.push_back("--axis"); - m_global_args.push_back(spec); + m_global_benchmark_args.push_back("--axis"); + m_global_benchmark_args.push_back(spec); return; } @@ -700,8 +707,8 @@ try // If no active benchmark, save args as global. if (m_benchmarks.empty()) { - m_global_args.push_back(prop_arg); - m_global_args.push_back(prop_val); + m_global_benchmark_args.push_back(prop_arg); + m_global_benchmark_args.push_back(prop_val); return; } @@ -734,8 +741,8 @@ try // If no active benchmark, save args as global. if (m_benchmarks.empty()) { - m_global_args.push_back(prop_arg); - m_global_args.push_back(prop_val); + m_global_benchmark_args.push_back(prop_arg); + m_global_benchmark_args.push_back(prop_val); return; } diff --git a/nvbench/option_parser.cuh b/nvbench/option_parser.cuh index c663cec..1fdfb3c 100644 --- a/nvbench/option_parser.cuh +++ b/nvbench/option_parser.cuh @@ -96,7 +96,7 @@ private: // Store benchmark modifiers passed in before any benchmarks are requested as // "global args". Replay them after every benchmark. - std::vector m_global_args; + std::vector m_global_benchmark_args; benchmark_vector m_benchmarks; // Manages lifetimes of any ofstreams opened for m_printer.