Fish Tank CUDA

2026-03-26

Code and docs

DTU HPC coursework: a 3D fish-school simulation with CPU and CUDA backends, GH200 benchmarks, Nsight profiling, and ParaView export.

cuda · c++ · simulation · hpc · visualization

Repository

Fish Tank CUDA is a DTU high-performance-computing course project. It implements a 3D fish-school model with a scalar CPU reference, a threaded CPU backend, a CUDA backend, and an asynchronous CUDA export path. It is coursework and a performance-methodology case study, not a production simulation product.

Four backends, one model

The repository keeps the same all-pairs steering model across four backends:

  • cpu_scalar — reference implementation
  • cpu_parallel — static CPU work splitting
  • cuda_naive — the same O(N²) model on the GPU
  • cuda_async — the CUDA kernels plus overlapped snapshot transfer and writing

Catch2 tests compare the optimized backends with deterministic CPU-reference scenarios. They check implementation consistency, not biological validity. CMake separates simulation, benchmark, and correctness-test targets.

GH200 measurement method

The course report records Release-build runs on an NVIDIA GH200 node with a Neoverse-V2 CPU and CUDA 12.3. Compute-only benchmarks use warmups, repeated runs, median step time, and machine-readable JSON. End-to-end export measurements stay separate from kernel timing.

At 16,384 fish, the captured stable benchmark reports 6.81 ms/step for the threaded CPU backend and 2.07 ms/step for cuda_naive: about 3.3× faster for the same all-pairs model. Nsight Systems and Nsight Compute show where time remains. Steering dominates, so the report recommends a spatial grid instead of treating launch tuning as the main result.

The method is the point, not the headline number: keep a CPU reference, split compute from I/O, profile before tuning, and keep raw benchmark and profiler artifacts with the report.

Visualization: making performance legible

The simulation exports VTK PolyData snapshots and a timeline for ParaView. A Python and ffmpeg pipeline renders the result. Visualization stays separate from benchmark evidence: JSON and profiler exports explain performance; VTP/PVD output shows simulated motion.

Scope

This page documents a course implementation and its measured results. It does not claim production deployment, biological-model validation, or a shipped CUDA swarm product. The current all-pairs algorithm remains O(N²) even when CUDA improves throughput.