CUDA Library Samples
repository·main·Indexed 25 days ago
https://github.com/nvidia/cudalibrarysamplesA collection of practical examples demonstrating NVIDIA's GPU-accelerated libraries for high-performance computing. Includes detailed guides on cuBLAS floating point emulation using the BF16x9 method and dynamic mantissa control for DGEMM, as well as tools like test_blas3 and grade_blas3 for detecting matrix multiplication algorithms and evaluating Grade A compliance accuracy.
What's inside nvidia-cudalibrarysamples
- This repository provides example applications for the NVIDIA Performance Primitives (NPP) library, which is used for high-performance image processing on NVIDIA GPUs. The examples cover various computer vision tasks including edge detection, segmentation, and distance transforms.
Overview of nvTIFF Library API examples
mainThis repository contains samples demonstrating GPU-accelerated TIFF decoding and encoding using the nvTIFF library (0.8 API). The samples cover various workloads including minimal decoding, encode-decode roundtrips, multi-page navigation, batched region decoding, and GeoTIFF georeferencing.Overview of cuBLAS Level-2 spr APIs
mainThe
cublas<t>sprAPIs are used to compute packed symmetric rank-1 updates. This specific sample demonstrates the operation $A = A + x imes x^T$ (or similar rank-1 updates) using packed storage formats.Prerequisites:
- Linux or Windows system with recent NVIDIA drivers.
- CMake version 3.18 or minimum.
Supported Architectures:
- GPU: All GPUs supported by CUDA Toolkit.
- CPU: x86_64, arm64-sbsa.
- OS: Linux, Windows.
Overview of FFT + JAX implementations
mainThis project demonstrates how to compute Fast Fourier Transforms (FFTs) at scale using JAX. It provides two distinct implementation paths for multi-GPU, multi-node (MGMN) environments:
JAX-only: Uses standard JAX APIs includingjax.numpy.fft,custom_partitioning, andjit. This approach relies on JAX's built-in distributed capabilities.JAX+cuFFTMp: Integrates cuFFTMp, an MGMN extension to cuFFT based on NVSHMEM. This uses a JAX distributed-memory custom operation to leverage cuFFTMp's performance in a one-GPU-per-process model.
Overview of Batched Image connected region Label Markers And Compression
mainThis sample demonstrates how to use the NVIDIA Performance Primitives (NPP) library to perform batched image processing. It specifically focuses on:
- Connected region labeling
- Label marker compression
- Batched image processing using GPU acceleration
Overview of nvCOMP Library Samples
mainThis repository contains API usage examples and performance benchmarks for the nvCOMP library. nvCOMP is a CUDA library providing generic compression interfaces that allow developers to integrate high-performance GPU-based compressors and decompressors into their applications.
Detailed algorithm descriptions and benchmarking results are available on the nvCOMP Developer Page.
Overview of cuBLASLt API samples
mainThe
cuBLASLtfolder contains several samples demonstrating different ways to use thecublasLtMatmulAPI. These samples range from drop-in replacements for standard cuBLAS functions to advanced auto-tuning and tensor operation implementations.Available Samples
- LtDgemmPresetAlgo: Executes double precision GEMM with a predefined algorithm. It is a near drop-in replacement for
cublasDgemmbut includes workspace support for split-K algorithms. - LtHSHgemmStridedBatchSimple: Executes mixed precision GEMM. It is a near drop-in replacement for
cublasGemmExwith workspace support for split-K algorithms. - LtIgemmTensor: Uses
cublasLtMatmulto perform tensor-op Igemm with memory order transforms on all buffers. - LtPlanarComplex: Uses
cublasLtMatmulto perform tensor-op Cgemm using planar complex memory layout and half-precision inputs. - LtSgemm: Executes single precision GEMM. It is a near drop-in replacement for
cublasSgemmwith workspace support for split-K algorithms. - LtSgemmCustomFind: Uses the low-level
cublasLtAPI to iterate through multiple combinations of algorithms and configuration attributes for single precision GEMM. - LtSgemmSimpleAutoTuning: Performs single precision GEMM auto-tuning by querying
cublasLtheuristics to find the best performing algorithm for a specific problem.
- LtDgemmPresetAlgo: Executes double precision GEMM with a predefined algorithm. It is a near drop-in replacement for
Overview of cuBLAS gemm3m usage
mainThe
cublas<t>gemm3mAPI is used to compute a matrix-matrix product. This specific sample demonstrates the use of the Gauss complexity reduction algorithm for complex matrix multiplication.Compatibility
- Supported SM Architectures: All GPUs supported by CUDA Toolkit.
- Supported OSes: Linux, Windows.
- Supported CPU Architectures: x86_64, arm64-sbsa.
- CUDA API: [cublas<t>gemm3m](https://docs.nvidia.com/cuda/cublas/index.html#cublas-t-gemm3m)
Overview of the cuFFT 2D FFT C2R/R2C example
mainThis example demonstrates a two-step FFT process:
- An in-place two-dimensional complex-to-real (C2R) transform is applied to input data (following default FFTW padding mode requirements).
- An in-place two-dimensional real-to-complex (R2C) transform is applied to the normalized output of the first transform.
This example utilizes the
cufftExecC2RAPI.Overview of cuFFTDx API Examples
mainThe cuFFTDx repository contains various examples demonstrating different FFT usage patterns. Examples are categorized into the following groups:
- Introduction Examples: Basic API introduction.
- Simple FFT Examples: Includes Thread FFT (complex-to-complex, half-precision) and Block FFT (complex-to-complex, complex-to-real, real-to-complex, and various data types like
cuda::std::complex,__half2, orfp16). - FFT Performance: Benchmarks for C2C and C2C/R2C/C2R block FFT.
- NVRTC Examples: Thread and block FFT using NVRTC, including runtime database queries.
- 2D/3D FFT Examples: 2D and 3D FP32 FFTs, including single-kernel launches using Cooperative Groups and R2C/C2R convolutions.
- Convolution Examples: Simplified and optimized FFT convolutions (1D and 2D).
- 3D Convolution Examples: Fused 3D convolutions with preprocessing, filtering, and postprocessing.
- Mixed Precision Examples: Using separate storage and compute precisions for 1D and 2D FFTs.
Overview of CUDA Library Samples
mainThe CUDA Library Samples repository provides practical examples demonstrating how to use various NVIDIA GPU-accelerated libraries. These samples are designed to help developers implement high-performance computing tasks such as math operations, image processing, signal processing, linear algebra, and data compression using CUDA.Overview of Image Euclidean Distance Transform (EDT) using NVIDIA NPP
mainThis sample demonstrates how to use the NVIDIA Performance Primitives (NPP) library to compute distance transforms and Voronoi diagrams on grayscale images using the GPU.
Supported Operations
- Truncated Euclidean Distance Transform (EDT)
- True (floating-point) Distance Transform
- Voronoi Diagram Generation
Key Technical Features
- Uses
nppiDistanceTransformPBA_*functions for GPU acceleration. - Supports multiple output types:
16u,32f, and16s. - Implements batch processing and stream-based execution using
NppStreamContextfor efficient GPU utilization. - Handles raw
.rawgrayscale image formats.