NVIDIA Developer Zone

CUDA Libraries SDK Code Samples

The GPU Computing SDK includes 100+ code samples, utilities, whitepapers, and additional documentation to help you get started developing, porting, and optimizing your applications for the CUDA architecture. You can get quick access to many of the SDK resources on this page, SDK documentation, or download the complete SDK.

Please note that you may need to install the latest NVIDIA drivers and CUDA Toolkit to compile and run the code samples.Refer to the SDK release notes for more information.

There are several sets of code samples included in the GPU Computing SDK download packages, please follow the links to browse the other examples:


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. MersenneTwisterGP11213
This sample demonstrates the Mersenne Twister random number generator GP11213 in cuRAND.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. GrabCut with NPP
CUDA Implementation of Rother et al. GrabCut approach using the 8 neighborhood NPP Graphcut primitive introduced in CUDA 4.1. (C. Rother, V. Kolmogorov, A. Blake. GrabCut: Interactive Foreground Extraction using Iterated Graph Cuts. ACM Transactions on Graphics (SIGGRAPH'04), 2004)
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. Histogram Equalization with NPP
This SDK sample demonstrates how to use NPP for histogram equalization for image data.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. FreeImage and NPP Interopability
A simple SDK sample demonstrate how to use FreeImage library with NPP.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. Box Filter with NPP
A NPP SDK sample that demonstrates how to use NPP FilterBox function to perform a Box Filter.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. Image Segmentation using Graphcuts with NPP
This sample that demonstrates how to perform image segmentation using the NPP GraphCut function.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. Preconditioned Conjugate Gradient
This sample implements a preconditioned conjugate gradient solver on GPU using CUBLAS and CUSPARSE library.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. CUDA C Monte Carlo: Single Asian Option
This sample uses Monte Carlo to simulate Single Asian Options using the NVIDIA CURAND library.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. CUDA C Monte Carlo Estimation of Pi (batch QRNG)
This sample uses Monte Carlo simulation for Estimation of Pi (using batch QRNG). This sample also uses the NVIDIA CURAND library.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. CUDA C Monte Carlo Estimation of Pi (batch PRNG)
This sample uses Monte Carlo simulation for Estimation of Pi (using batch PRNG). This sample also uses the NVIDIA CURAND library.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. CUDA C Monte Carlo Estimation of Pi (batch inline QRNG)
This sample uses Monte Carlo simulation for Estimation of Pi (using batch inline QRNG). This sample also uses the NVIDIA CURAND library.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. CUDA C Monte Carlo Estimation of Pi (inline PRNG)
This sample uses Monte Carlo simulation for Estimation of Pi (using inline PRNG). This sample also uses the NVIDIA CURAND library.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. CUDA C Random Fog
This sample illustrates pseudo- and quasi- random numbers produced by CURAND.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. ConjugateGradient
This sample implements a conjugate gradient solver on GPU using CUBLAS and CUSPARSE library.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. batchCUBLAS
A SDK sample that demonstrates how using batched CUBLAS API calls to improve overall performance.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. Simple CUBLAS
Example of using CUBLAS using the new CUBLAS API interface available in CUDA 4.0.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. Simple CUFFT
Example of using CUFFT. In this example, CUFFT is used to compute the 1D-convolution of some signal with some filter by transforming both into frequency domain, multiplying them together, and transforming the signal back to time domain.
  Minimum Required GPU
Minimum Required GPUor later
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)
Download - Linux/Mac