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

Configurable debug scheduler that admits ordinary and CUDA tasks. More...

#include <debug_cuda_scheduler.hpp>

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

Public Member Functions

 DebugCudaScheduler (cuda::Device default_device, DebugSchedulerOptions options={})
 Construct with an explicit default CUDA activation device.
 
 DebugCudaScheduler (DebugSchedulerOptions options={})
 Construct with device zero as the default CUDA activation device.
 
void schedule (AsyncTask &&task) override
 Enqueue a task for later run.
 
void schedule (CudaTask &&task) override
 Enqueue a CUDA task without establishing device affinity.
 
void schedule (CudaTask &&task, int device) override
 Bind and enqueue a CUDA task for initial execution on a device.
 
- Public Member Functions inherited from uni20::async::DebugScheduler
bool can_run () const noexcept
 Reports whether at least one runnable task exists.
 
 DebugScheduler (DebugSchedulerOptions options={})
 Default-construct an empty scheduler.
 
bool done () const noexcept
 Check whether the runnable queue is empty.
 
void help_while_waiting (const WaitPredicate &is_ready) override
 Drives one runnable task while waiting for readiness.
 
DebugSchedulerOptions const & options () const noexcept
 Return the scheduler's immutable ordering configuration.
 
void pause () override
 Block the scheduler from running.
 
void resume () override
 Unblock the scheduler.
 
void run ()
 Run one batch of scheduled coroutines in the configured order.
 
void run_all ()
 Run until no runnable tasks remain.
 
void schedule (AsyncTask &&task) override
 Enqueue a task for later run.
 
 ~DebugScheduler ()
 Destructor.
 
- 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 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.
 
- 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::DebugScheduler
void enqueue_task (BasicTask &&task)
 Add one already-bound task to the runnable queue.
 

Detailed Description

Configurable debug scheduler that admits ordinary and CUDA tasks.

All tasks share one runnable queue and the ordering policy inherited from DebugScheduler. Each CUDA activation selects the device stored in its promise and restores the calling thread's previous device when it suspends or completes.

Constructor & Destructor Documentation

◆ DebugCudaScheduler() [1/2]

uni20::async::DebugCudaScheduler::DebugCudaScheduler ( DebugSchedulerOptions  options = {})
inlineexplicit

Construct with device zero as the default CUDA activation device.

◆ DebugCudaScheduler() [2/2]

uni20::async::DebugCudaScheduler::DebugCudaScheduler ( cuda::Device  default_device,
DebugSchedulerOptions  options = {} 
)
inlineexplicit

Construct with an explicit default CUDA activation device.

Parameters
default_deviceDevice used while a CUDA task has no affinity.
optionsDeterministic runnable ordering configuration.

Member Function Documentation

◆ schedule() [1/3]

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

Enqueue a task for later run.

Parameters
taskAn AsyncTask bound to this scheduler.

Implements uni20::async::IAsyncScheduler.

◆ schedule() [2/3]

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

Enqueue a CUDA task without establishing device affinity.

Parameters
taskCUDA task to admit through the default device context.

Implements uni20::async::ICudaScheduler.

◆ schedule() [3/3]

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

Bind and enqueue a CUDA task for initial execution on a device.

Parameters
taskCUDA task to admit.
deviceCUDA runtime device ordinal.

Implements uni20::async::ICudaScheduler.


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