Examples Using Cholesky and LU Linear Solve Functions#

All examples below are in 01_Linear_Solve/. Block and thread execution variants are provided where applicable.

Cholesky and POSV#

  • potrf_block.cu

  • potrf_runtime_ld_block.cu

  • potrf_batched_thread.cu

  • posv_batched_thread.cu

(See also Introduction Example for 00_Introduction/posv_batched_block.cu.)

The potrf_block example computes Cholesky factorization for a Hermitian positive-definite matrix using cuSolverDx block execution, and compares the Cholesky factors with those from the cuSolver host API cusolverDnXpotrf.

When the matrix A already resides in shared memory with padding (e.g., to avoid bank conflicts), the potrf_runtime_ld_block example shows how to use runtime leading dimensions, which override the values set by the LeadingDimension operator. Results are compared with the cuSolver host API cusolverDnXpotrf.

LU and GESV#

  • getrf_wo_pivot_block.cu

  • getrf_partial_pivot_block.cu

  • gesv_batched_wo_pivot_block.cu, gesv_batched_wo_pivot_thread.cu

  • gesv_batched_partial_pivot_block.cu, gesv_batched_partial_pivot_thread.cu

The getrf_wo_pivot_block example performs LU factorization without pivoting on a diagonally dominant M x N matrix and compares results with the cuSolver host API cusolverDnXgetrf.

The getrf_partial_pivot_block example performs LU factorization with partial pivoting on a general M x N matrix. The factors and pivot indices ipiv are compared with the cuSolver host API cusolverDnXgetrf.

The gesv_batched_wo_pivot and gesv_batched_partial_pivot examples solve batched linear systems with multiple right-hand sides using LU factorization (without or with partial pivoting). Results are compared with the cuSolver host API cusolverDnXgetrf and cusolverDnXgetrs.

Tridiagonal (GTSV)#

  • gtsv_batched_wo_pivot_block.cu, gtsv_batched_wo_pivot_thread.cu

These examples solve batched tridiagonal linear systems. Results are compared with the cuSParse host API cusparse<t>gtsv2StridedBatch.