NVIDIA/cuda-samples logo

NVIDIA/cuda-samples

Free

Samples for CUDA Developers which demonstrates features in CUDA Toolkit

FreeFree tier
Type
Open Source
Company
NVIDIA

About NVIDIA/cuda-samples

NVIDIA/cuda-samples is a public GitHub repository containing a collection of sample programs that demonstrate various features of the CUDA Toolkit. The samples cover a range of topics from basics to advanced techniques, written in C++ and Python. The repository is versioned to match CUDA Toolkit 13.3 and includes build support via CMake (version 3.20 or later) for Linux, Windows, and cross-compilation for Tegra devices. It also provides guidance for on-GPU debugging with cuda-gdb. The repository has a large community following with over 9,400 stars and 2,400 forks.

Key Features

Supports CUDA Toolkit 13.3
Includes C++ and Python sample code
Built with CMake (version 3.20 or later)
Cross-compilation support for Tegra devices
On-GPU debugging via cuda-gdb (ENABLE_CUDA_DEBUG flag)
Large collection of sample programs demonstrating CUDA features

Pros & Cons

Pros
  • Free and open source
  • Comprehensive set of samples covering many CUDA features
  • Supports multiple platforms (Linux, Windows, Tegra)
  • Regularly updated to match latest CUDA Toolkit
  • Large community with many stars and forks
Cons
  • Requires NVIDIA GPU and CUDA Toolkit to build and run
  • Primarily code examples, not a complete application
  • May require familiarity with CMake build system

Best For

Learning CUDA programmingReference implementation for CUDA featuresTesting CUDA Toolkit features across platforms

FAQ

How do I build the CUDA samples?
The samples are built using CMake (version 3.20 or later). On Linux, create a build directory, run cmake .., and then make -j$(nproc). On Windows, use Visual Studio or cmake from the command line.
What CUDA Toolkit version is supported?
The repository currently supports CUDA Toolkit 13.3.
Can I use these samples on Windows?
Yes, the repository provides build instructions for Windows either via Visual Studio or CMake command line using the x64 Native Tools Command Prompt.