CUSPARSE

Public

CUDA.CUSPARSE.CuSparseMatrixBSRType
CuSparseMatrixBSR

Container to hold sparse matrices in block compressed sparse row (BSR) format on the GPU. BSR format is also used in Intel MKL, and is suited to matrices that are "block" sparse - rare blocks of non-sparse regions.

source
CUDA.CUSPARSE.CuSparseMatrixCSCType
CuSparseMatrixCSC

Container to hold sparse matrices in compressed sparse column (CSC) format on the GPU.

Note

Most CUSPARSE operations work with CSR formatted matrices, rather than CSC.

source
CUDA.CUSPARSE.CuSparseMatrixCSRType
CuSparseMatrixCSR{Tv, Ti} <: AbstractCuSparseMatrix{Tv, Ti}

Container to hold sparse matrices in compressed sparse row (CSR) format on the GPU.

Note

Most CUSPARSE operations work with CSR formatted matrices, rather than CSC.

CUDA 11

Support of indices type rather than Cint (Int32) requires at least CUDA 11.

source
CUDA.CUSPARSE.axpby!Method
axpby!(alpha::Number, X::CuSparseVector, beta::Number, Y::CuVector, index::SparseChar)

Computes alpha * X + beta * Y for sparse X and dense Y.

source
CUDA.CUSPARSE.axpbyMethod
axpby(alpha::Number, x::CuSparseVector, beta::Number, y::CuSparseVector, index::SparseChar)

Performs z = alpha * x + beta * y. x and y are sparse vectors.

source
CUDA.CUSPARSE.colorFunction
color(A::CuSparseMatrixCSC, index::SparseChar; percentage::Number=1.0)
color(A::CuSparseMatrixCSR, index::SparseChar; percentage::Number=1.0)

This function performs the coloring of the adjacency graph associated with the matrix A. The coloring is an assignment of colors (integer numbers) to nodes, such that neighboring nodes have distinct colors. An approximate coloring algorithm is used in this routine, and is stopped when a certain percentage of nodes has been colored. The rest of the nodes are assigned distinct colors (an increasing sequence of integers numbers, starting from the last integer used previously). The reordering is such that nodes that have been assigned the same color are reordered to be next to each other.

The matrix A passed to this routine, must be stored as a general matrix and have a symmetric sparsity pattern. If the matrix is non-symmetric the user should pass A + Aᵀ as a parameter to this routine.

source
CUDA.CUSPARSE.gather!Method
gather!(X::CuSparseVector, Y::CuVector, index::SparseChar)

Sets the nonzero elements of X equal to the nonzero elements of Y at the same indices.

source
CUDA.CUSPARSE.geamMethod
geam(alpha::Number, A::CuSparseMatrix, beta::Number, B::CuSparseMatrix, index::SparseChar)

Performs C = alpha * A + beta * B. A and B are sparse matrices defined in CSR or CSC storage formats.

source
CUDA.CUSPARSE.gemvFunction
y = gemv(transa, alpha, A, x, index, [algo])

Perform a product between a CuSparseMatrix and a CuSparseVector, returning a CuSparseVector. This function should only be used for highly sparse matrices and vectors, as the result is expected to have many non-zeros in practice. For this reason, high-level functions like mul! and * internally convert the sparse vector into a dense vector to use a more efficient CUSPARSE routine.

Supported formats for the sparse matrix are CuSparseMatrixCSC and CuSparseMatrixCSR.

source
CUDA.CUSPARSE.gtsv2!Function
gtsv2!(dl::CuVector, d::CuVector, du::CuVector, B::CuVecOrMat, index::SparseChar='O'; pivoting::Bool=true)

Solve the linear system A * X = B where A is a tridiagonal matrix defined by three vectors corresponding to its lower (dl), main (d), and upper (du) diagonals. With pivoting, the solution is more accurate but also more expensive. Note that the solution X overwrites the right-hand side B.

source
CUDA.CUSPARSE.ic02!Function
ic02!(A::CuSparseMatrix, index::SparseChar='O')

Incomplete Cholesky factorization with no pivoting. Preserves the sparse layout of matrix A.

source
CUDA.CUSPARSE.ilu02!Function
ilu02!(A::CuSparseMatrix, index::SparseChar='O')

Incomplete LU factorization with no pivoting. Preserves the sparse layout of matrix A.

source
CUDA.CUSPARSE.mm!Function
mm!(transa::SparseChar, transb::SparseChar, alpha::Number, A::CuSparseMatrix, B::CuMatrix, beta::Number, C::CuMatrix, index::SparseChar)
mm!(transa::SparseChar, transb::SparseChar, alpha::Number, A::CuMatrix, B::Union{CuSparseMatrixCSC,CuSparseMatrixCSR,CuSparseMatrixCOO}, beta::Number, C::CuMatrix, index::SparseChar)

Performs C = alpha * op(A) * op(B) + beta * C, where op can be nothing (transa = N), tranpose (transa = T) or conjugate transpose (transa = C).

source
CUDA.CUSPARSE.mv!Function
mv!(transa::SparseChar, alpha::Number, A::CuSparseMatrix, X::CuVector, beta::Number, Y::CuVector, index::SparseChar)

Performs Y = alpha * op(A) * X + beta * Y, where op can be nothing (transa = N), tranpose (transa = T) or conjugate transpose (transa = C). X and Y are dense vectors.

source
CUDA.CUSPARSE.rot!Method
rot!(X::CuSparseVector, Y::CuVector, c::Number, s::Number, index::SparseChar)

Performs the Givens rotation specified by c and s to sparse X and dense Y.

source
CUDA.CUSPARSE.sm2!Method
sm2!(transa::SparseChar, transxy::SparseChar, uplo::SparseChar, diag::SparseChar, alpha::BlasFloat, A::CuSparseMatrixBSR, X::CuMatrix, index::SparseChar)

Performs X = alpha * op(A) \ op(X), where op can be nothing (transa = N), tranpose (transa = T) or conjugate transpose (transa = C). X is a dense matrix, and uplo tells sm2! which triangle of the block sparse matrix A to reference. If the triangle has unit diagonal, set diag to 'U'.

source
CUDA.CUSPARSE.sv2!Method
sv2!(transa::SparseChar, uplo::SparseChar, diag::SparseChar, alpha::BlasFloat, A::CuSparseMatrixBSR, X::CuVector, index::SparseChar)

Performs X = alpha * op(A) \ X, where op can be nothing (transa = N), tranpose (transa = T) or conjugate transpose (transa = C). X is a dense vector, and uplo tells sv2! which triangle of the block sparse matrix A to reference. If the triangle has unit diagonal, set diag to 'U'.

source

Private

SparseArrays.sparseMethod
sparse(x::DenseCuMatrix; fmt=:csc)
sparse(I::CuVector, J::CuVector, V::CuVector, [m, n]; fmt=:csc)

Return a sparse cuda matrix, with type determined by fmt. Possible formats are :csc, :csr, :bsr, and :coo.

source