CUDA extension
Loaded with using CUDA. It accepts the sparse matrices of cuSPARSE and routes the dense operations of large fronts to cuBLAS and cuSOLVER.
SparseDirectSolver.CSR — Method
CSR(A::CuSparseMatrixCSC)Wrap A (m × n) without copying as the CSR of transpose(A) (n × m, transposed = true), sharing colPtr, rowVal and nzVal.
SparseDirectSolver.CSR — Method
CSR(A::CuSparseMatrixCSR)Wrap A without copying: the CSR shares rowPtr, colVal and nzVal (one-based, transposed = false).
SparseDirectSolver.DirectSolver — Method
DirectSolver(A::CuSparseMatrixCSR, structure::String, view::Char; index = 'O')
DirectSolver(A::CuSparseMatrixCSC, structure::String, view::Char; index = 'O')Solver on A's arrays, without copies (≅ CudssSolver(A, structure, view)). A CuSparseMatrixCSC is read as the CSR of its transpose with the view flipped (MadNLP's lower-triangle CSC becomes an upper-triangle CSR), see DirectSolver.
cuSPARSE.CuSparseMatrixCSR — Method
CuSparseMatrixCSR(A::CSR)The stored CSR matrix of A (the transposed flag is not applied) as a CuSparseMatrixCSR. One-based arrays are shared; zero-based index arrays are copied and rebased. Batches (nbatch(A) > 1) are rejected.
LinearAlgebra.cholesky — Function
cholesky(A::CuSparseMatrixCSR, NoPivot(); view = 'F', check = false) -> DirectSolver
cholesky(Symmetric(A::CuSparseMatrixCSR)) / cholesky(Hermitian(A::CuSparseMatrixCSR))LLᵀ/LLᴴ factorization of A on the GPU (≅ CUDSS.jl's cholesky); the wrappers pass their uplo as the view. See cholesky(::CSR).
LinearAlgebra.ldlt — Method
ldlt(A::CuSparseMatrixCSR; view = 'F', check = false) -> DirectSolver
ldlt(Symmetric(A::CuSparseMatrixCSR)) / ldlt(Hermitian(A::CuSparseMatrixCSR))LDLᵀ/LDLᴴ factorization of A on the GPU (≅ CUDSS.jl's ldlt); the wrappers pass their uplo as the view. See ldlt(::CSR).
LinearAlgebra.lu — Method
lu(A::CuSparseMatrixCSR; check = false) -> DirectSolverL D U factorization (structure "G") of A on the GPU (≅ CUDSS.jl's lu). See lu(::CSR).
SparseDirectSolver.capture_graph — Method
capture_graph(::CUDABackend, f)f() captured into a CUDA graph (CUDACore.capture) and instantiated; the returned CuGraphExec replays it on the task's stream when called, so it stays ordered with the caller's other work on that stream. nothing when the capture fails (an operation that cannot be captured, or an error raised while capturing: nothing has run then, and the caller launches f eagerly, where a genuine error raises again).
The capture runs on a fresh non-blocking stream to which the task's cuSOLVER dense and cuBLAS handles are bound before the capture begins (CUDACore.stream!(handle, s)), so that a vendor dense call inside f finds its handle already on the capture stream. Otherwise the first cuSOLVER.dense_handle() in the capture calls cusolverDnSetStream on the stream being captured, which cuSOLVER 12.3.5 (CUDA 13.4) answers by invalidating the capture (#174; CUDA.jl 6 captures on a dedicated stream, not on the task's). Afterwards both handles are bound back to the task's stream.
A captured vendor potrf bakes in the pointer of the task's cuSOLVER workspace (with_workspace grows that buffer by reallocating it when a larger bufferSize comes along). The eager factorization that precedes a capture sizes it for the solver's widest front, so the graph is consistent for that solver; a wider front factored later in the same task by another solver would reallocate the workspace under a still-replayed graph. One solver per task (MadNLP's pattern) keeps this theoretical; a capture of the stock path (T38) should size the workspace for the widest front of every live solver before capturing.
SparseDirectSolver.device_fence — Method
device_fence(::CuDeviceArray)The gpu-scope threadfence() (fence.sc.gpu) in the fused kernels, instead of the system-scope fence Threads.atomic_fence() lowers to (#154, T34).
SparseDirectSolver.max_local_bytes — Method
max_local_bytes(::CUDABackend) -> Int48 KiB: @localmem is static shared memory, and ptxas rejects more than 48 KiB of static shared data per kernel on every CUDA device (larger amounts need dynamic shared memory with an opt-in attribute). The regime-A kernels therefore stop at the 48 KiB class on CUDA (issue #60).
SparseDirectSolver.max_threads_per_multiprocessor — Method
max_threads_per_multiprocessor(::CUDABackend) -> IntCU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR of the current device.
SparseDirectSolver.update! — Method
update!(solver::DirectSolver, A::CuSparseMatrixCSR)
update!(solver::DirectSolver, A::CuSparseMatrixCSC)Point solver at the arrays of A (≅ cudss_update(solver, A)), see update!.