class local_priority_queue_scheduler
Declaration
template <
typename Mutex = std::mutex,
typename PendingQueuing = pika::threads::policies::lockfree_fifo,
typename StagedQueuing = pika::threads::policies::lockfree_fifo,
typename TerminatedQueuing = pika::threads::policies::
default_local_priority_queue_scheduler_terminated_queue>
class local_priority_queue_scheduler : public scheduler_base { /* full declaration omitted */ };Description
//////////////////////////////////////////////////////////////////////// The local_priority_queue_scheduler maintains exactly one queue of work items (threads) per OS thread, where this OS thread pulls its next work from. Additionally it maintains separate queues: several for high priority threads and one for low priority threads. High priority threads are executed by the first N OS threads before any other work is executed. Low priority threads are executed by the last OS thread whenever no other work is available.
Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:65
Inherits from: scheduler_base
Member Variables
- protected std::atomic<std::size_t> curr_queue_
- protected const pika::detail::affinity_data& affinity_data_
- protected const std::size_t num_queues_
- protected const std::size_t num_high_priority_queues_
- protected pika::threads::policies:: local_priority_queue_scheduler:: thread_queue_type low_priority_queue_
- protected std::vector< pika::concurrency::detail::cache_line_data< thread_queue_type*>> queues_
- protected std::vector< pika::concurrency::detail::cache_line_data< thread_queue_type*>> high_priority_queues_
- protected std::vector< pika::concurrency::detail::cache_line_data< std::vector<std::size_t>>> victim_threads_
Inherited from scheduler_base:
- protected mode_
- protected mtx_
- protected cond_
- protected wait_counts_
- protected suspend_mtxs_
- protected suspend_conds_
- protected pu_mtxs_
- protected states_
- protected description_
- protected thread_queue_init_
- protected parent_pool_
- protected background_thread_count_
- protected polling_function_mpi_
- protected polling_function_cuda_
- protected polling_work_count_function_mpi_
- protected polling_work_count_function_cuda_
Method Overview
- public void abort_all_suspended_threads()
- public bool cleanup_terminated(bool delete_all)
- public bool cleanup_terminated(std::size_t num_thread, bool delete_all)
- public void create_thread(pika::threads::thread_init_data & data, pika::threads::thread_id_ref_type * id, pika::error_code & ec)
- public void destroy_thread(threads::thread_data * thrd)
- public bool enumerate_threads(const util::function<bool (thread_id_type)> & f, pika::threads::thread_schedule_state state = thread_schedule_state::unknown) const
- public bool get_next_thread(std::size_t num_thread, bool running, threads::thread_id_ref_type & thrd, bool enable_stealing)
- public std::int64_t get_queue_length(std::size_t num_thread = unsigned long(-1)) const
- public static std::string get_scheduler_name()
- public std::int64_t get_thread_count(pika::threads::thread_schedule_state state = thread_schedule_state::unknown, pika::threads::thread_priority priority = thread_priority::default_, std::size_t num_thread = unsigned long(-1), bool = false) const
- public bool is_core_idle(std::size_t num_thread) const
- public local_priority_queue_scheduler<Mutex, PendingQueuing, StagedQueuing, TerminatedQueuing>(const pika::threads::policies::local_priority_queue_scheduler::init_parameter_type & init, bool deferred_initialization = true)
- public void on_error(std::size_t num_thread, const std::exception_ptr & e)
- public void on_start_thread(std::size_t num_thread)
- public void on_stop_thread(std::size_t num_thread)
- public void reset_thread_distribution()
- public void schedule_thread(threads::thread_id_ref_type thrd, threads::thread_schedule_hint schedulehint, bool allow_fallback = false, pika::threads::thread_priority priority = thread_priority::normal)
- public void schedule_thread_last(threads::thread_id_ref_type thrd, threads::thread_schedule_hint schedulehint, bool allow_fallback = false, pika::threads::thread_priority priority = thread_priority::normal)
- public bool wait_or_add_new(std::size_t num_thread, bool running, std::int64_t & idle_loop_count, bool enable_stealing, std::size_t & added)
- public ~local_priority_queue_scheduler<Mutex, PendingQueuing, StagedQueuing, TerminatedQueuing>()
Inherited from scheduler_base:
- public abort_all_suspended_threads
- public add_remove_scheduler_mode
- public add_scheduler_mode
- public cleanup_terminated
- public cleanup_terminated
- public clear_cuda_polling_function
- public clear_mpi_polling_function
- public create_thread
- public custom_polling_function
- public decrement_background_thread_count
- public destroy_thread
- public do_some_work
- public domain_from_local_thread_index
- public domain_threads
- public enumerate_threads
- public get_background_thread_count
- public get_description
- public get_minmax_state
- public get_next_thread
- public get_parent_pool
- public get_polling_work_count
- public get_pu_mutex
- public get_queue_length
- public get_scheduler_mode
- public get_stack_size
- public get_state
- public get_state
- public get_thread_count
- public global_to_local_thread_index
- public has_reached_state
- public has_scheduler_mode
- public idle_callback
- public increment_background_thread_count
- public is_core_idle
- public is_state
- public local_to_global_thread_index
- public null_polling_function
- public null_polling_work_count_function
- public num_domains
- public on_error
- public on_start_thread
- public on_stop_thread
- public remove_scheduler_mode
- public reset_thread_distribution
- public resume
- public schedule_thread
- public schedule_thread_last
- public select_active_pu
- public set_all_states
- public set_all_states_at_least
- public set_cuda_polling_functions
- public set_mpi_polling_functions
- public set_parent_pool
- public set_scheduler_mode
- public suspend
- public update_scheduler_mode
- public wait_or_add_new
Methods
void abort_all_suspended_threads()
void abort_all_suspended_threads()Description
////////////////////////////////////////////////////////////////////
Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:451
bool cleanup_terminated(bool delete_all)
bool cleanup_terminated(bool delete_all)Description
////////////////////////////////////////////////////////////////////
Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:464
Parameters
- bool delete_all
bool cleanup_terminated(std::size_t num_thread,
bool delete_all)
bool cleanup_terminated(std::size_t num_thread,
bool delete_all)Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:487
Parameters
- std::size_t num_thread
- bool delete_all
void create_thread(
pika::threads::thread_init_data& data,
pika::threads::thread_id_ref_type* id,
pika::error_code& ec)
void create_thread(
pika::threads::thread_init_data& data,
pika::threads::thread_id_ref_type* id,
pika::error_code& ec)Description
////////////////////////////////////////////////////////////////////
Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:508
Parameters
void destroy_thread(threads::thread_data* thrd)
void destroy_thread(threads::thread_data* thrd)Description
Destroy the passed thread as it has been terminated
Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:793
Parameters
- threads::thread_data* thrd
bool enumerate_threads(
const util::function<bool(thread_id_type)>& f,
pika::threads::thread_schedule_state state =
thread_schedule_state::unknown) const
bool enumerate_threads(
const util::function<bool(thread_id_type)>& f,
pika::threads::thread_schedule_state state =
thread_schedule_state::unknown) constDescription
////////////////////////////////////////////////////////////////////
Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:974
Parameters
- const util::function<bool(thread_id_type)>& f
- pika::threads::thread_schedule_state state = thread_schedule_state::unknown
bool get_next_thread(
std::size_t num_thread,
bool running,
threads::thread_id_ref_type& thrd,
bool enable_stealing)
bool get_next_thread(
std::size_t num_thread,
bool running,
threads::thread_id_ref_type& thrd,
bool enable_stealing)Description
Return the next thread to be executed, return false if none is available
Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:596
Parameters
- std::size_t num_thread
- bool running
- threads::thread_id_ref_type& thrd
- bool enable_stealing
std::int64_t get_queue_length(
std::size_t num_thread =
unsigned long(-1)) const
std::int64_t get_queue_length(
std::size_t num_thread =
unsigned long(-1)) constDescription
////////////////////////////////////////////////////////////////////
Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:801
Parameters
- std::size_t num_thread = unsigned long(-1)
static std::string get_scheduler_name()
static std::string get_scheduler_name()Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:164
std::int64_t get_thread_count(
pika::threads::thread_schedule_state state =
thread_schedule_state::unknown,
pika::threads::thread_priority priority =
thread_priority::default_,
std::size_t num_thread = unsigned long(-1),
bool = false) const
std::int64_t get_thread_count(
pika::threads::thread_schedule_state state =
thread_schedule_state::unknown,
pika::threads::thread_priority priority =
thread_priority::default_,
std::size_t num_thread = unsigned long(-1),
bool = false) constDescription
////////////////////////////////////////////////////////////////////
Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:836
Parameters
- pika::threads::thread_schedule_state state = thread_schedule_state::unknown
- pika::threads::thread_priority priority = thread_priority::default_
- std::size_t num_thread = unsigned long(-1)
- bool = false
bool is_core_idle(std::size_t num_thread) const
bool is_core_idle(std::size_t num_thread) constDeclared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:956
Parameters
- std::size_t num_thread
local_priority_queue_scheduler<Mutex,
PendingQueuing,
StagedQueuing,
TerminatedQueuing>(
const pika::threads::policies::
local_priority_queue_scheduler::
init_parameter_type& init,
bool deferred_initialization = true)
local_priority_queue_scheduler<Mutex,
PendingQueuing,
StagedQueuing,
TerminatedQueuing>(
const pika::threads::policies::
local_priority_queue_scheduler::
init_parameter_type& init,
bool deferred_initialization = true)Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:114
Parameters
- const pika::threads::policies:: local_priority_queue_scheduler:: init_parameter_type& init
- bool deferred_initialization = true
void on_error(std::size_t num_thread,
const std::exception_ptr& e)
void on_error(std::size_t num_thread,
const std::exception_ptr& e)Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:1360
Parameters
- std::size_t num_thread
- const std::exception_ptr& e
void on_start_thread(std::size_t num_thread)
void on_start_thread(std::size_t num_thread)Description
////////////////////////////////////////////////////////////////////
Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:1217
Parameters
- std::size_t num_thread
void on_stop_thread(std::size_t num_thread)
void on_stop_thread(std::size_t num_thread)Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:1347
Parameters
- std::size_t num_thread
void reset_thread_distribution()
void reset_thread_distribution()Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:1374
void schedule_thread(
threads::thread_id_ref_type thrd,
threads::thread_schedule_hint schedulehint,
bool allow_fallback = false,
pika::threads::thread_priority priority =
thread_priority::normal)
void schedule_thread(
threads::thread_id_ref_type thrd,
threads::thread_schedule_hint schedulehint,
bool allow_fallback = false,
pika::threads::thread_priority priority =
thread_priority::normal)Description
Schedule the passed thread
Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:671
Parameters
- threads::thread_id_ref_type thrd
- threads::thread_schedule_hint schedulehint
- bool allow_fallback = false
- pika::threads::thread_priority priority = thread_priority::normal
void schedule_thread_last(
threads::thread_id_ref_type thrd,
threads::thread_schedule_hint schedulehint,
bool allow_fallback = false,
pika::threads::thread_priority priority =
thread_priority::normal)
void schedule_thread_last(
threads::thread_id_ref_type thrd,
threads::thread_schedule_hint schedulehint,
bool allow_fallback = false,
pika::threads::thread_priority priority =
thread_priority::normal)Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:746
Parameters
- threads::thread_id_ref_type thrd
- threads::thread_schedule_hint schedulehint
- bool allow_fallback = false
- pika::threads::thread_priority priority = thread_priority::normal
bool wait_or_add_new(
std::size_t num_thread,
bool running,
std::int64_t& idle_loop_count,
bool enable_stealing,
std::size_t& added)
bool wait_or_add_new(
std::size_t num_thread,
bool running,
std::int64_t& idle_loop_count,
bool enable_stealing,
std::size_t& added)Description
This is a function which gets called periodically by the thread manager to allow for maintenance tasks to be executed in the scheduler. Returns true if the OS thread calling this function has to be terminated (i.e. no more work has to be done).
Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:1101
Parameters
- std::size_t num_thread
- bool running
- std::int64_t& idle_loop_count
- bool enable_stealing
- std::size_t& added
~local_priority_queue_scheduler<
Mutex,
PendingQueuing,
StagedQueuing,
TerminatedQueuing>()
~local_priority_queue_scheduler<
Mutex,
PendingQueuing,
StagedQueuing,
TerminatedQueuing>()Declared at: libs/pika/schedulers/include/pika/schedulers/local_priority_queue_scheduler.hpp:151