NVIDIA /cuda-samples

Samples for CUDA Developers which demonstrates features in CUDA Toolkit

★ 9,769⑂ 2,452👁 125⑃ 118● 312▤ 32
C++NOASSERTIONCreated 2018-03-27
下载:CUDA Samples v13.5CUDA-13.5 ↓13.52026-11-04
+1
日增长
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

Discussions

Latest release

CUDA Samples v13.5 v13.5 2026-11-04
Release 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.

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON