Skip to main content

Module dispatcher

Module dispatcher 

Source
Expand description

GpuDispatcher (§5.1) — pinned single-thread runtime that ensures the actor’s CUDA context stays current on the same OS thread for the actor’s whole lifetime.

Tokio’s default work-stealing scheduler moves tasks between worker threads, which would break the “context is current on this thread” invariant. This dispatcher owns its own dedicated OS thread, builds a Tokio runtime on it (multi-threaded with worker_threads = 1 so background tasks make progress without anyone calling block_on), and forwards Dispatcher::spawn_task to that runtime via a [DefaultDispatcher] composed at construction time.

Library actors that share a context with their DeviceActor should use the same GpuDispatcher. F1 wires the dispatcher programmatically; atomr-config integration is deferred to F2.

Structs§

GpuDispatcher