pub struct SolverHandle { /* private fields */ }Expand description
Central handle for solver operations.
Every solver routine requires a SolverHandle. The handle binds operations
to a specific CUDA context and stream, provides access to the underlying
BLAS handle for delegating matrix operations, and manages a resizable
device workspace buffer.
§Thread safety
SolverHandle is Send but not Sync. Each thread should create its
own handle (possibly sharing the same Arc<Context>).
Implementations§
Source§impl SolverHandle
impl SolverHandle
Sourcepub fn new(ctx: &Arc<Context>) -> SolverResult<Self>
pub fn new(ctx: &Arc<Context>) -> SolverResult<Self>
Creates a new solver handle with a freshly-allocated default stream.
The device’s compute capability is queried once and cached as an
SmVersion for later kernel dispatch decisions. An initial workspace
of 4 KiB is allocated.
§Errors
Returns SolverError::Cuda if stream creation or device query fails.
Returns SolverError::Blas if BLAS handle creation fails.
Sourcepub fn ensure_workspace(&mut self, bytes: usize) -> SolverResult<()>
pub fn ensure_workspace(&mut self, bytes: usize) -> SolverResult<()>
Ensures the workspace buffer has at least bytes capacity.
If the current workspace is smaller, it is reallocated. The contents of the previous workspace are not preserved.
§Errors
Returns SolverError::Cuda if reallocation fails.
Sourcepub fn blas(&self) -> &BlasHandle
pub fn blas(&self) -> &BlasHandle
Returns a reference to the underlying BLAS handle.
Sourcepub fn blas_mut(&mut self) -> &mut BlasHandle
pub fn blas_mut(&mut self) -> &mut BlasHandle
Returns a mutable reference to the underlying BLAS handle.
Sourcepub fn sm_version(&self) -> SmVersion
pub fn sm_version(&self) -> SmVersion
Returns the SM version of the bound device.
Sourcepub fn ptx_cache_mut(&mut self) -> &mut PtxCache
pub fn ptx_cache_mut(&mut self) -> &mut PtxCache
Returns a mutable reference to the PTX cache.
Sourcepub fn workspace(&self) -> &DeviceBuffer<u8>
pub fn workspace(&self) -> &DeviceBuffer<u8>
Returns a reference to the device workspace buffer.
Sourcepub fn workspace_mut(&mut self) -> &mut DeviceBuffer<u8>
pub fn workspace_mut(&mut self) -> &mut DeviceBuffer<u8>
Returns a mutable reference to the device workspace buffer.