mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-04-20 06:48:53 +00:00
Remove min-time/max-noise API. (#223)
These are now owned by the stdrel stopping criterion, and should not be exposed directly in the benchmark/state/etc APIs. This will affect users that are calling `NVBENCH_BENCH(...).set_min_time(...)` or `NVBENCH_BENCH(...).set_max_noise(...)`. These can be updated to `NVBENCH_BENCH(...).set_criterion_param_float64(["min-time"|"max-noise"], ...)`.
This commit is contained in:
@@ -21,27 +21,6 @@
|
||||
|
||||
#include "test_asserts.cuh"
|
||||
|
||||
void test_compat_parameters()
|
||||
{
|
||||
nvbench::criterion_params params;
|
||||
|
||||
ASSERT(params.has_value("max-noise"));
|
||||
ASSERT(params.has_value("min-time"));
|
||||
|
||||
ASSERT(params.get_float64("max-noise") == nvbench::detail::compat_max_noise());
|
||||
ASSERT(params.get_float64("min-time") == nvbench::detail::compat_min_time());
|
||||
}
|
||||
|
||||
void test_compat_overwrite()
|
||||
{
|
||||
nvbench::criterion_params params;
|
||||
params.set_float64("max-noise", 40000.0);
|
||||
params.set_float64("min-time", 42000.0);
|
||||
|
||||
ASSERT(params.get_float64("max-noise") == 40000.0);
|
||||
ASSERT(params.get_float64("min-time") == 42000.0);
|
||||
}
|
||||
|
||||
void test_overwrite()
|
||||
{
|
||||
nvbench::criterion_params params;
|
||||
@@ -54,9 +33,4 @@ void test_overwrite()
|
||||
ASSERT(params.get_float64("custom") == 4.2);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test_compat_parameters();
|
||||
test_compat_overwrite();
|
||||
test_overwrite();
|
||||
}
|
||||
int main() { test_overwrite(); }
|
||||
|
||||
@@ -140,4 +140,4 @@ NVBENCH_BENCH(noisy_bench)
|
||||
.add_float64_axis("Noise", {0.1, 5., 25.}) // %
|
||||
// disable this; we want to test that the benchmarking loop will still exit
|
||||
// when max_noise is never reached:
|
||||
.set_max_noise(0.0000001);
|
||||
.set_criterion_param_float64("max-noise", 0.0000001);
|
||||
|
||||
@@ -1155,26 +1155,6 @@ void test_min_samples()
|
||||
ASSERT(states[0].get_min_samples() == 12345);
|
||||
}
|
||||
|
||||
void test_min_time()
|
||||
{
|
||||
nvbench::option_parser parser;
|
||||
parser.parse({"--benchmark", "DummyBench", "--min-time", "12345e2"});
|
||||
const auto &states = parser_to_states(parser);
|
||||
|
||||
ASSERT(states.size() == 1);
|
||||
ASSERT(std::abs(states[0].get_min_time() - 12345e2) < 1.);
|
||||
}
|
||||
|
||||
void test_max_noise()
|
||||
{
|
||||
nvbench::option_parser parser;
|
||||
parser.parse({"--benchmark", "DummyBench", "--max-noise", "50.3"});
|
||||
const auto &states = parser_to_states(parser);
|
||||
|
||||
ASSERT(states.size() == 1);
|
||||
ASSERT(std::abs(states[0].get_max_noise() - 0.503) < 1.e-4);
|
||||
}
|
||||
|
||||
void test_skip_time()
|
||||
{
|
||||
nvbench::option_parser parser;
|
||||
@@ -1486,8 +1466,6 @@ try
|
||||
test_axis_before_benchmark();
|
||||
|
||||
test_min_samples();
|
||||
test_min_time();
|
||||
test_max_noise();
|
||||
test_skip_time();
|
||||
test_timeout();
|
||||
|
||||
|
||||
@@ -763,8 +763,6 @@ void test_devices()
|
||||
void test_termination_criteria()
|
||||
{
|
||||
const nvbench::int64_t min_samples = 1000;
|
||||
const nvbench::float64_t min_time = 2000;
|
||||
const nvbench::float64_t max_noise = 3000;
|
||||
const nvbench::float64_t skip_time = 4000;
|
||||
const nvbench::float64_t timeout = 5000;
|
||||
|
||||
@@ -774,8 +772,6 @@ void test_termination_criteria()
|
||||
dummy_bench bench;
|
||||
bench.set_devices(std::vector<int>{});
|
||||
bench.set_min_samples(min_samples);
|
||||
bench.set_min_time(min_time);
|
||||
bench.set_max_noise(max_noise);
|
||||
bench.set_skip_time(skip_time);
|
||||
bench.set_timeout(timeout);
|
||||
|
||||
@@ -783,8 +779,6 @@ void test_termination_criteria()
|
||||
|
||||
ASSERT(states.size() == 1);
|
||||
ASSERT(min_samples == states[0].get_min_samples());
|
||||
ASSERT(within_one(min_time, states[0].get_min_time()));
|
||||
ASSERT(within_one(max_noise, states[0].get_max_noise()));
|
||||
ASSERT(within_one(skip_time, states[0].get_skip_time()));
|
||||
ASSERT(within_one(timeout, states[0].get_timeout()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user