Remove discard on throttle option

This commit is contained in:
Georgy Evtushenko
2025-04-12 21:13:13 -07:00
parent b926daf09f
commit 254ac2517f
9 changed files with 11 additions and 57 deletions

View File

@@ -133,11 +133,6 @@
* Applies to the most recent `--benchmark`, or all benchmarks if specified
before any `--benchmark` arguments.
* `--discard-on-throttle`
* Discard measurements if the GPU is throttled.
* Applies to the most recent `--benchmark`, or all benchmarks if specified
before any `--benchmark` arguments.
* `--throttle-threshold <value>`
* Set the GPU throttle threshold as percentage of the peak clock rate.
* Default is 75%.

View File

@@ -264,13 +264,6 @@ struct benchmark_base
m_throttle_recovery_delay = throttle_recovery_delay;
}
[[nodiscard]] bool get_discard_on_throttle() const { return m_discard_on_throttle; }
void set_discard_on_throttle(bool discard_on_throttle)
{
m_discard_on_throttle = discard_on_throttle;
}
[[nodiscard]] nvbench::criterion_params &get_criterion_params() { return m_criterion_params; }
[[nodiscard]] const nvbench::criterion_params &get_criterion_params() const
{
@@ -311,7 +304,6 @@ protected:
nvbench::float32_t m_throttle_threshold{0.75f}; // [% of peak SM clock rate]
nvbench::float32_t m_throttle_recovery_delay{0.05f}; // [seconds]
bool m_discard_on_throttle{false};
nvbench::criterion_params m_criterion_params;
std::string m_stopping_criterion{"stdrel"};

View File

@@ -47,7 +47,6 @@ std::unique_ptr<benchmark_base> benchmark_base::clone() const
result->m_criterion_params = m_criterion_params;
result->m_throttle_threshold = m_throttle_threshold;
result->m_throttle_recovery_delay = m_throttle_recovery_delay;
result->m_discard_on_throttle = m_discard_on_throttle;
result->m_stopping_criterion = m_stopping_criterion;

View File

@@ -26,8 +26,8 @@
#include <nvbench/summary.cuh>
#include <algorithm>
#include <limits>
#include <chrono>
#include <limits>
#include <thread>
#include <fmt/format.h>
@@ -48,7 +48,6 @@ measure_cold_base::measure_cold_base(state &exec_state)
, m_timeout{exec_state.get_timeout()}
, m_throttle_threshold(exec_state.get_throttle_threshold())
, m_throttle_recovery_delay(exec_state.get_throttle_recovery_delay())
, m_discard_on_throttle(exec_state.get_discard_on_throttle())
{
if (m_min_samples > 0)
{
@@ -96,7 +95,6 @@ void measure_cold_base::record_measurements()
if (!m_run_once)
{
auto peak_clock_rate = static_cast<float>(m_state.get_device()->get_sm_default_clock_rate());
m_sm_clock_rates.push_back(peak_clock_rate);
if (m_gpu_frequency.has_throttled(peak_clock_rate, m_throttle_threshold))
{
@@ -106,14 +104,13 @@ void measure_cold_base::record_measurements()
auto &printer = printer_opt_ref.value().get();
printer.log(nvbench::log_level::warn,
fmt::format("GPU throttled below threshold ({:0.2f} MHz / {:0.2f} MHz) "
"({:0.0f}% < {:0.0f}%) on sample {}. {} previous sample and "
"pausing for {}s.",
"({:0.0f}% < {:0.0f}%) on sample {}. Discarding previous sample "
"and pausing for {}s.",
current_clock_rate / 1000000.0f,
peak_clock_rate / 1000000.0f,
100.0f * (current_clock_rate / peak_clock_rate),
100.0f * m_throttle_threshold,
m_total_samples,
m_discard_on_throttle ? "Discarding" : "Keeping",
m_throttle_recovery_delay));
}
@@ -122,11 +119,11 @@ void measure_cold_base::record_measurements()
std::this_thread::sleep_for(std::chrono::duration<float>(m_throttle_recovery_delay));
}
if (m_discard_on_throttle)
{ // ignore this measurement
return;
}
// ignore this measurement
return;
}
m_sm_clock_rates.push_back(peak_clock_rate);
}
// Update and record timers and counters:
@@ -348,8 +345,9 @@ void measure_cold_base::generate_summaries()
summ.set_string("hint", "frequency");
summ.set_string("description", "Mean SM clock rate");
summ.set_string("hide", "Hidden by default.");
summ.set_float64("value", nvbench::detail::statistics::compute_mean(m_sm_clock_rates.cbegin(),
m_sm_clock_rates.cend()));
summ.set_float64("value",
nvbench::detail::statistics::compute_mean(m_sm_clock_rates.cbegin(),
m_sm_clock_rates.cend()));
}
// Log if a printer exists:

View File

@@ -104,7 +104,6 @@ protected:
nvbench::float32_t m_throttle_threshold; // [% of peak SM clock rate]
nvbench::float32_t m_throttle_recovery_delay; // [seconds]
bool m_discard_on_throttle{false};
nvbench::int64_t m_total_samples{};

View File

@@ -431,11 +431,6 @@ void option_parser::parse_range(option_parser::arg_iterator_t first,
this->lock_gpu_clocks(first[1]);
first += 2;
}
else if (arg == "--discard-on-throttle")
{
this->enable_discard_on_throttle();
first += 1;
}
else if (arg == "--run-once")
{
this->enable_run_once();
@@ -731,18 +726,6 @@ void option_parser::enable_run_once()
bench.set_run_once(true);
}
void option_parser::enable_discard_on_throttle()
{
if (m_benchmarks.empty())
{
m_global_benchmark_args.push_back("--discard-on-throttle");
return;
}
benchmark_base &bench = *m_benchmarks.back();
bench.set_discard_on_throttle(true);
}
void option_parser::set_stopping_criterion(const std::string &criterion)
{
// If no active benchmark, save args as global.

View File

@@ -89,7 +89,6 @@ private:
void set_stopping_criterion(const std::string &criterion);
void enable_run_once();
void enable_discard_on_throttle();
void disable_blocking_kernel();
void add_benchmark(const std::string &name);

View File

@@ -220,13 +220,6 @@ struct state
m_throttle_recovery_delay = throttle_recovery_delay;
}
[[nodiscard]] bool get_discard_on_throttle() const { return m_discard_on_throttle; }
void set_discard_on_throttle(bool discard_on_throttle)
{
m_discard_on_throttle = discard_on_throttle;
}
/// If a `KernelLauncher` syncs and `nvbench::exec_tag::sync` is not passed
/// to `state.exec(...)`, a deadlock may occur. If a `blocking_kernel` blocks
/// for more than `blocking_kernel_timeout` seconds, an error will be printed
@@ -340,7 +333,6 @@ private:
nvbench::float32_t m_throttle_threshold; // [% of peak SM clock rate]
nvbench::float32_t m_throttle_recovery_delay; // [seconds]
bool m_discard_on_throttle{false};
// Deadlock protection. See blocking_kernel's class doc for details.
nvbench::float64_t m_blocking_kernel_timeout{30.0};

View File

@@ -15,10 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <nvbench/state.cuh>
#include <nvbench/benchmark_base.cuh>
#include <nvbench/detail/throw.cuh>
#include <nvbench/state.cuh>
#include <nvbench/types.cuh>
#include <algorithm>
@@ -43,7 +42,6 @@ state::state(const benchmark_base &bench)
, m_timeout{bench.get_timeout()}
, m_throttle_threshold{bench.get_throttle_threshold()}
, m_throttle_recovery_delay{bench.get_throttle_recovery_delay()}
, m_discard_on_throttle{bench.get_discard_on_throttle()}
{}
state::state(const benchmark_base &bench,
@@ -64,7 +62,6 @@ state::state(const benchmark_base &bench,
, m_timeout{bench.get_timeout()}
, m_throttle_threshold{bench.get_throttle_threshold()}
, m_throttle_recovery_delay{bench.get_throttle_recovery_delay()}
, m_discard_on_throttle{bench.get_discard_on_throttle()}
{}
nvbench::int64_t state::get_int64(const std::string &axis_name) const