Eigen-Contrib  5.0.1
 
Loading...
Searching...
No Matches
Eigen::gpu::DeviceSparseView< Scalar_ > Class Template Reference

#include <contrib/Eigen/src/GPU/GpuSparseContext.h>

Detailed Description

template<typename Scalar_>
class Eigen::gpu::DeviceSparseView< Scalar_ >

Device-resident sparse matrix view. Returned by SparseContext::deviceView() for a SparseMatrix (CSC) or a BlockSparseMatrix (BSR). Lightweight handle referencing the context's cached device data.

It is also a matrix-free matrix type for Eigen's iterative solvers: ConjugateGradient<DeviceSparseView<Scalar>, Lower | Upper> runs Eigen's own algorithm on device vectors through solveWithGuessInPlace(); see the README.

Warning
One SparseContext caches one sparse matrix at a time. Any later upload through the same context — a second deviceView() or any host-input multiply — replaces the cached data and invalidates earlier views; a stale view is caught by an assert at evaluation time via a generation counter. For multiple simultaneous sparse matrices, use separate SparseContext instances (they can share a Context for same-stream execution).

Supports d_y = d_A * d_x (SpMV) and d_Y = d_A * d_X (SpMM).

+ Inheritance diagram for Eigen::gpu::DeviceSparseView< Scalar_ >:

Public Member Functions

uint64_t generation () const
 
Index nonZeros () const
 
SpMVExpr< Scalar > operator* (const DeviceMatrix< Scalar > &x) const
 

Member Function Documentation

◆ generation()

template<typename Scalar_>
uint64_t Eigen::gpu::DeviceSparseView< Scalar_ >::generation ( ) const
inline

Upload generation this view was created against. Used to detect stale views after the context has cached a different matrix.

◆ nonZeros()

template<typename Scalar_>
Index Eigen::gpu::DeviceSparseView< Scalar_ >::nonZeros ( ) const
inline

Number of stored entries of the cached matrix.

◆ operator*()

template<typename Scalar_>
SpMVExpr< Scalar > Eigen::gpu::DeviceSparseView< Scalar_ >::operator* ( const DeviceMatrix< Scalar > & x) const
inline

Sparse product expression: d_A * d_x. Evaluated by DeviceMatrix::operator=.


The documentation for this class was generated from the following files: