43 if (task.set_scheduler(
this)) this->
enqueue_task(std::move(task));
54 if (task.set_scheduler(
this)) this->
enqueue_task(std::move(task));
58 bool accepts_route(
TaskRoute route)
const noexcept override
62 int const device = route.cuda_device.value_or(default_device_);
63 return device >= 0 && device < device_count_;
66 bool can_direct_transfer(TaskHandle from, TaskHandle to)
const noexcept override
69 return this->activation_device(from) == this->activation_device(to);
72 void resume_task(BasicTask& task)
override
80 int const device = this->activation_device(task.handle());
81 cuda::ScopedDevice device_scope(device);
88 [[nodiscard]]
int activation_device(TaskHandle task)
const noexcept
static void record_task_scheduled(std::coroutine_handle<> h)
Records the call stack where a coroutine was submitted to a scheduler.
std::optional< int > device() const noexcept
Return the task's established CUDA device affinity, if any.
Definition async_task_promise.hpp:659
void bind_device(int device)
Bind the CUDA device before the coroutine starts.
Definition async_task_promise.hpp:673
CUDA-constrained public task type used for typed initial admission.
Definition cuda_task.hpp:14
Configurable debug scheduler that admits ordinary and CUDA tasks.
Definition debug_cuda_scheduler.hpp:22
void schedule(CudaTask &&task) override
Enqueue a CUDA task without establishing device affinity.
Definition debug_cuda_scheduler.hpp:40
void schedule(CudaTask &&task, int device) override
Bind and enqueue a CUDA task for initial execution on a device.
Definition debug_cuda_scheduler.hpp:49
DebugCudaScheduler(cuda::Device default_device, DebugSchedulerOptions options={})
Construct with an explicit default CUDA activation device.
Definition debug_cuda_scheduler.hpp:32
DebugCudaScheduler(DebugSchedulerOptions options={})
Construct with device zero as the default CUDA activation device.
Definition debug_cuda_scheduler.hpp:25
Single-threaded scheduler with configurable runnable-batch ordering.
Definition debug_scheduler.hpp:63
void enqueue_task(BasicTask &&task)
Add one already-bound task to the runnable queue.
Definition debug_scheduler.hpp:192
DebugSchedulerOptions const & options() const noexcept
Return the scheduler's immutable ordering configuration.
Definition debug_scheduler.hpp:136
void schedule(AsyncTask &&task) override
Enqueue a task for later run.
Definition debug_scheduler.hpp:71
virtual void resume_task(BasicTask &task)
Resume one queued task in the execution context selected by this scheduler.
Definition debug_scheduler.hpp:195
Scheduler interface for initial CudaTask admission.
Definition cuda_task.hpp:49
Validated CUDA device identity with cached immutable capabilities.
Definition device.hpp:105
static Device get(int ordinal)
Validate and return one CUDA device.
Definition device.cpp:103
static Device current()
Return the CUDA device currently selected on the calling thread.
Definition device.cpp:123
Defines the CUDA task admission type and scheduler interface.
Coroutine scheduler for AsyncTask.
CUDA device discovery and immutable hardware capability snapshots.
This represents the reverse-mode adjoint for functions of complex variables, assuming a real-valued s...
Definition async/async.hpp:26
CudaTaskPromise & cuda_promise(TaskHandle handle) noexcept
Narrow an erased task promise after verifying that it is CUDA-specific.
Definition async_task_promise.hpp:707
CUDA device, stream, resource, and scoped runtime primitives.
Configuration for deterministic debug scheduling.
Definition debug_scheduler.hpp:55
Execution requirements used to validate a scheduler route.
Definition async_task.hpp:43
#define DEBUG_CHECK_EQUAL(a, b,...)
Definition trace.hpp:618