Skip to content

Commit 254ac25

Browse files
committed
Remove discard on throttle option
1 parent b926daf commit 254ac25

File tree

9 files changed

+11
-57
lines changed

9 files changed

+11
-57
lines changed

docs/cli_help.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,6 @@
133133
* Applies to the most recent `--benchmark`, or all benchmarks if specified
134134
before any `--benchmark` arguments.
135135

136-
* `--discard-on-throttle`
137-
* Discard measurements if the GPU is throttled.
138-
* Applies to the most recent `--benchmark`, or all benchmarks if specified
139-
before any `--benchmark` arguments.
140-
141136
* `--throttle-threshold <value>`
142137
* Set the GPU throttle threshold as percentage of the peak clock rate.
143138
* Default is 75%.

nvbench/benchmark_base.cuh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,6 @@ struct benchmark_base
264264
m_throttle_recovery_delay = throttle_recovery_delay;
265265
}
266266

267-
[[nodiscard]] bool get_discard_on_throttle() const { return m_discard_on_throttle; }
268-
269-
void set_discard_on_throttle(bool discard_on_throttle)
270-
{
271-
m_discard_on_throttle = discard_on_throttle;
272-
}
273-
274267
[[nodiscard]] nvbench::criterion_params &get_criterion_params() { return m_criterion_params; }
275268
[[nodiscard]] const nvbench::criterion_params &get_criterion_params() const
276269
{
@@ -311,7 +304,6 @@ protected:
311304

312305
nvbench::float32_t m_throttle_threshold{0.75f}; // [% of peak SM clock rate]
313306
nvbench::float32_t m_throttle_recovery_delay{0.05f}; // [seconds]
314-
bool m_discard_on_throttle{false};
315307

316308
nvbench::criterion_params m_criterion_params;
317309
std::string m_stopping_criterion{"stdrel"};

nvbench/benchmark_base.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ std::unique_ptr<benchmark_base> benchmark_base::clone() const
4747
result->m_criterion_params = m_criterion_params;
4848
result->m_throttle_threshold = m_throttle_threshold;
4949
result->m_throttle_recovery_delay = m_throttle_recovery_delay;
50-
result->m_discard_on_throttle = m_discard_on_throttle;
5150

5251
result->m_stopping_criterion = m_stopping_criterion;
5352

nvbench/detail/measure_cold.cu

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#include <nvbench/summary.cuh>
2727

2828
#include <algorithm>
29-
#include <limits>
3029
#include <chrono>
30+
#include <limits>
3131
#include <thread>
3232

3333
#include <fmt/format.h>
@@ -48,7 +48,6 @@ measure_cold_base::measure_cold_base(state &exec_state)
4848
, m_timeout{exec_state.get_timeout()}
4949
, m_throttle_threshold(exec_state.get_throttle_threshold())
5050
, m_throttle_recovery_delay(exec_state.get_throttle_recovery_delay())
51-
, m_discard_on_throttle(exec_state.get_discard_on_throttle())
5251
{
5352
if (m_min_samples > 0)
5453
{
@@ -96,7 +95,6 @@ void measure_cold_base::record_measurements()
9695
if (!m_run_once)
9796
{
9897
auto peak_clock_rate = static_cast<float>(m_state.get_device()->get_sm_default_clock_rate());
99-
m_sm_clock_rates.push_back(peak_clock_rate);
10098

10199
if (m_gpu_frequency.has_throttled(peak_clock_rate, m_throttle_threshold))
102100
{
@@ -106,14 +104,13 @@ void measure_cold_base::record_measurements()
106104
auto &printer = printer_opt_ref.value().get();
107105
printer.log(nvbench::log_level::warn,
108106
fmt::format("GPU throttled below threshold ({:0.2f} MHz / {:0.2f} MHz) "
109-
"({:0.0f}% < {:0.0f}%) on sample {}. {} previous sample and "
110-
"pausing for {}s.",
107+
"({:0.0f}% < {:0.0f}%) on sample {}. Discarding previous sample "
108+
"and pausing for {}s.",
111109
current_clock_rate / 1000000.0f,
112110
peak_clock_rate / 1000000.0f,
113111
100.0f * (current_clock_rate / peak_clock_rate),
114112
100.0f * m_throttle_threshold,
115113
m_total_samples,
116-
m_discard_on_throttle ? "Discarding" : "Keeping",
117114
m_throttle_recovery_delay));
118115
}
119116

@@ -122,11 +119,11 @@ void measure_cold_base::record_measurements()
122119
std::this_thread::sleep_for(std::chrono::duration<float>(m_throttle_recovery_delay));
123120
}
124121

125-
if (m_discard_on_throttle)
126-
{ // ignore this measurement
127-
return;
128-
}
122+
// ignore this measurement
123+
return;
129124
}
125+
126+
m_sm_clock_rates.push_back(peak_clock_rate);
130127
}
131128

132129
// Update and record timers and counters:
@@ -348,8 +345,9 @@ void measure_cold_base::generate_summaries()
348345
summ.set_string("hint", "frequency");
349346
summ.set_string("description", "Mean SM clock rate");
350347
summ.set_string("hide", "Hidden by default.");
351-
summ.set_float64("value", nvbench::detail::statistics::compute_mean(m_sm_clock_rates.cbegin(),
352-
m_sm_clock_rates.cend()));
348+
summ.set_float64("value",
349+
nvbench::detail::statistics::compute_mean(m_sm_clock_rates.cbegin(),
350+
m_sm_clock_rates.cend()));
353351
}
354352

355353
// Log if a printer exists:

nvbench/detail/measure_cold.cuh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ protected:
104104

105105
nvbench::float32_t m_throttle_threshold; // [% of peak SM clock rate]
106106
nvbench::float32_t m_throttle_recovery_delay; // [seconds]
107-
bool m_discard_on_throttle{false};
108107

109108
nvbench::int64_t m_total_samples{};
110109

nvbench/option_parser.cu

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,6 @@ void option_parser::parse_range(option_parser::arg_iterator_t first,
431431
this->lock_gpu_clocks(first[1]);
432432
first += 2;
433433
}
434-
else if (arg == "--discard-on-throttle")
435-
{
436-
this->enable_discard_on_throttle();
437-
first += 1;
438-
}
439434
else if (arg == "--run-once")
440435
{
441436
this->enable_run_once();
@@ -731,18 +726,6 @@ void option_parser::enable_run_once()
731726
bench.set_run_once(true);
732727
}
733728

734-
void option_parser::enable_discard_on_throttle()
735-
{
736-
if (m_benchmarks.empty())
737-
{
738-
m_global_benchmark_args.push_back("--discard-on-throttle");
739-
return;
740-
}
741-
742-
benchmark_base &bench = *m_benchmarks.back();
743-
bench.set_discard_on_throttle(true);
744-
}
745-
746729
void option_parser::set_stopping_criterion(const std::string &criterion)
747730
{
748731
// If no active benchmark, save args as global.

nvbench/option_parser.cuh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ private:
8989

9090
void set_stopping_criterion(const std::string &criterion);
9191
void enable_run_once();
92-
void enable_discard_on_throttle();
9392
void disable_blocking_kernel();
9493

9594
void add_benchmark(const std::string &name);

nvbench/state.cuh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,6 @@ struct state
220220
m_throttle_recovery_delay = throttle_recovery_delay;
221221
}
222222

223-
[[nodiscard]] bool get_discard_on_throttle() const { return m_discard_on_throttle; }
224-
225-
void set_discard_on_throttle(bool discard_on_throttle)
226-
{
227-
m_discard_on_throttle = discard_on_throttle;
228-
}
229-
230223
/// If a `KernelLauncher` syncs and `nvbench::exec_tag::sync` is not passed
231224
/// to `state.exec(...)`, a deadlock may occur. If a `blocking_kernel` blocks
232225
/// for more than `blocking_kernel_timeout` seconds, an error will be printed
@@ -340,7 +333,6 @@ private:
340333

341334
nvbench::float32_t m_throttle_threshold; // [% of peak SM clock rate]
342335
nvbench::float32_t m_throttle_recovery_delay; // [seconds]
343-
bool m_discard_on_throttle{false};
344336

345337
// Deadlock protection. See blocking_kernel's class doc for details.
346338
nvbench::float64_t m_blocking_kernel_timeout{30.0};

nvbench/state.cxx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18-
#include <nvbench/state.cuh>
19-
2018
#include <nvbench/benchmark_base.cuh>
2119
#include <nvbench/detail/throw.cuh>
20+
#include <nvbench/state.cuh>
2221
#include <nvbench/types.cuh>
2322

2423
#include <algorithm>
@@ -43,7 +42,6 @@ state::state(const benchmark_base &bench)
4342
, m_timeout{bench.get_timeout()}
4443
, m_throttle_threshold{bench.get_throttle_threshold()}
4544
, m_throttle_recovery_delay{bench.get_throttle_recovery_delay()}
46-
, m_discard_on_throttle{bench.get_discard_on_throttle()}
4745
{}
4846

4947
state::state(const benchmark_base &bench,
@@ -64,7 +62,6 @@ state::state(const benchmark_base &bench,
6462
, m_timeout{bench.get_timeout()}
6563
, m_throttle_threshold{bench.get_throttle_threshold()}
6664
, m_throttle_recovery_delay{bench.get_throttle_recovery_delay()}
67-
, m_discard_on_throttle{bench.get_discard_on_throttle()}
6865
{}
6966

7067
nvbench::int64_t state::get_int64(const std::string &axis_name) const

0 commit comments

Comments
 (0)