mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-05-01 04:01:14 +00:00
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:
@@ -151,10 +151,7 @@ struct state
|
|||||||
/// Control the stopping criterion for the measurement loop.
|
/// Control the stopping criterion for the measurement loop.
|
||||||
/// @{
|
/// @{
|
||||||
[[nodiscard]] const std::string &get_stopping_criterion() const { return m_stopping_criterion; }
|
[[nodiscard]] const std::string &get_stopping_criterion() const { return m_stopping_criterion; }
|
||||||
void set_stopping_criterion(std::string criterion)
|
void set_stopping_criterion(std::string criterion);
|
||||||
{
|
|
||||||
m_stopping_criterion = std::move(criterion);
|
|
||||||
}
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// If true, the benchmark is only run once, skipping all warmup runs and only
|
/// If true, the benchmark is only run once, skipping all warmup runs and only
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include <nvbench/benchmark_base.cuh>
|
#include <nvbench/benchmark_base.cuh>
|
||||||
|
#include <nvbench/criterion_manager.cuh>
|
||||||
#include <nvbench/detail/throw.cuh>
|
#include <nvbench/detail/throw.cuh>
|
||||||
#include <nvbench/state.cuh>
|
#include <nvbench/state.cuh>
|
||||||
#include <nvbench/types.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
|
} // namespace nvbench
|
||||||
|
|||||||
Reference in New Issue
Block a user