pub struct Stream { /* private fields */ }Expand description
An asynchronous work queue on the current CUDA device.
Implementations§
Source§impl Stream
impl Stream
Sourcepub fn begin_capture(&self, mode: CaptureMode) -> Result<()>
pub fn begin_capture(&self, mode: CaptureMode) -> Result<()>
Begin recording operations submitted to this stream into a graph.
Sourcepub fn end_capture(&self) -> Result<Graph>
pub fn end_capture(&self) -> Result<Graph>
Stop capture and return the graph of everything recorded.
Sourcepub fn capture<F>(&self, mode: CaptureMode, f: F) -> Result<Graph>
pub fn capture<F>(&self, mode: CaptureMode, f: F) -> Result<Graph>
Convenience wrapper: run f, capturing its submissions to this
stream, and return the resulting graph.
Sourcepub fn is_capturing(&self) -> Result<bool>
pub fn is_capturing(&self) -> Result<bool>
true if this stream is currently recording into a graph.
Source§impl Stream
impl Stream
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a stream with default (legacy-default-stream-synchronizing) flags on the current device.
Sourcepub fn non_blocking() -> Result<Self>
pub fn non_blocking() -> Result<Self>
Create a non-blocking stream — does not synchronize with the legacy default stream.
Sourcepub unsafe fn from_raw(handle: cudaStream_t) -> Self
pub unsafe fn from_raw(handle: cudaStream_t) -> Self
Adopt a raw cudaStream_t handle. The wrapper will call
cudaStreamDestroy on drop.
§Safety
handle must be a live stream on the current device. Do not
destroy it externally.
Sourcepub fn with_flags(flags: u32) -> Result<Self>
pub fn with_flags(flags: u32) -> Result<Self>
Create a stream with raw flags (see cudaStreamFlags).
Sourcepub fn synchronize(&self) -> Result<()>
pub fn synchronize(&self) -> Result<()>
Block the calling thread until all prior work on this stream is complete.
Sourcepub fn is_complete(&self) -> Result<bool>
pub fn is_complete(&self) -> Result<bool>
Ok(true) if all queued work has finished, Ok(false) if work remains.
Sourcepub fn as_raw(&self) -> cudaStream_t
pub fn as_raw(&self) -> cudaStream_t
Raw cudaStream_t handle. Use with care.
Sourcepub fn with_priority(flags: u32, priority: i32) -> Result<Self>
pub fn with_priority(flags: u32, priority: i32) -> Result<Self>
Create a stream with a specific scheduling priority (lower = higher
priority). Use stream_priority_range to discover the legal
range on the current device.
Source§impl Stream
impl Stream
Sourcepub fn launch_host_func<F>(&self, f: F) -> Result<()>
pub fn launch_host_func<F>(&self, f: F) -> Result<()>
Enqueue a host-side callback on this stream. Runs on a driver-owned thread after prior stream work completes.
The closure is boxed and freed after it runs; a panic inside aborts the process.
Sourcepub unsafe fn write_value_32(
&self,
addr: *mut c_void,
value: u32,
flags: u32,
) -> Result<()>
pub unsafe fn write_value_32( &self, addr: *mut c_void, value: u32, flags: u32, ) -> Result<()>
Enqueue a 32-bit write of value to device memory addr.
§Safety
addr must be a live device-addressable pointer.
Sourcepub unsafe fn write_value_64(
&self,
addr: *mut c_void,
value: u64,
flags: u32,
) -> Result<()>
pub unsafe fn write_value_64( &self, addr: *mut c_void, value: u64, flags: u32, ) -> Result<()>
§Safety
Same as [write_value_32].
Sourcepub unsafe fn wait_value_32(
&self,
addr: *mut c_void,
value: u32,
flags: u32,
) -> Result<()>
pub unsafe fn wait_value_32( &self, addr: *mut c_void, value: u32, flags: u32, ) -> Result<()>
Block the stream until the 32-bit device memory at addr satisfies
the condition selected by flags (GEQ / EQ / AND / NOR, optionally
OR’d with FLUSH).
§Safety
addr must be a live device-addressable pointer.
Sourcepub unsafe fn wait_value_64(
&self,
addr: *mut c_void,
value: u64,
flags: u32,
) -> Result<()>
pub unsafe fn wait_value_64( &self, addr: *mut c_void, value: u64, flags: u32, ) -> Result<()>
§Safety
Same as [wait_value_32].
Sourcepub unsafe fn attach_mem_async(
&self,
dev_ptr: *mut c_void,
length: usize,
flags: u32,
) -> Result<()>
pub unsafe fn attach_mem_async( &self, dev_ptr: *mut c_void, length: usize, flags: u32, ) -> Result<()>
Associate a managed-memory region with this stream
(cudaStreamAttachMemAsync). Pass flags = 0 for the default.
§Safety
dev_ptr must be a managed-memory allocation.
Sourcepub fn copy_attributes_from(&self, src: &Stream) -> Result<()>
pub fn copy_attributes_from(&self, src: &Stream) -> Result<()>
Copy CUDA-managed attributes (access-policy window, sync policy)
from src onto self.
Sourcepub unsafe fn batch_mem_op(
&self,
params: &mut [CUstreamBatchMemOpParams],
flags: u32,
) -> Result<()>
pub unsafe fn batch_mem_op( &self, params: &mut [CUstreamBatchMemOpParams], flags: u32, ) -> Result<()>
Enqueue a batch of stream mem-ops (WAIT_VALUE_32/64,
WRITE_VALUE_32/64) atomically. Much cheaper than issuing the
ops one at a time.
Build entries with baracuda_cuda_sys::types::CUstreamBatchMemOpParams::write_value_32
etc. Pass flags = 0 for the default.
§Safety
Every entry’s address must be a live device-addressable pointer.