Skip to content

Commit 266a38c

Browse files
nvbench::state::set_stopping_criterion now also sets criterion params
This change closes gh-255 by alignign implementation of state::set_stopping_criterion with that of benchmark_base::set_stopping_criterion.
1 parent 0c24f02 commit 266a38c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

nvbench/state.cuh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,7 @@ struct state
151151
/// Control the stopping criterion for the measurement loop.
152152
/// @{
153153
[[nodiscard]] const std::string &get_stopping_criterion() const { return m_stopping_criterion; }
154-
void set_stopping_criterion(std::string criterion)
155-
{
156-
m_stopping_criterion = std::move(criterion);
157-
}
154+
void set_stopping_criterion(std::string criterion);
158155
/// @}
159156

160157
/// If true, the benchmark is only run once, skipping all warmup runs and only

nvbench/state.cxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* limitations under the License.
1717
*/
1818
#include <nvbench/benchmark_base.cuh>
19+
#include <nvbench/criterion_manager.cuh>
1920
#include <nvbench/detail/throw.cuh>
2021
#include <nvbench/state.cuh>
2122
#include <nvbench/types.cuh>
@@ -300,4 +301,10 @@ void state::add_buffer_size(std::size_t num_bytes,
300301
}
301302
}
302303

304+
void state::set_stopping_criterion(std::string criterion)
305+
{
306+
m_stopping_criterion = std::move(criterion);
307+
m_criterion_params = criterion_manager::get().get_criterion(m_stopping_criterion).get_params();
308+
}
309+
303310
} // namespace nvbench

0 commit comments

Comments
 (0)