CUDA Code Samples

There are many CUDA code samples included as part of the CUDA Toolkit to help you get started on the path of writing software with CUDA C/C++

The code samples covers a wide range of applications and techniques, including:

 
  • Simple techniques demonstrating image
    • Basic approaches to GPU Computing
    • Best practices for the most important features
    • Working efficiently with custom data types
    • Quickly integrating GPU acceleration into C and C++ applications
  • How-To examples covering topics such as:
    • Adding support for GPU-accelerated libraries to an application
    • Using features such as Zero-Copy Memory, Asynchronous Data Transfers, Unified Virtual Addressing, Peer-to-Peer Communication, Concurrent Kernels, and more
    • Sharing data between CUDA and Direct3D/OpenGL graphics APIs (interoperability)
  • image Data-parallel algorithms and primitives for linear algebra operations:
    • Matrix transpose
    • Matrix-matrix multiplication
    • Matrix multiplication with multiple right hand sides
    • Parallel prefix sum of large arrays
    • Any many more!
  • Performance measurement and optimization
    • Bandwidth tests
    • Application profiling using timers
  • imageAdvanced application examples
    • Using CUDA with MPI and OpenMP
    • Computational fluid dynamics (CFD)
    • Gravitational n-body simulation
    • Black-Scholes & binomial option pricing
    • 3D Finite-difference time-domain (FDTD)
    • Video encode/decode
    • Image convolution

image

  image
 

image

image

Availability

The latest versions of the CUDA Toolkit (which is required to compile the code samples) is available on the CUDA Downloads Page.

Individual code samples are also available for download, organized into several categories:

 

All of the code samples are available under a permissive license that allows you to freely incorporate them into your applications and create derivative works for commercial, academic, or personal use.

References