Skip to main content

StreamPool

Struct StreamPool 

Source
pub struct StreamPool { /* private fields */ }
Expand description

Pool of owned non-blocking CUDA streams.

Implementations§

Source§

impl StreamPool

Source

pub fn new(device: Arc<CudaDevice>, max_streams: usize) -> Self

Construct a pool bound to device, capped at max_streams.

Source

pub fn with_defaults(device: Arc<CudaDevice>) -> Self

Construct with the default cap DEFAULT_MAX_STREAMS.

Source

pub fn acquire(&self) -> Result<StreamId, StreamPoolError>

Acquire a non-default stream id, growing the pool up to max_streams. Each successful call returns a distinct StreamId backed by an owned non-blocking cudarc::driver::CudaStream forked from the device’s default stream.

§Errors

Streams are never returned to a free-list; they remain valid for the runtime’s lifetime so previously returned StreamId handles keep resolving.

Source

pub fn resolve(&self, id: StreamId) -> Option<Arc<CudaStream>>

Borrow the live CudaStream for id. Returns None if id has never been issued by this pool. The default-stream slot resolves to the device’s default stream.

Source

pub fn non_default_len(&self) -> usize

Number of non-default streams currently in the pool.

Source

pub fn device(&self) -> &Arc<CudaDevice>

Borrow the device handle. Test helpers use this to launch kernels into the same device the pool was constructed on.

Source

pub fn max_streams(&self) -> usize

Maximum streams the pool will create on demand.

Source

pub fn pool_bytes_per_stream(&self) -> u64

Planned per-stream pool budget, in bytes, from XLOG_WCOJ_POOL_MB_PER_STREAM or the 256 MiB default.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,