mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-03-14 20:27:24 +00:00
fmt::memory_buffer is no longer an iterator.
This commit is contained in:
@@ -129,13 +129,13 @@ void test_type_axes()
|
||||
fmt::memory_buffer buffer;
|
||||
for (const auto &axis : axes.get_axes())
|
||||
{
|
||||
fmt::format_to(buffer, "Axis: {}\n", axis->get_name());
|
||||
fmt::format_to(std::back_inserter(buffer), "Axis: {}\n", axis->get_name());
|
||||
const auto num_values = axis->get_size();
|
||||
for (std::size_t i = 0; i < num_values; ++i)
|
||||
{
|
||||
auto input_string = axis->get_input_string(i);
|
||||
auto description = axis->get_description(i);
|
||||
fmt::format_to(buffer,
|
||||
fmt::format_to(std::back_inserter(buffer),
|
||||
" - {}{}\n",
|
||||
input_string,
|
||||
description.empty() ? ""
|
||||
|
||||
@@ -44,13 +44,13 @@ std::vector<T> sort(std::vector<T> &&vec)
|
||||
void no_op_generator(nvbench::state &state)
|
||||
{
|
||||
fmt::memory_buffer params;
|
||||
fmt::format_to(params, "Params:");
|
||||
fmt::format_to(std::back_inserter(params), "Params:");
|
||||
const auto &axis_values = state.get_axis_values();
|
||||
for (const auto &name : sort(axis_values.get_names()))
|
||||
{
|
||||
std::visit(
|
||||
[¶ms, &name](const auto &value) {
|
||||
fmt::format_to(params, " {}: {}", name, value);
|
||||
fmt::format_to(std::back_inserter(params), " {}: {}", name, value);
|
||||
},
|
||||
axis_values.get_value(name));
|
||||
}
|
||||
@@ -101,13 +101,13 @@ void test_type_axes()
|
||||
const auto &axes = bench.get_axes().get_axes();
|
||||
for (const auto &axis : axes)
|
||||
{
|
||||
fmt::format_to(buffer, "Axis: {}\n", axis->get_name());
|
||||
fmt::format_to(std::back_inserter(buffer), "Axis: {}\n", axis->get_name());
|
||||
const auto num_values = axis->get_size();
|
||||
for (std::size_t i = 0; i < num_values; ++i)
|
||||
{
|
||||
auto input_string = axis->get_input_string(i);
|
||||
auto description = axis->get_description(i);
|
||||
fmt::format_to(buffer,
|
||||
fmt::format_to(std::back_inserter(buffer),
|
||||
" - {}{}\n",
|
||||
input_string,
|
||||
description.empty() ? ""
|
||||
@@ -148,7 +148,7 @@ void test_type_configs()
|
||||
using Integer = nvbench::tl::get<0, Conf>;
|
||||
using Float = nvbench::tl::get<1, Conf>;
|
||||
using Other = nvbench::tl::get<2, Conf>;
|
||||
fmt::format_to(buffer,
|
||||
fmt::format_to(std::back_inserter(buffer),
|
||||
"type_configs[{:2d}] = <{:>3}, {:>3}, {:>4}>\n",
|
||||
idx++,
|
||||
nvbench::type_strings<Integer>::input_string(),
|
||||
|
||||
@@ -44,13 +44,13 @@ std::vector<T> sort(std::vector<T> &&vec)
|
||||
void no_op_generator(nvbench::state &state)
|
||||
{
|
||||
fmt::memory_buffer params;
|
||||
fmt::format_to(params, "Params:");
|
||||
fmt::format_to(std::back_inserter(params), "Params:");
|
||||
const auto &axis_values = state.get_axis_values();
|
||||
for (const auto &name : sort(axis_values.get_names()))
|
||||
{
|
||||
std::visit(
|
||||
[¶ms, &name](const auto &value) {
|
||||
fmt::format_to(params, " {}: {}", name, value);
|
||||
fmt::format_to(std::back_inserter(params), " {}: {}", name, value);
|
||||
},
|
||||
axis_values.get_value(name));
|
||||
}
|
||||
@@ -109,7 +109,7 @@ std::string run_and_get_state_string(nvbench::benchmark_base &bench,
|
||||
for (const auto &state : states)
|
||||
{
|
||||
ASSERT(state.is_skipped());
|
||||
fmt::format_to(buffer, "{}\n", state.get_skip_reason());
|
||||
fmt::format_to(std::back_inserter(buffer), "{}\n", state.get_skip_reason());
|
||||
}
|
||||
return fmt::to_string(buffer);
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ states_to_string(const std::vector<nvbench::state> &states)
|
||||
std::string table_format = "| {:^5} | {:^10} | {:^4} | {:^4} | {:^4} "
|
||||
"| {:^4} | {:^6} | {:^8} |\n";
|
||||
|
||||
fmt::format_to(buffer, "\n");
|
||||
fmt::format_to(buffer,
|
||||
fmt::format_to(std::back_inserter(buffer), "\n");
|
||||
fmt::format_to(std::back_inserter(buffer),
|
||||
table_format,
|
||||
"State",
|
||||
"TypeConfig",
|
||||
@@ -72,7 +72,7 @@ states_to_string(const std::vector<nvbench::state> &states)
|
||||
std::size_t config = 0;
|
||||
for (const auto &state : states)
|
||||
{
|
||||
fmt::format_to(buffer,
|
||||
fmt::format_to(std::back_inserter(buffer),
|
||||
table_format,
|
||||
config++,
|
||||
state.get_type_config_index(),
|
||||
|
||||
@@ -43,13 +43,13 @@ std::vector<T> sort(std::vector<T> &&vec)
|
||||
void no_op_generator(nvbench::state &state)
|
||||
{
|
||||
fmt::memory_buffer params;
|
||||
fmt::format_to(params, "Params:");
|
||||
fmt::format_to(std::back_inserter(params), "Params:");
|
||||
const auto &axis_values = state.get_axis_values();
|
||||
for (const auto &name : sort(axis_values.get_names()))
|
||||
{
|
||||
std::visit(
|
||||
[¶ms, &name](const auto &value) {
|
||||
fmt::format_to(params, " {}: {}", name, value);
|
||||
fmt::format_to(std::back_inserter(params), " {}: {}", name, value);
|
||||
},
|
||||
axis_values.get_value(name));
|
||||
}
|
||||
@@ -124,7 +124,7 @@ void test_non_types()
|
||||
for (const auto &state : bench.get_states())
|
||||
{
|
||||
ASSERT(state.is_skipped() == true);
|
||||
fmt::format_to(buffer, "{}\n", state.get_skip_reason());
|
||||
fmt::format_to(std::back_inserter(buffer), "{}\n", state.get_skip_reason());
|
||||
}
|
||||
|
||||
const std::string ref = R"expected(Params: Float: 11 Int: 1 String: One
|
||||
@@ -184,7 +184,7 @@ void test_types()
|
||||
for (const auto &state : bench.get_states())
|
||||
{
|
||||
ASSERT(state.is_skipped() == true);
|
||||
fmt::format_to(buffer, "{}\n", state.get_skip_reason());
|
||||
fmt::format_to(std::back_inserter(buffer), "{}\n", state.get_skip_reason());
|
||||
}
|
||||
|
||||
const std::string ref = R"expected(Params: FloatT: F32 IntT: I32 MiscT: bool
|
||||
@@ -228,7 +228,7 @@ void test_both()
|
||||
for (const auto &state : bench.get_states())
|
||||
{
|
||||
ASSERT(state.is_skipped() == true);
|
||||
fmt::format_to(buffer, "{}\n", state.get_skip_reason());
|
||||
fmt::format_to(std::back_inserter(buffer), "{}\n", state.get_skip_reason());
|
||||
}
|
||||
|
||||
const std::string ref =
|
||||
|
||||
@@ -89,17 +89,17 @@ void test_basic()
|
||||
for (sg.init(); sg.iter_valid(); sg.next())
|
||||
{
|
||||
line.clear();
|
||||
fmt::format_to(line, "| {:^2}", line_num++);
|
||||
fmt::format_to(std::back_inserter(line), "| {:^2}", line_num++);
|
||||
for (auto &axis_index : sg.get_current_indices())
|
||||
{
|
||||
ASSERT(axis_index.type == nvbench::axis_type::string);
|
||||
fmt::format_to(line,
|
||||
fmt::format_to(std::back_inserter(line),
|
||||
" | {}: {}/{}",
|
||||
axis_index.axis,
|
||||
axis_index.index,
|
||||
axis_index.size);
|
||||
}
|
||||
fmt::format_to(buffer, "{} |\n", fmt::to_string(line));
|
||||
fmt::format_to(std::back_inserter(buffer), "{} |\n", fmt::to_string(line));
|
||||
}
|
||||
|
||||
const std::string ref =
|
||||
@@ -166,8 +166,8 @@ void test_create()
|
||||
const std::string table_format =
|
||||
"| {:^5} | {:^10} | {:^7} | {:^7} | {:^9} | {:^9} |\n";
|
||||
|
||||
fmt::format_to(buffer, "\n");
|
||||
fmt::format_to(buffer,
|
||||
fmt::format_to(std::back_inserter(buffer), "\n");
|
||||
fmt::format_to(std::back_inserter(buffer),
|
||||
table_format,
|
||||
"State",
|
||||
"TypeConfig",
|
||||
@@ -179,7 +179,7 @@ void test_create()
|
||||
std::size_t config = 0;
|
||||
for (const auto &state : states)
|
||||
{
|
||||
fmt::format_to(buffer,
|
||||
fmt::format_to(std::back_inserter(buffer),
|
||||
table_format,
|
||||
config++,
|
||||
state.get_type_config_index(),
|
||||
@@ -258,8 +258,8 @@ void test_create_with_types()
|
||||
std::string table_format = "| {:^5} | {:^10} | {:^6} | {:^4} | {:^4} | {:^7} "
|
||||
"| {:^7} | {:^9} | {:^9} |\n";
|
||||
|
||||
fmt::format_to(buffer, "\n");
|
||||
fmt::format_to(buffer,
|
||||
fmt::format_to(std::back_inserter(buffer), "\n");
|
||||
fmt::format_to(std::back_inserter(buffer),
|
||||
table_format,
|
||||
"State",
|
||||
"TypeConfig",
|
||||
@@ -274,7 +274,7 @@ void test_create_with_types()
|
||||
std::size_t config = 0;
|
||||
for (const auto &state : states)
|
||||
{
|
||||
fmt::format_to(buffer,
|
||||
fmt::format_to(std::back_inserter(buffer),
|
||||
table_format,
|
||||
config++,
|
||||
state.get_type_config_index(),
|
||||
@@ -607,8 +607,8 @@ void test_create_with_masked_types()
|
||||
std::string table_format = "| {:^5} | {:^10} | {:^6} | {:^4} | {:^4} | {:^7} "
|
||||
"| {:^7} | {:^9} | {:^9} |\n";
|
||||
|
||||
fmt::format_to(buffer, "\n");
|
||||
fmt::format_to(buffer,
|
||||
fmt::format_to(std::back_inserter(buffer), "\n");
|
||||
fmt::format_to(std::back_inserter(buffer),
|
||||
table_format,
|
||||
"State",
|
||||
"TypeConfig",
|
||||
@@ -623,7 +623,7 @@ void test_create_with_masked_types()
|
||||
std::size_t config = 0;
|
||||
for (const auto &state : states)
|
||||
{
|
||||
fmt::format_to(buffer,
|
||||
fmt::format_to(std::back_inserter(buffer),
|
||||
table_format,
|
||||
config++,
|
||||
state.get_type_config_index(),
|
||||
@@ -737,13 +737,13 @@ void test_devices()
|
||||
fmt::memory_buffer buffer;
|
||||
const std::string table_format = "| {:^5} | {:^6} | {:^5} | {:^3} |\n";
|
||||
|
||||
fmt::format_to(buffer, "\n");
|
||||
fmt::format_to(buffer, table_format, "State", "Device", "S", "I");
|
||||
fmt::format_to(std::back_inserter(buffer), "\n");
|
||||
fmt::format_to(std::back_inserter(buffer), table_format, "State", "Device", "S", "I");
|
||||
|
||||
std::size_t config = 0;
|
||||
for (const auto &state : states)
|
||||
{
|
||||
fmt::format_to(buffer,
|
||||
fmt::format_to(std::back_inserter(buffer),
|
||||
table_format,
|
||||
config++,
|
||||
state.get_device()->get_id(),
|
||||
|
||||
Reference in New Issue
Block a user