Skip to main content

Csr5Matrix

Struct Csr5Matrix 

Source
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>

Source

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 (length rows + 1).
  • col_idx – CSR column indices (length nnz).
  • values – CSR values (length nnz).
§Errors

Returns SparseError::InvalidFormat if inputs are inconsistent. Returns SparseError::Cuda on GPU allocation/transfer failure.

Source

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.

Source

pub fn rows(&self) -> u32

Returns the number of rows.

Source

pub fn cols(&self) -> u32

Returns the number of columns.

Source

pub fn nnz(&self) -> u32

Returns the total non-zero count.

Source

pub fn num_tiles(&self) -> u32

Returns the number of tiles.

Source

pub fn row_ptr(&self) -> &DeviceBuffer<i32>

Returns a reference to the CSR row pointer device buffer.

Source

pub fn col_idx(&self) -> &DeviceBuffer<i32>

Returns a reference to the CSR column index device buffer.

Source

pub fn values(&self) -> &DeviceBuffer<T>

Returns a reference to the values device buffer.

Source

pub fn tile_ptr(&self) -> &DeviceBuffer<u32>

Returns a reference to the tile pointer device buffer.

Source

pub fn tile_desc(&self) -> &DeviceBuffer<TileDescriptor>

Returns a reference to the tile descriptor device buffer.

Source

pub fn calibrator(&self) -> &DeviceBuffer<T>

Returns a reference to the calibrator device buffer.

Source

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.

Auto Trait Implementations§

§

impl<T> Freeze for Csr5Matrix<T>

§

impl<T> RefUnwindSafe for Csr5Matrix<T>
where T: RefUnwindSafe,

§

impl<T> Send for Csr5Matrix<T>

§

impl<T> Sync for Csr5Matrix<T>

§

impl<T> Unpin for Csr5Matrix<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Csr5Matrix<T>

§

impl<T> UnwindSafe for Csr5Matrix<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more