pub struct Csr5Matrix<T: GpuFloat> { /* private fields */ }Expand description
A sparse matrix in CSR5 format, stored on GPU.
CSR5 augments the standard CSR representation with tile-based metadata
for load-balanced GPU SpMV. The non-zero elements are logically divided
into tiles of CSR5_TILE_WIDTH elements each. Each tile maps to one
warp during SpMV execution.
Implementations§
Source§impl<T: GpuFloat> Csr5Matrix<T>
impl<T: GpuFloat> Csr5Matrix<T>
Sourcepub fn from_csr_host(
rows: u32,
cols: u32,
row_ptr: &[i32],
col_idx: &[i32],
values: &[T],
) -> SparseResult<Self>
pub fn from_csr_host( rows: u32, cols: u32, row_ptr: &[i32], col_idx: &[i32], values: &[T], ) -> SparseResult<Self>
Constructs a CSR5 matrix from host-side CSR arrays.
This performs the CSR-to-CSR5 conversion on the host, computing tile pointers and descriptors, then uploads everything to GPU memory.
§Arguments
rows– Number of rows.cols– Number of columns.row_ptr– CSR row pointer (lengthrows + 1).col_idx– CSR column indices (lengthnnz).values– CSR values (lengthnnz).
§Errors
Returns SparseError::InvalidFormat if inputs are inconsistent.
Returns SparseError::Cuda on GPU allocation/transfer failure.
Sourcepub fn from_csr(csr: &CsrMatrix<T>) -> SparseResult<Self>
pub fn from_csr(csr: &CsrMatrix<T>) -> SparseResult<Self>
Constructs a CSR5 matrix from an existing GPU-resident CSR matrix.
Downloads CSR data to host, computes tile metadata, then re-uploads everything.
§Errors
Returns SparseError::Cuda on GPU transfer/allocation failure.
Sourcepub fn row_ptr(&self) -> &DeviceBuffer<i32>
pub fn row_ptr(&self) -> &DeviceBuffer<i32>
Returns a reference to the CSR row pointer device buffer.
Sourcepub fn col_idx(&self) -> &DeviceBuffer<i32>
pub fn col_idx(&self) -> &DeviceBuffer<i32>
Returns a reference to the CSR column index device buffer.
Sourcepub fn values(&self) -> &DeviceBuffer<T>
pub fn values(&self) -> &DeviceBuffer<T>
Returns a reference to the values device buffer.
Sourcepub fn tile_ptr(&self) -> &DeviceBuffer<u32>
pub fn tile_ptr(&self) -> &DeviceBuffer<u32>
Returns a reference to the tile pointer device buffer.
Sourcepub fn tile_desc(&self) -> &DeviceBuffer<TileDescriptor>
pub fn tile_desc(&self) -> &DeviceBuffer<TileDescriptor>
Returns a reference to the tile descriptor device buffer.
Sourcepub fn calibrator(&self) -> &DeviceBuffer<T>
pub fn calibrator(&self) -> &DeviceBuffer<T>
Returns a reference to the calibrator device buffer.
Sourcepub fn tile_metadata_to_host(
&self,
) -> SparseResult<(Vec<u32>, Vec<TileDescriptor>)>
pub fn tile_metadata_to_host( &self, ) -> SparseResult<(Vec<u32>, Vec<TileDescriptor>)>
Downloads tile metadata to host for inspection.
§Errors
Returns SparseError::Cuda on transfer failure.