pub struct BatchedSpMVPlan<T> {
pub concat_row_ptr: Vec<i32>,
pub concat_col_idx: Vec<i32>,
pub concat_values: Vec<T>,
pub batch_offsets_row_ptr: Vec<usize>,
pub batch_offsets_nnz: Vec<usize>,
pub row_counts: Vec<usize>,
pub col_counts: Vec<usize>,
pub nnz_counts: Vec<usize>,
pub batch_size: usize,
pub strategy: Strategy,
}Expand description
Precomputed plan for batched SpMV execution.
Concatenates all CSR arrays (row_ptr, col_indices, values) from multiple matrices into contiguous host-side arrays with offset tables, enabling efficient data transfer and potential kernel fusion.
§Type parameters
T– Element type (must satisfyGpuFloat).
Fields§
§concat_row_ptr: Vec<i32>Concatenated row pointer array across all matrices.
concat_col_idx: Vec<i32>Concatenated column index array across all matrices.
concat_values: Vec<T>Concatenated values array across all matrices.
batch_offsets_row_ptr: Vec<usize>Start offset of each matrix’s row_ptr in concat_row_ptr.
batch_offsets_nnz: Vec<usize>Start offset of each matrix’s col_idx / values in the concatenated arrays.
row_counts: Vec<usize>Number of rows in each matrix.
col_counts: Vec<usize>Number of columns in each matrix.
nnz_counts: Vec<usize>Number of non-zeros in each matrix.
batch_size: usizeTotal number of matrices in the batch.
strategy: StrategyRecommended execution strategy.
Implementations§
Source§impl<T: GpuFloat> BatchedSpMVPlan<T>
impl<T: GpuFloat> BatchedSpMVPlan<T>
Sourcepub fn from_matrices(matrices: &[CsrMatrix<T>]) -> SparseResult<Self>
pub fn from_matrices(matrices: &[CsrMatrix<T>]) -> SparseResult<Self>
Build a plan from a slice of CSR matrices.
Downloads each matrix to host memory, concatenates the arrays, and records offset metadata.
§Errors
Returns SparseError::InvalidArgument if matrices is empty.
Returns SparseError::Cuda on download failure.
Sourcepub fn from_host_arrays(
row_ptrs: &[Vec<i32>],
col_indices: &[Vec<i32>],
values: &[Vec<T>],
rows: &[usize],
cols: &[usize],
) -> SparseResult<Self>
pub fn from_host_arrays( row_ptrs: &[Vec<i32>], col_indices: &[Vec<i32>], values: &[Vec<T>], rows: &[usize], cols: &[usize], ) -> SparseResult<Self>
Build a plan from host-side arrays directly (no GPU download required).
Each entry in the parallel arrays describes one matrix in the batch.
§Errors
Returns SparseError::InvalidArgument if any of the slices are empty
or if their lengths do not match.
Sourcepub fn total_nnz(&self) -> usize
pub fn total_nnz(&self) -> usize
Returns the total number of non-zeros across the entire batch.
Sourcepub fn total_rows(&self) -> usize
pub fn total_rows(&self) -> usize
Returns the total number of rows across the entire batch.
Trait Implementations§
Source§impl<T: Clone> Clone for BatchedSpMVPlan<T>
impl<T: Clone> Clone for BatchedSpMVPlan<T>
Source§fn clone(&self) -> BatchedSpMVPlan<T>
fn clone(&self) -> BatchedSpMVPlan<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more