This folder demonstrates main cuDSS APIs usage.
Note: samples are updated to work with the latest version of cuDSS available (currently: 1.0.0) and might be incompatible with older versions. For further details, please check the release notes in the official documentation.
-
Simple workflow for solving a real-valued sparse linear system
The sample demonstrates how to use cuDSS for solving a real sparse linear system without any advanced features
-
Simple workflow for solving a real-valued sparse linear system from a matrix market file
The sample demonstrates how to use cuDSS for solving a real sparse linear system read from a
.mtxfile without any advanced features -
Simple workflow for solving a complex-valued sparse linear system
The sample demonstrates how to use cuDSS for solving a complex sparse linear system without any advanced features
-
Hybrid host/device memory mode
The sample demonstrates how to use cuDSS for solving a real sparse linear system using the hybrid host/device memory mode
-
Multi-gpu multi-node (MGMN) mode
The sample demonstrates how to use cuDSS for solving a real sparse linear system using the multi-GPU multi-node mode (available since cudss 0.3.0)
Note: building MGMN mode samples require extra options for the communication backend at build and runtime, and must be run with mpirun
-
Getter/setter APIs for cudssConfig, cudssData and cudssHandle objects
The sample extends the previous code to demonstrate how extra settings can be applied to solving sparse linear systems and how to retrieve extra information from the solver
-
Device memory handler APIs for cudssDeviceMemHandler_t defined device memory pools or allocators
The sample demonstrates how to use cuDSS device memory handler APIs (available since cudss 0.2.0) for providing user-defined device memory pools or allocators
-
The sample demonstrates how to use cuDSS batch APIs (available since cudss 0.4.0) for solving a non-uniform batch of linear systems where matrices and righthand sides can all be different
-
The sample demonstrates how to use cuDSS for solving a real sparse linear system using the hybrid execute mode (available since cudss 0.5.0)
-
The sample demonstrates how to use cuDSS for solving a real sparse linear system using the multithreading (MT) mode (available since cudss 0.5.0)
-
The sample demonstrates how to interact with sparse matrices in cuDSS
-
The sample demonstrates how to interact with dense matrices in cuDSS
-
The sample demonstrates how to interact with batched systems in cuDSS (available since cudss 0.5.0)
-
The sample demonstrates how to use cuDSS for solving a uniform batched system (available since cudss 0.6.0)
-
Extracting reordering information
The sample demonstrates how to use cuDSS to extract the reordering information it uses internally immediately after it is generated (available since cudss 0.6.0)
-
Multi-gpu multi-node (MGMN) mode with a distributed matrix
The sample demonstrates how to use cuDSS for solving a real sparse linear system using the multi-GPU multi-node mode with a distributed system matrix (available since cudss 0.6.0)
Note: building MGMN mode samples require extra options for the communication backend at build and runtime, and must be run with mpirun
-
Multi-gpu single-node (MG) mode
The sample demonstrates how to use cuDSS for solving a real sparse linear system using the multi-GPU mode (without any distributed communication backend) (available since cudss 0.7.0)
-
The sample demonstrates how to use cuDSS for computing the Schur complement matrix (and how it can be used for solving the full system) (available since cudss 0.7.0)
-
The sample demonstrates how one can compute the relative residual norm to estimate accuracy of cuDSS (available since cudss 0.7.0)
-
Helper for testing the communication layer library
The sample demonstrates how one can check functional health of a distributed communication backend and the associated communication layer library of cuDSS (available since cudss 0.7.0)
-
Helper for testing the threading layer library
The sample demonstrates how one can check functional health of a threading backend and the associated threading layer library of cuDSS (available since cudss 0.7.0)
-
Higher than double-precision solve
The sample demonstrates how to use cuDSS for solving with higher than double-precision (available since cudss 0.8.0)
Note: This requires a GPU with compute capability 9.0 or higher.
-
The sample demonstrates how to provide custom pinned host memory allocation and deallocation callbacks (available since cudss 1.0.0).
Fortran interfaces and examples are available since cudss 1.0.0. The examples provide the same cuDSS workflows in two flavors:
- Standard Fortran (
.f90) underfortran/<name>/— build with any Fortran compiler that supports C interoperability (setFC, e.g.gfortran,ifx, ornvfortran). - CUDA Fortran (
.cuf) undernvfortran/<name>/— requires the NVIDIA HPC compilernvfortran.
Each sample directory contains the example source, the support modules it uses, and both a CMakeLists.txt and a Makefile. The cuDSS Fortran interface itself is compiled from the installed cuDSS (include/fortran/).
The following <name> samples are available under both fortran/ and nvfortran/:
-
simple— real-valued sparse linear system -
simple_complex— complex-valued sparse linear system -
get_set— getter/setter APIs for config, data, and handle objects -
memory_handler— user-defined device memory pools/allocators -
batch— non-uniform batch API -
uniform_batch— uniform batch solve -
hybrid_memory_mode— hybrid host/device memory mode -
hybrid_execute_mode— hybrid host/device execution mode -
multithreaded_mode— multi-threaded (MT) mode -
mg_mode— multi-GPU single-node (MG) mode -
reordering_phase— extract internal reordering information -
schur_complement— Schur complement computation -
residual— relative residual norm computation -
high_precision— higher-than-double-precision solve (needs compute capability 9.0+) -
sparse_matrix_helpers— sparse matrix interactions -
dense_matrix_helpers— dense matrix interactions -
batch_sparse_matrix_helpers— batched sparse matrix interactions -
mgmn_mode— multi-GPU multi-node (MGMN) modeNote: MGMN samples need a communication backend at build and run time and must be launched with mpirun.
Use cuDSS 1.0.0 with its installed include/fortran/ sources and a compatible CUDA Toolkit.
Each project builds independently; no precompiled Fortran modules are required.
For standard Fortran, for example:
cmake -S fortran/simple -B build-simple -DCMAKE_Fortran_COMPILER=gfortran -Dcudss_DIR=/path/to/cudss/lib/cmake/cudss
cmake --build build-simple
./build-simple/simple_exampleFor CUDA Fortran, use nvfortran as the Fortran compiler and
nvfortran/simple as the source directory. The standard Fortran
and CUDA Fortran trees provide the same workflows listed above.
Alternatively, run make in an individual sample directory, setting FC,
CUDSS_INC, CUDSS_LIB, and, for standard Fortran, CUDA_INC and CUDA_LIB.
Run the resulting executable directly (for example, ./simple).
MPI Fortran module files are compiler-specific; use an MPI installation built
with your Fortran compiler. The MGMN sample requires MPI C and Fortran compilers;
set MPICC and MPIF90 for Makefile builds, then launch with
mpirun -np 2 ./mgmn_mode /path/to/libcudss_commlayer_openmpi.so.
For CMake MGMN builds with multiple MPI installations, select matching wrappers
with -DMPI_Fortran_COMPILER=/path/to/mpifort and -DMPI_C_COMPILER=/path/to/mpicc.
The multithreaded sample needs the threading-layer library as its first argument
or through CUDSS_THREADING_LIB. Multi-GPU samples require at least two GPUs,
and high-precision samples require compute capability 9.0 or higher.
The examples are licensed under Apache-2.0; see the per-file license notices and repository license. The Fortran bindings used from the installed cuDSS package are licensed under BSD-3-Clause; see that package's license file. Contributions follow the repository contribution guidelines.