Skip to main content

atomr_accel_cuda/stream/
single.rs

1//! `SingleStreamAllocator` (§5.7) — every `KernelActor` shares one
2//! stream. Useful for resource-constrained edge devices or
3//! deterministic-replay testing.
4
5use std::sync::Arc;
6
7use cudarc::driver::CudaStream;
8
9use super::{ActorHints, StreamAllocator};
10
11pub struct SingleStreamAllocator {
12    stream: Arc<CudaStream>,
13}
14
15impl SingleStreamAllocator {
16    pub fn new(stream: Arc<CudaStream>) -> Self {
17        Self { stream }
18    }
19}
20
21impl StreamAllocator for SingleStreamAllocator {
22    fn acquire(&self, _hints: ActorHints) -> Arc<CudaStream> {
23        self.stream.clone()
24    }
25}