pub struct SparseHandle { /* private fields */ }Expand description
Central handle for sparse matrix operations.
Every sparse routine requires a SparseHandle. The handle binds operations
to a specific CUDA context and stream, maintains a BLAS sub-handle for
dense operations (e.g. SpMM output accumulation), caches compiled PTX
kernels, and stores the device’s SM version for kernel dispatch.
§Thread safety
SparseHandle is Send but not Sync. Each thread should create its
own handle (possibly sharing the same Arc<Context>).
Implementations§
Source§impl SparseHandle
impl SparseHandle
Sourcepub fn new(ctx: &Arc<Context>) -> SparseResult<Self>
pub fn new(ctx: &Arc<Context>) -> SparseResult<Self>
Creates a new sparse handle with a freshly-allocated default stream.
The device’s compute capability is queried once and cached.
§Errors
Returns SparseError::Cuda if stream creation or device query fails.
Sourcepub fn with_stream(ctx: &Arc<Context>, stream: Stream) -> SparseResult<Self>
pub fn with_stream(ctx: &Arc<Context>, stream: Stream) -> SparseResult<Self>
Sourcepub fn blas_handle(&self) -> &BlasHandle
pub fn blas_handle(&self) -> &BlasHandle
Returns a reference to the internal BLAS handle.
Sourcepub fn blas_handle_mut(&mut self) -> &mut BlasHandle
pub fn blas_handle_mut(&mut self) -> &mut BlasHandle
Returns a mutable reference to the internal BLAS handle.
Sourcepub fn sm_version(&self) -> SmVersion
pub fn sm_version(&self) -> SmVersion
Returns the SM version of the bound device.
Sourcepub fn set_stream(&mut self, stream: Stream)
pub fn set_stream(&mut self, stream: Stream)
Replaces the stream used for subsequent sparse operations.