hpx/threading_base/scheduler_tuning.hpp#
Defined in header hpx/threading_base/scheduler_tuning.hpp.
See Public API for a list of names and headers that are part of the public HPX API.
The settings a scheduler reads where it makes its decisions, and the interface of the tuners that may change them.
-
namespace hpx
-
namespace threads
-
namespace policies
Typedefs
-
using scheduler_tuner_factory = hpx::function<std::unique_ptr<scheduler_tuner>()>#
Creates a tuner.
Enums
-
enum class tuning_parameter_type : std::uint8_t#
What the value of a setting is. A scheduler reads each setting as its type (see scheduler_tuning_parameters::get), so that its decisions don’t convert values.
Values:
-
enumerator integer#
a switch, count or size, up to 2^32 - 1, kept as a std::uint32_t
-
enumerator real#
a value with a fraction (for instance a time in microseconds), kept as a float
-
enumerator integer#
Functions
-
void register_scheduler_tuner(std::string const &name, scheduler_tuner_factory factory)#
Make a tuner available under the given name, for use with the configuration entry hpx.scheduler_tuner. Register tuners before the runtime is started. A tuner registered under an existing name replaces the earlier one.
-
std::unique_ptr<scheduler_tuner> create_scheduler_tuner(std::string const &name)#
Create the tuner registered under the given name (“static” is always available). Throws hpx::exception (bad_parameter) for an unknown name.
Variables
- template<typename T> concept tuning_value_type =std::same_as<T, std::uint32_t> || std::same_as<T, float>
The types the value of a setting is read and changed as.
-
template<tuning_value_type T>
constexpr tuning_parameter_type tuning_parameter_type_of = std::same_as<T, float> ? tuning_parameter_type::real : tuning_parameter_type::integer# The type of the settings that keep values of the given type.
-
class tuning_value#
- #include <scheduler_tuning.hpp>
A value of a setting of either type, in the one word a setting keeps its value in (see scheduler_tuning_parameters).
-
struct tuning_parameter_info#
- #include <scheduler_tuning.hpp>
Describes a setting a scheduler reads where it makes a decision (for instance whether to wake up a sleeping worker) and that a tuner may change while the scheduler runs (see scheduler_tuning_parameters::add).
Public Functions
Public Members
-
char const *name#
The name of the configuration entry the setting is read from (for instance “hpx.min_idle_backoff_time”), which also identifies it for tuners.
-
tuning_value min_value#
The range a tuner may move the setting in, of the type of the setting.
-
tuning_value max_value#
-
bool per_worker#
Whether each worker has its own value (read where that worker makes a decision), or one value holds for the whole pool (read where no worker index is known, for instance when a thread is created from outside the pool).
-
tuning_parameter_type type#
What its value is.
-
char const *name#
-
class scheduler_tuning_parameters#
- #include <scheduler_tuning.hpp>
The current values of the tunable settings of a scheduler, one set per worker. A scheduler registers its settings while it is constructed (see add) and reads them where it makes its decisions (see get). A tuner (see scheduler_tuner) may change them (see set) at any time; the scheduler sees a change at its next decision.
Public Functions
-
scheduler_tuning_parameters(scheduler_tuning_parameters const&) = delete#
-
scheduler_tuning_parameters(scheduler_tuning_parameters&&) = delete#
-
scheduler_tuning_parameters &operator=(scheduler_tuning_parameters const&) = delete#
-
scheduler_tuning_parameters &operator=(scheduler_tuning_parameters&&) = delete#
-
template<tuning_value_type T>
inline std::size_t add(char const *name, T const min_value, T const max_value, bool const per_worker, T const value)# Register the setting with the given name (the name of its configuration entry), the range a tuner may move it in, and its initial value for all workers (usually the value of its configuration entry). The range and the value are of the type of the setting (see tuning_parameter_type_of). Returns the index the scheduler reads it with. Throws if more than max_parameters settings are registered or if a setting is registered twice.
-
inline tuning_parameter_info const &info(std::size_t id) const noexcept#
The description of the given setting.
-
std::size_t find(std::string_view name) const noexcept#
The index of the setting with the given name, or npos.
-
template<tuning_value_type T>
inline T get(std::size_t worker, std::size_t id) const noexcept# The current value of the given setting for the given worker, as the type of the setting. This is what a scheduler reads where it decides.
-
template<tuning_value_type T>
inline T get(std::size_t id) const noexcept# The current value of the given setting that holds for the whole pool (see tuning_parameter_info::per_worker), as the type of the setting.
-
template<tuning_value_type T>
inline void set(std::size_t worker, std::size_t id, T value) noexcept# Change the given setting for the given worker, with a value of the type of the setting. The value is clamped to the range of the setting. Settings that hold for the whole pool can only be changed with set_all.
Public Static Attributes
Private Types
-
using worker_values = std::array<std::atomic<tuning_value>, max_parameters>#
Private Functions
-
std::size_t add_setting(tuning_parameter_info const &info)#
Private Members
-
std::vector<tuning_parameter_info> infos_#
-
std::vector<util::aligned_line_data<worker_values>> values_#
-
scheduler_tuning_parameters(scheduler_tuning_parameters const&) = delete#
-
class scheduler_tuner#
- #include <scheduler_tuning.hpp>
A tuner decides the values of the tunable settings of a scheduler (see scheduler_tuning_parameters). It is selected per thread pool by name with the configuration entry hpx.scheduler_tuner (see register_scheduler_tuner). The default tuner, “static”, keeps the values the settings were configured with.
Public Functions
-
scheduler_tuner() = default#
-
scheduler_tuner(scheduler_tuner const&) = delete#
-
scheduler_tuner(scheduler_tuner&&) = delete#
-
scheduler_tuner &operator=(scheduler_tuner const&) = delete#
-
scheduler_tuner &operator=(scheduler_tuner&&) = delete#
-
virtual ~scheduler_tuner()#
-
virtual void attach(scheduler_tuning_parameters ¶meters) = 0#
Called once the scheduler has registered its settings, before its workers start.
-
scheduler_tuner() = default#
-
using scheduler_tuner_factory = hpx::function<std::unique_ptr<scheduler_tuner>()>#
-
namespace policies
-
namespace threads