Skip to content

Commit e9b5eb2

Browse files
Support nvbench.State.set_throttle_threshold
1 parent 8f05b9f commit e9b5eb2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

python/cuda/nvbench/__init__.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,10 @@ class State:
169169
"Get Benchmark this configuration is a part of"
170170
...
171171
def get_throttle_threshold(self) -> float:
172-
"Get throttle threshold value"
172+
"Get throttle threshold value, as fraction of maximal frequency"
173+
...
174+
def set_throttle_threshold(self, threshold_fraction: float) -> None:
175+
"Set throttle threshold fraction to specified value, expected to be between 0 and 1"
173176
...
174177
def get_min_samples(self) -> int:
175178
"Get the number of benchmark timings NVBench performs before stopping criterion begins being used"

python/src/py_nvbench.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,9 @@ PYBIND11_MODULE(_nvbench, m)
481481
[](const nvbench::state &state) { return std::ref(state.get_benchmark()); },
482482
py::return_value_policy::reference);
483483
pystate_cls.def("get_throttle_threshold", &nvbench::state::get_throttle_threshold);
484+
pystate_cls.def("set_throttle_threshold",
485+
&nvbench::state::set_throttle_threshold,
486+
py::arg("throttle_fraction"));
484487

485488
pystate_cls.def("get_min_samples", &nvbench::state::get_min_samples);
486489
pystate_cls.def("set_min_samples",

0 commit comments

Comments
 (0)