NVIDIA CUDA - Physically-Based Simulation

The CUDA Toolkit 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 toolkit resources on this page, CUDA documentation, or download the complete toolkit.

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 samples release notes for more information.


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. VFlockingD3D10
This sample demonstrates a CUDA mathematical simulation of group of birds behavior when in flight.
  Minimum Required GPU
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. Fluids (Direct3D Version)
An example of fluid simulation using CUDA and CUFFT, with Direct3D 9 rendering. A Direct3D Capable device is required.
  Minimum Required GPU
Minimum Required GPU

Download - Windows (x86)
Download - Windows (x64)


For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon. Fluids (OpenGL Version)
An example of fluid simulation using CUDA and CUFFT, with OpenGL rendering.
  Minimum Required GPU
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 FFT Ocean Simulation
This sample simulates an Ocean height field using CUFFT Library and renders the result using OpenGL.
  Minimum Required GPU
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. Particles
This sample uses CUDA to simulate and visualize a large set of particles and their physical interaction. Adding "-particles=" to the command line will allow users to set # of particles for simulation. This example implements a uniform grid data structure using either atomic operations or a fast radix sort from the Thrust library
  Minimum Required GPU
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. Marching Cubes Isosurfaces
This sample extracts a geometric isosurface from a volume dataset using the marching cubes algorithm. It uses the scan (prefix sum) function from the Thrust library to perform stream compaction.
  Minimum Required GPU
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 N-Body Simulation
This sample demonstrates efficient all-pairs simulation of a gravitational n-body simulation in CUDA. This sample accompanies the GPU Gems 3 chapter "Fast N-Body Simulation with CUDA". With CUDA 5.5, performance on Tesla K20c has increased to over 1.8TFLOP/s single precision. Double Performance has also improved on all Kepler and Fermi GPU architectures as well. Starting in CUDA 4.0, the nBody sample has been updated to take advantage of new features to easily scale the n-body simulation across multiple GPUs in a single PC. Adding "-numbodies=" to the command line will allow users to set # of bodies for simulation. Adding “-numdevices=” to the command line option will cause the sample to use N devices (if available) for simulation. In this mode, the position and velocity data for all bodies are read from system memory using “zero copy” rather than from device memory. For a small number of devices (4 or fewer) and a large enough number of bodies, bandwidth is not a bottleneck so we can achieve strong scaling across these devices.
  Minimum Required GPU
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. Smoke Particles
Smoke simulation with volumetric shadows using half-angle slicing technique. Uses CUDA for procedural simulation, Thrust Library for sorting algorithms, and OpenGL for graphics rendering.
  Minimum Required GPU
Minimum Required GPU

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