Fluids v.3 was the first very fast, interactive >1 million particle, Smooth Particle Hydrodynamic simulator.
This repository contains the complete history of Fluids.
NEW (2025): The latest Fluids 5.0 has been published in Nov 2025!
The current version is even faster, uses the CUDA Driver API, can handle >4 million particles, uses full smart CPU/GPU pointers, buffer-based structure of arrays, integrated CPU/GPU switching, with cleaner, simplified code.
Latest Performance
Date: 11/23/2025
Hardware: GeForce RTX 4090
# Particles: 4,000,000
Fluids ver 3.2 ➔ 32 fps
Fluids ver 3.9 ➔ 71 fps
Fluids ver 4.0 ➔ 98 fps
Fluids ver 5.0 ➔ 160 fps
(same hardware & num particles for all versions)
How to Build
I recommend you build the latest Fluids v5.0.
Run CMake on the Fluids v5.0 folder.
The CUDA Toolchain must be setup correctly for your Graphics Cards model, CUDA Toolkit version and NVIDIA Driver.
Set the CUDA_ARCH_BIN and CUDA_ARCH_PTX cmake variables to match your hardware.
For example: GeForce RTX 5060, CUDA 13.0, NV Driver 581.80 => CUDA_ARCH_BIN=compute_120, CUDA_ARCH_PTX=sm_120
Use ChatGPT to help install the proper toolchain for your specific hardware, or if you don't know what I'm talking about.
History
Fluids 5.0
Modernized, 2023
Cuda Driver API (cuLaunchKernel), no longer requires CUDA Run-time linkage
Large-scale prefixSums, custom code, >4 million particles
Full Smart Pointers, CPU & GPU (DataPtr)
Buffer-based kernels
Abstract Buffer management (DataX)
Removed run modes
Integrated CPU & GPU switching per func (instead of ver 4.0 Run modes)
Modern folder struct (src, assets)
Major code cleanup and reduction
Fluids 4.0
Rewrite, 2022
Fluid struct removed
Fluid as buffers (SofA, see fluid.h)
Buffer-based kernels
Allows for arbitrary per-particle properties
New kernels: sampleParticles, computeQuery
Write to disk (SavePoints)
Equivalent CPU & GPU code
Run modes: SEARCH, CPU_SLOW, CPU_GRID, VALIDATE, GPU_FULL, PLAYBACK
Fluids 3.9
Major update, 2021
Switched to Cuda Driver API (cuLaunchKernel), no need to link to Cuda Run-time
Large-scale prefix sums, custom code, >4 million particles
Introduced insertion-sort and prefix scan, as faster alternatives to radix-sort for particle search
GTC 2014 Talk: 2014, Hoetzlein. Fast Fixed-Radius Nearest Neighbors: Interactive Million-Particle Fluids. GPU Technology Conference. Santa Clara, CA. 2014.
Fluids 2
First GPU version, 2011
Radix-sort based (Simon Green, 2010)
CPU-GPU transfers per frame (pipeline bottleneck)
Fluids 1
First CPU version, 2007
Smoothed Particle Hydrodynamics (SPH)
Proof of concept
Self learning
Keyboard commands (Fluids 3.0):
H Turn scene info on/off
N, M Change number of particles
[, ] Change example scene (loaded from scene.xml)
F, G Change algorithm (CPU, GPU, etc.)
J Change rendering mode (points, sprites, spheres)
C Adjust camera (using mouse)
L Adjust light (using mouse)
A,S,W,D Move camera target
1 Draw acceleration grid
2 Draw particle IDs (be sure # < 4096 first)
~ Start video capture to disk (tilde key)
-, + Change grid density
Scene parameters (Fluids 3.0)
Example scenes are loaded from the scene.xml file
All parameters are permitted in either Fluid or Scene sections.
…
Contact
Feel free to contact me if you have any questions, comments or suggestions: