nvbench::state::set_stopping_criterion now also sets criterion params (#257)

This change closes gh-255 by alignign implementation of
state::set_stopping_criterion with that of
benchmark_base::set_stopping_criterion.
This commit is contained in:
Oleksandr Pavlyk
2025-08-01 13:46:36 -05:00
committed by GitHub
parent f12edf722b
commit 080052a564
2 changed files with 8 additions and 4 deletions

View File

@@ -151,10 +151,7 @@ struct state
/// Control the stopping criterion for the measurement loop.
/// @{
[[nodiscard]] const std::string &get_stopping_criterion() const { return m_stopping_criterion; }
void set_stopping_criterion(std::string criterion)
{
m_stopping_criterion = std::move(criterion);
}
void set_stopping_criterion(std::string criterion);
/// @}
/// If true, the benchmark is only run once, skipping all warmup runs and only

View File

@@ -16,6 +16,7 @@
* limitations under the License.
*/
#include <nvbench/benchmark_base.cuh>
#include <nvbench/criterion_manager.cuh>
#include <nvbench/detail/throw.cuh>
#include <nvbench/state.cuh>
#include <nvbench/types.cuh>
@@ -300,4 +301,10 @@ void state::add_buffer_size(std::size_t num_bytes,
}
}
void state::set_stopping_criterion(std::string criterion)
{
m_stopping_criterion = std::move(criterion);
m_criterion_params = criterion_manager::get().get_criterion(m_stopping_criterion).get_params();
}
} // namespace nvbench