![]() |
Stan Math Library
5.3.0
Automatic Differentiation
|
TBB observer object which is a callback hook called whenever the TBB scheduler adds a new thread to the TBB managed threadpool.
This hook ensures that each worker thread has an initialized AD tape ready for use.
On Apple Silicon, this also sets the thread QoS class to USER_INITIATED so that macOS prefers scheduling compute threads on performance cores rather than efficiency cores.
Refer to https://software.intel.com/content/www/us/en/develop/documentation/tbb-documentation/top/intel-threading-building-blocks-developer-reference/task-scheduler/taskschedulerobserver.html for details on the observer concept.
Definition at line 36 of file init_chainablestack.hpp.
#include <init_chainablestack.hpp>
Inheritance diagram for stan::math::ad_tape_observer:Public Member Functions | |
| ad_tape_observer () | |
| ~ad_tape_observer () | |
| void | on_scheduler_entry (bool worker) |
| void | on_scheduler_exit (bool worker) |
Private Types | |
| using | stack_ptr = std::unique_ptr< ChainableStack > |
| using | ad_map = std::unordered_map< std::thread::id, stack_ptr > |
Private Attributes | |
| ad_map | thread_tape_map_ |
| std::mutex | thread_tape_map_mutex_ |