NVIDIA /cuda-samples
Samples for CUDA Developers which demonstrates features in CUDA Toolkit
★ 9,769⑂ 2,452👁 125⑃ 118● 312▤ 32
+1
Daily
9,769
stars
2,452
forks
125
watchers
118
prs
312
issues
32
releases
README
CUDA Samples Samples for CUDA Developers which demonstrates features in CUDA Toolkit. This version supports CUDA Toolkit 13.5. Release Notes This section describes the release notes for the CUDA Samples on GitHub only. Change Log Revision History Getting Started Prerequisites Download and install the CUDA Toolkit for your corresponding platform. For system requirements and installation instructions of cuda toolkit, please refer to the Linux Installation Guide, and the Windows Installation Guide. Getting the CUDA Samples Using git clone the repository of CUDA Samples using the command below. git clone https://github.com/NVIDIA/cuda-samples.git Without using git the easiest way to use these samples is to download the zip file containing the current version by clicking the "Download ZIP" button on the repo page. You can then unzip the entire archive and use the samples. Building CUDA Samples The CUDA Samples are built using CMake. Follow the instructions below for building on Linux, Windows, natively on Tegra, and for cross-compilation to Automotive Linux and QNX. Linux Ensure that CMake (version 3.20 or later) is installed. Install it using your package manager if necessary: e.g. sudo apt install cmake Navigate to the root of the cloned repository and create a build directory: mkdir build && cd build Configure the project with CMake: cmake .. Build the samples: make -j$(nproc) By default, samples are compiled for all GPU architectures supported by this release. If you only need to target a specific GPU, you can override this to build for a single architecture and reduce build time considerably: cmake -DCMAKE_CUDA_ARCHITECTURES= .. Replace with your GPU's SM version (e.g. 90 for sm_90). Run the samples from their respective directories in the build folder. Building a Single Sample To build just one sample, configure CMake from within the sample's directory. You must explicitly specify a GPU architecture — standalone builds have no top-level default: bash cd cpp// mkdir -p build && cd build cmake -DCMAKE_CUDA_ARCHITECTURES= .. make Replace with your GPU's SM version (e.g. 90 for sm_90). Windows Language services for CMake are available in Visual Studio 2019 version 16.5 or later, and you can directly import the CUDA samples repository from either the root level or from any subdirectory or individual sample. To build from the command line, open the x64 Native Tools Command Prompt for VS provided with your Visual Studio installation. Navigate to the root of the cloned repository and create a build directory: mkdir build && cd build Configure the project with CMake - for example: cmake .. -G "Visual Studio 16 2019" -A x64 Open the generated solution file CUDA_Samples.sln in Visual Studio. Build the samples by selecting the desired configuration (e.g., Debug or Release) and pressing F7 (Build Solution). Run the samples from the output directories specified in Visual Studio. Enabling On-GPU Debuggin
Top issues
#362not able to build the cuda-sample on windows 118 comments · 2025-04-30#128CUDA 11.7 support.8 comments · 2022-05-23#333CMake Configuration Fails with OpenMP_CUDA Not Found7 comments · 2025-02-21#212texture not a template?6 comments · 2023-06-21#433CUDA 13.2.1 libcudart causes SIGSEGV in cuInit on WSL2 (Driver 596.49, Blackwell)4 comments · 2026-05-25#342cuda_driver_api.h doesn't exist?4 comments · 2025-02-25#200All Cuda samples vcxproj have the same ProjectGuid causing bad performance in VS IDE4 comments · 2023-04-27#413Missing check for CUDA failure in example3 comments · 2026-03-25
Discussions
#397Code Editor for CUDA, Triton, TileLang & CUTE0 comments · 2025-12-09#372Does Compute Capability for PTX implicitly impact performance? (conditional compilation aside)0 comments · 2025-06-13#341cuda_driver_api.h2 comments · 2025-02-25
Latest release
CUDA Samples v13.5 v13.5 2026-11-04Release 13.5 of the CUDA Samples, supporting CUDA Toolkit 13.5. Highlights: - Added default build support for sm_121 - Added Compute Fabric Transport sample See CHANGELOG.md for the full list of changes.