Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
uni20::async::TbbNumaScheduler Class Referencefinal

NUMA-aware scheduler that balances work across per-node TBB arenas. More...

#include <tbb_numa_scheduler.hpp>

Inheritance diagram for uni20::async::TbbNumaScheduler:
[legend]
Collaboration diagram for uni20::async::TbbNumaScheduler:
[legend]

Public Member Functions

const std::vector< int > & numa_nodes () const noexcept
 Access the NUMA nodes managed by this scheduler.
 
void pause () override
 Pause all managed arenas.
 
void resume () override
 Resume all managed arenas.
 
void run_all ()
 Drain all arenas by waiting for completion of pending work.
 
void schedule (AsyncTask &&task) override
 Schedule a coroutine, choosing an arena based on NUMA preference.
 
void schedule (AsyncTask &&task, int numa_node)
 Schedule a coroutine on a specific NUMA node.
 
std::size_t scheduled_count_for (int numa_node) const noexcept
 Query how many tasks have been dispatched to a NUMA node.
 
 TbbNumaScheduler ()
 Construct a scheduler that reflects the system's visible NUMA nodes.
 
 TbbNumaScheduler (std::vector< int > nodes)
 Construct a scheduler with an explicit set of NUMA nodes.
 
- Public Member Functions inherited from uni20::async::IAsyncScheduler
template<class Function >
requires std::invocable<Function&, std::size_t>
void execute_batch (std::size_t size, Function &&function)
 Execute a synchronous batch of independent lightweight work items.
 
virtual void help_while_waiting (const WaitPredicate &is_ready)
 Allow a scheduler to advance queued work while a thread is blocking.
 
virtual void wait_for (const WaitPredicate &is_ready)
 Block the calling thread until is_ready returns true.
 
virtual void wait_for (WaitRequest const &request)
 Block until a structured wait request becomes ready.
 
 ~IAsyncScheduler () override=default
 Virtual destructor.
 
- Public Member Functions inherited from uni20::async::IScheduler
virtual ~IScheduler ()=default
 Virtual destructor.
 

Additional Inherited Members

- Public Types inherited from uni20::async::IAsyncScheduler
using WaitPredicate = std::function< bool()>
 
using WaitWakeup = std::function< void()>
 
using WaitWakeupRegistration = std::function< void(WaitWakeup)>
 

Detailed Description

NUMA-aware scheduler that balances work across per-node TBB arenas.

Constructor & Destructor Documentation

◆ TbbNumaScheduler() [1/2]

uni20::async::TbbNumaScheduler::TbbNumaScheduler ( )
inline

Construct a scheduler that reflects the system's visible NUMA nodes.

◆ TbbNumaScheduler() [2/2]

uni20::async::TbbNumaScheduler::TbbNumaScheduler ( std::vector< int >  nodes)
inlineexplicit

Construct a scheduler with an explicit set of NUMA nodes.

Parameters
nodesNUMA node identifiers to manage.

Member Function Documentation

◆ numa_nodes()

const std::vector< int > & uni20::async::TbbNumaScheduler::numa_nodes ( ) const
inlinenoexcept

Access the NUMA nodes managed by this scheduler.

Returns
Constant reference to the node identifier list.

◆ pause()

void uni20::async::TbbNumaScheduler::pause ( )
inlineoverridevirtual

Pause all managed arenas.

Implements uni20::async::IAsyncScheduler.

◆ resume()

void uni20::async::TbbNumaScheduler::resume ( )
inlineoverridevirtual

Resume all managed arenas.

Implements uni20::async::IAsyncScheduler.

◆ run_all()

void uni20::async::TbbNumaScheduler::run_all ( )
inline

Drain all arenas by waiting for completion of pending work.

◆ schedule() [1/2]

void uni20::async::TbbNumaScheduler::schedule ( AsyncTask &&  task)
inlineoverridevirtual

Schedule a coroutine, choosing an arena based on NUMA preference.

Implements uni20::async::IAsyncScheduler.

◆ schedule() [2/2]

void uni20::async::TbbNumaScheduler::schedule ( AsyncTask &&  task,
int  numa_node 
)
inline

Schedule a coroutine on a specific NUMA node.

Parameters
taskCoroutine to dispatch.
numa_nodeRequested NUMA node identifier.

◆ scheduled_count_for()

std::size_t uni20::async::TbbNumaScheduler::scheduled_count_for ( int  numa_node) const
inlinenoexcept

Query how many tasks have been dispatched to a NUMA node.

Parameters
numa_nodeNUMA node identifier to query.
Returns
Count of tasks scheduled for that node.

The documentation for this class was generated from the following file: