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

Unified oneTBB scheduler with one host arena and one arena per CUDA device. More...

#include <tbb_cuda_scheduler.hpp>

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

Public Member Functions

bool has_device (int device) const noexcept
 Report whether a CUDA device has an execution arena in this scheduler.
 
TbbCudaScheduler & operator= (TbbCudaScheduler const &)=delete
 
void schedule (AsyncTask &&t) override
 Schedule a coroutine for initial execution.
 
void schedule (CudaTask &&task) override
 Submit a CUDA task without establishing device affinity.
 
void schedule (CudaTask &&task, int device) override
 Bind and submit a CUDA task to an enrolled device arena.
 
 TbbCudaScheduler (std::vector< cuda::Device > devices, TbbCudaSchedulerOptions options={})
 Construct a scheduler for an explicit set of CUDA devices.
 
 TbbCudaScheduler (TbbCudaScheduler const &)=delete
 
 TbbCudaScheduler (TbbCudaSchedulerOptions options={})
 Construct a scheduler enrolling every visible CUDA device.
 
 ~TbbCudaScheduler () noexcept override
 
- Public Member Functions inherited from uni20::async::TbbScheduler
void help_while_waiting (const WaitPredicate &is_ready) override
 Allow a scheduler to advance queued work while a thread is blocking.
 
void pause () override
 Pause the scheduler. Don't execute scheduled tasks, but instead add them to a queue.
 
void resume () override
 Unpause the scheduler, and execute any tasks that have been queued.
 
void run_all ()
 Block until all tasks scheduled on this scheduler are complete.
 
void schedule (AsyncTask &&t) override
 Schedule a coroutine for initial execution.
 
 TbbScheduler (int max_concurrency=oneapi::tbb::task_arena::automatic, TbbSchedulerBatchOptions batch_options={})
 Construct a TBB scheduler with a given arena concurrency.
 
 TbbScheduler (oneapi::tbb::task_arena::constraints constraints, TbbSchedulerBatchOptions batch_options={})
 Construct a TBB scheduler constrained to a specific NUMA node.
 
void wait_for (const WaitPredicate &is_ready) override
 Accept an already-satisfied predicate; pending TBB waits require a WaitRequest notification.
 
void wait_for (WaitRequest const &request) override
 Wait for targeted readiness while allowing the arena to execute other work.
 
 ~TbbScheduler () noexcept override
 
- 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.
 
 ~IAsyncScheduler () override=default
 Virtual destructor.
 
- Public Member Functions inherited from uni20::async::IScheduler
virtual ~IScheduler ()=default
 Virtual destructor.
 
- Public Member Functions inherited from uni20::async::ICudaScheduler
 ~ICudaScheduler () override=default
 

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)>
 
- Protected Member Functions inherited from uni20::async::TbbScheduler
template<typename Prepare >
void dispatch_handle_in_arena (oneapi::tbb::task_arena &arena, TaskHandle handle, detail::TbbTaskAdmissionContext context, Prepare &&prepare)
 Submit one activation to an arena through the shared task group.
 
void enqueue_task (BasicTask &&t)
 Enqueue one task through the scheduler's domain-routing hook.
 
void wait_for_submitted_tasks ()
 Wait for every activation registered with the shared task group.
 

Detailed Description

Unified oneTBB scheduler with one host arena and one arena per CUDA device.

Ordinary and CUDA tasks share scheduler ownership, task-group accounting, pause state, waits, and rescheduling. CUDA activations are routed by the promise's optional affinity or the scheduler's default CUDA device.

Constructor & Destructor Documentation

◆ TbbCudaScheduler() [1/3]

uni20::async::TbbCudaScheduler::TbbCudaScheduler ( TbbCudaSchedulerOptions  options = {})
inlineexplicit

Construct a scheduler enrolling every visible CUDA device.

Parameters
optionsHost and per-device arena configuration.

◆ TbbCudaScheduler() [2/3]

uni20::async::TbbCudaScheduler::TbbCudaScheduler ( std::vector< cuda::Device >  devices,
TbbCudaSchedulerOptions  options = {} 
)
inlineexplicit

Construct a scheduler for an explicit set of CUDA devices.

Parameters
devicesValidated devices to enroll.
optionsHost and per-device arena configuration.

◆ TbbCudaScheduler() [3/3]

uni20::async::TbbCudaScheduler::TbbCudaScheduler ( TbbCudaScheduler const &  )
delete

◆ ~TbbCudaScheduler()

uni20::async::TbbCudaScheduler::~TbbCudaScheduler ( )
inlineoverridenoexcept

Member Function Documentation

◆ has_device()

bool uni20::async::TbbCudaScheduler::has_device ( int  device) const
inlinenoexcept

Report whether a CUDA device has an execution arena in this scheduler.

◆ operator=()

TbbCudaScheduler & uni20::async::TbbCudaScheduler::operator= ( TbbCudaScheduler const &  )
delete

◆ schedule() [1/3]

void uni20::async::TbbScheduler::schedule ( AsyncTask &&  t)
inlineoverridevirtual

Schedule a coroutine for initial execution.

Implements uni20::async::IAsyncScheduler.

◆ schedule() [2/3]

void uni20::async::TbbCudaScheduler::schedule ( CudaTask &&  task)
inlineoverridevirtual

Submit a CUDA task without establishing device affinity.

Parameters
taskCUDA task to admit through the default device arena.

Implements uni20::async::ICudaScheduler.

◆ schedule() [3/3]

void uni20::async::TbbCudaScheduler::schedule ( CudaTask &&  task,
int  device 
)
inlineoverridevirtual

Bind and submit a CUDA task to an enrolled device arena.

Parameters
taskCUDA task to admit.
deviceCUDA runtime device ordinal selected for the task.

Implements uni20::async::ICudaScheduler.


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