Merge remote-tracking branch 'origin/main' into fea/axes_iteration_space

This commit is contained in:
Allison Piper
2025-05-01 16:36:56 +00:00
2 changed files with 12 additions and 5 deletions

View File

@@ -21,6 +21,7 @@
#include <nvbench/detail/transform_reduce.cuh>
#include <algorithm>
#include <cstdint>
namespace nvbench
{
@@ -89,7 +90,7 @@ std::size_t benchmark_base::get_config_count() const
std::multiplies<>{},
[&axes](const auto &space) { return space->get_active_count(axes); });
return (value_count * type_count) * std::max(1UL, m_devices.size());
return (value_count * type_count) * std::max(std::size_t(1), m_devices.size());
}
benchmark_base &benchmark_base::set_stopping_criterion(std::string criterion)

View File

@@ -18,6 +18,7 @@
#include <nvbench/benchmark.cuh>
#include <nvbench/callable.cuh>
#include <nvbench/device_manager.cuh>
#include <nvbench/named_values.cuh>
#include <nvbench/state.cuh>
#include <nvbench/type_list.cuh>
@@ -27,6 +28,7 @@
#include <fmt/format.h>
#include <algorithm>
#include <cstdint>
#include <utility>
#include <variant>
#include <vector>
@@ -279,6 +281,7 @@ void test_clone()
void test_get_config_count()
{
lots_of_types_bench bench;
bench.set_devices(nvbench::device_manager::get().get_devices());
bench.set_type_axes_names({"Integer", "Float", "Other"});
bench.get_axes().get_type_axis(0).set_active_inputs({"I16", "I32"}); // 2, 2
bench.get_axes().get_type_axis(1).set_active_inputs({"F32", "F64"}); // 2, 4
@@ -288,10 +291,13 @@ void test_get_config_count()
bench.add_string_axis("baz", {"str", "ing"}); // 2, 72
bench.add_string_axis("fez", {"single"}); // 1, 72
auto const num_devices = bench.get_devices().size();
ASSERT_MSG(bench.get_config_count() == 72 * num_devices,
"Got {}",
bench.get_config_count());
auto const num_devices = std::max(std::size_t(1), bench.get_devices().size());
ASSERT_MSG(bench.get_config_count() == 72 * num_devices, "Got {}", bench.get_config_count());
// Check that zero devices (e.g. CPU-only) is the same as a single device:
bench.set_devices(std::vector<int>{});
ASSERT_MSG(bench.get_config_count() == 72, "Got {}", bench.get_config_count());
}
int main()