Intel(R) Threading Building Blocks Doxygen Documentation
version 4.2.3
|
The class handles access to the single instance of market, and to TLS to keep scheduler instances. More...
#include <governor.h>
Static Public Member Functions | |
static unsigned | default_num_threads () |
static size_t | default_page_size () |
static void | one_time_init () |
static generic_scheduler * | init_scheduler (int num_threads, stack_size_type stack_size, bool auto_init) |
Processes scheduler initialization request (possibly nested) in a master thread. More... | |
static generic_scheduler * | init_scheduler_weak () |
Automatic initialization of scheduler in a master thread with default settings without arena. More... | |
static bool | terminate_scheduler (generic_scheduler *s, bool blocking) |
Processes scheduler termination request (possibly nested) in a master thread. More... | |
static void | sign_on (generic_scheduler *s) |
Register TBB scheduler instance in thread-local storage. More... | |
static void | sign_off (generic_scheduler *s) |
Unregister TBB scheduler instance from thread-local storage. More... | |
static bool | is_set (generic_scheduler *s) |
Used to check validity of the local scheduler TLS contents. More... | |
static void | assume_scheduler (generic_scheduler *s) |
Temporarily set TLS slot to the given scheduler. More... | |
static uintptr_t | tls_value_of (generic_scheduler *s) |
Computes the value of the TLS. More... | |
static generic_scheduler * | tls_scheduler_of (uintptr_t v) |
Converts TLS value to the scheduler pointer. More... | |
static generic_scheduler * | local_scheduler () |
Obtain the thread-local instance of the TBB scheduler. More... | |
static generic_scheduler * | local_scheduler_weak () |
static generic_scheduler * | local_scheduler_if_initialized () |
static void | terminate_auto_initialized_scheduler () |
Undo automatic initialization if necessary; call when a thread exits. More... | |
static void | print_version_info () |
static void | initialize_rml_factory () |
static bool | does_client_join_workers (const tbb::internal::rml::tbb_client &client) |
static bool | speculation_enabled () |
static bool | rethrow_exception_broken () |
Static Private Member Functions | |
static void | acquire_resources () |
Create key for thread-local storage and initialize RML. More... | |
static void | release_resources () |
Destroy the thread-local storage key and deinitialize RML. More... | |
static rml::tbb_server * | create_rml_server (rml::tbb_client &) |
static void | auto_terminate (void *scheduler) |
The internal routine to undo automatic initialization. More... | |
Static Private Attributes | |
static basic_tls< uintptr_t > | theTLS |
TLS for scheduler instances associated with individual threads. More... | |
static unsigned | DefaultNumberOfThreads |
Caches the maximal level of parallelism supported by the hardware. More... | |
static size_t | DefaultPageSize |
Caches the size of OS regular memory page. More... | |
static rml::tbb_factory | theRMLServerFactory |
static bool | UsePrivateRML |
static bool | is_speculation_enabled |
static bool | is_rethrow_broken |
Friends | |
class | __TBB_InitOnce |
class | market |
The class handles access to the single instance of market, and to TLS to keep scheduler instances.
It also supports automatic on-demand initialization of the TBB scheduler. The class contains only static data members and methods.
Definition at line 48 of file governor.h.
|
staticprivate |
Create key for thread-local storage and initialize RML.
Definition at line 67 of file governor.cpp.
References auto_terminate(), tbb::internal::cpu_has_speculation(), tbb::internal::basic_tls< T >::create(), tbb::internal::gcc_rethrow_exception_broken(), tbb::internal::handle_perror(), is_rethrow_broken, is_speculation_enabled, and theTLS.
Referenced by tbb::internal::__TBB_InitOnce::add_ref().
|
static |
Temporarily set TLS slot to the given scheduler.
Definition at line 116 of file governor.cpp.
References s, tbb::internal::basic_tls< T >::set(), theTLS, and tls_value_of().
Referenced by auto_terminate(), tbb::internal::market::cleanup(), init_scheduler(), tbb::internal::generic_scheduler::nested_arena_entry(), sign_off(), sign_on(), and tbb::internal::nested_arena_context::~nested_arena_context().
The internal routine to undo automatic initialization.
The signature is written with void* so that the routine can be the destructor argument to pthread_key_create.
Definition at line 215 of file governor.cpp.
References __TBB_ASSERT, assume_scheduler(), is_set(), s, and tls_scheduler_of().
Referenced by acquire_resources(), and terminate_auto_initialized_scheduler().
|
staticprivate |
Definition at line 92 of file governor.cpp.
References __TBB_ASSERT, tbb::internal::rml::make_private_server(), tbb::internal::runtime_warning(), theRMLServerFactory, and UsePrivateRML.
Referenced by tbb::internal::market::market().
|
inlinestatic |
Definition at line 84 of file governor.h.
References tbb::internal::AvailableHwConcurrency(), and DefaultNumberOfThreads.
Referenced by tbb::internal::calc_workers_soft_limit(), tbb::internal::rml::private_server::default_concurrency(), tbb::task_scheduler_init::default_num_threads(), tbb::internal::allowed_parallelism_control::default_value(), tbb::internal::DoOneTimeInitializations(), tbb::internal::market::global_market(), tbb::internal::tbb_thread_v3::hardware_concurrency(), and init_scheduler().
|
inlinestatic |
Definition at line 89 of file governor.h.
References DefaultPageSize, and tbb::internal::DefaultSystemPageSize().
Referenced by tbb::internal::create_coroutine(), tbb::internal::destroy_coroutine(), and tbb::internal::DoOneTimeInitializations().
|
static |
Definition at line 304 of file market.cpp.
Referenced by tbb::internal::rml::private_worker::start_shutdown(), and tbb::internal::rml::private_worker::wake_or_launch().
|
static |
Processes scheduler initialization request (possibly nested) in a master thread.
If necessary creates new instance of arena and/or local scheduler. The auto_init argument specifies if the call is due to automatic initialization.
Definition at line 172 of file governor.cpp.
References __TBB_ASSERT, assume_scheduler(), tbb::task_scheduler_init::automatic, tbb::internal::market::create_arena(), tbb::internal::generic_scheduler::create_master(), default_num_threads(), tbb::internal::basic_tls< T >::get(), is_set(), one_time_init(), s, theTLS, and tls_scheduler_of().
Referenced by tbb::task_scheduler_init::initialize(), and local_scheduler().
|
static |
Automatic initialization of scheduler in a master thread with default settings without arena.
Definition at line 164 of file governor.cpp.
References __TBB_ASSERT, tbb::internal::generic_scheduler::create_master(), is_set(), one_time_init(), and s.
Referenced by local_scheduler_weak().
|
static |
Definition at line 242 of file governor.cpp.
References theRMLServerFactory, and UsePrivateRML.
Referenced by tbb::internal::DoOneTimeInitializations().
|
static |
Used to check validity of the local scheduler TLS contents.
Definition at line 120 of file governor.cpp.
References tbb::internal::basic_tls< T >::get(), s, theTLS, and tls_value_of().
Referenced by auto_terminate(), tbb::internal::generic_scheduler::cleanup_master(), tbb::internal::generic_scheduler::generic_scheduler(), init_scheduler(), init_scheduler_weak(), tbb::internal::generic_scheduler::local_spawn(), tbb::internal::generic_scheduler::local_spawn_root_and_wait(), tbb::internal::custom_scheduler< SchedulerTraits >::local_wait_for_all(), tbb::internal::market::process(), tbb::internal::arena::process(), sign_off(), sign_on(), and terminate_scheduler().
|
inlinestatic |
Obtain the thread-local instance of the TBB scheduler.
If the scheduler has not been initialized yet, initialization is done automatically. Note that auto-initialized scheduler instance is destroyed only when its thread terminates.
Definition at line 129 of file governor.h.
References tbb::task_scheduler_init::automatic, tbb::internal::basic_tls< T >::get(), init_scheduler(), theTLS, and tls_scheduler_of().
Referenced by tbb::internal::arena::advertise_new_work(), tbb::internal::generic_scheduler::enqueue(), tbb::internal::get_initial_auto_partitioner_divisor(), tbb::internal::affinity_partitioner_base_v3::resize(), tbb::internal::generic_scheduler::spawn(), tbb::task::spawn_and_wait_for_all(), tbb::internal::generic_scheduler::spawn_root_and_wait(), and tbb::internal::custom_scheduler< SchedulerTraits >::wait_for_all().
|
inlinestatic |
Definition at line 139 of file governor.h.
References tbb::internal::basic_tls< T >::get(), theTLS, and tls_scheduler_of().
Referenced by tbb::internal::market::adjust_demand(), tbb::internal::market::cleanup(), tbb::internal::arena::enqueue_task(), and terminate_auto_initialized_scheduler().
|
inlinestatic |
Definition at line 134 of file governor.h.
References tbb::internal::basic_tls< T >::get(), init_scheduler_weak(), theTLS, and tls_scheduler_of().
Referenced by tbb::internal::allocate_additional_child_of_proxy::allocate(), tbb::internal::allocate_root_proxy::allocate(), tbb::internal::allocate_continuation_proxy::allocate(), tbb::internal::allocate_child_proxy::allocate(), tbb::interface5::internal::task_base::destroy(), tbb::internal::allocate_additional_child_of_proxy::free(), tbb::internal::allocate_root_proxy::free(), tbb::internal::allocate_continuation_proxy::free(), tbb::internal::allocate_child_proxy::free(), and tbb::task::self().
|
static |
Definition at line 156 of file governor.cpp.
References tbb::internal::atomic_do_once(), tbb::internal::DoOneTimeInitializations(), and tbb::internal::__TBB_InitOnce::initialization_done().
Referenced by init_scheduler(), and init_scheduler_weak().
|
static |
Definition at line 229 of file governor.cpp.
References tbb::internal::PrintExtraVersionInfo(), tbb::internal::PrintRMLVersionInfo(), theRMLServerFactory, and UsePrivateRML.
Referenced by tbb::internal::DoOneTimeInitializations().
|
staticprivate |
Destroy the thread-local storage key and deinitialize RML.
Definition at line 79 of file governor.cpp.
References tbb::internal::basic_tls< T >::destroy(), tbb::internal::destroy_process_mask(), dynamic_unlink_all(), tbb::internal::basic_tls< T >::get(), tbb::internal::__TBB_InitOnce::initialization_done(), tbb::internal::runtime_warning(), theRMLServerFactory, and theTLS.
Referenced by tbb::internal::__TBB_InitOnce::remove_ref().
|
inlinestatic |
|
static |
Unregister TBB scheduler instance from thread-local storage.
Definition at line 145 of file governor.cpp.
References __TBB_ASSERT, assume_scheduler(), __cilk_tbb_unwatch_thunk::data, is_set(), __cilk_tbb_unwatch_thunk::routine, s, and tbb::internal::suppress_unused_warning().
Referenced by tbb::internal::generic_scheduler::cleanup_scheduler().
|
static |
Register TBB scheduler instance in thread-local storage.
Definition at line 124 of file governor.cpp.
References __TBB_ASSERT, assume_scheduler(), __cilk_tbb_stack_op_thunk::data, is_set(), __cilk_tbb_stack_op_thunk::routine, and s.
Referenced by tbb::internal::generic_scheduler::create_master(), and tbb::internal::generic_scheduler::create_worker().
|
inlinestatic |
Definition at line 158 of file governor.h.
References is_speculation_enabled.
|
inlinestatic |
Undo automatic initialization if necessary; call when a thread exits.
Definition at line 144 of file governor.h.
References auto_terminate(), and local_scheduler_if_initialized().
Referenced by tbb::internal::__TBB_InitOnce::~__TBB_InitOnce().
|
static |
Processes scheduler termination request (possibly nested) in a master thread.
Definition at line 205 of file governor.cpp.
References __TBB_ASSERT, is_set(), and s.
Referenced by tbb::task_scheduler_init::internal_terminate().
|
inlinestatic |
Converts TLS value to the scheduler pointer.
Definition at line 122 of file governor.h.
Referenced by auto_terminate(), init_scheduler(), local_scheduler(), local_scheduler_if_initialized(), and local_scheduler_weak().
|
static |
Computes the value of the TLS.
Definition at line 110 of file governor.cpp.
References __TBB_ASSERT, and s.
Referenced by assume_scheduler(), and is_set().
|
friend |
Definition at line 50 of file governor.h.
|
friend |
Definition at line 51 of file governor.h.
|
staticprivate |
Caches the maximal level of parallelism supported by the hardware.
Definition at line 57 of file governor.h.
Referenced by default_num_threads().
|
staticprivate |
Caches the size of OS regular memory page.
Definition at line 60 of file governor.h.
Referenced by default_page_size().
|
staticprivate |
Definition at line 68 of file governor.h.
Referenced by acquire_resources(), and rethrow_exception_broken().
|
staticprivate |
Definition at line 67 of file governor.h.
Referenced by acquire_resources(), and speculation_enabled().
|
staticprivate |
Definition at line 62 of file governor.h.
Referenced by create_rml_server(), initialize_rml_factory(), print_version_info(), and release_resources().
|
staticprivate |
TLS for scheduler instances associated with individual threads.
Definition at line 54 of file governor.h.
Referenced by acquire_resources(), assume_scheduler(), init_scheduler(), is_set(), local_scheduler(), local_scheduler_if_initialized(), local_scheduler_weak(), and release_resources().
|
staticprivate |
Definition at line 64 of file governor.h.
Referenced by create_rml_server(), tbb::internal::market::global_market(), initialize_rml_factory(), and print_version_info().