POP performance study improves performance up to a factor 6

Wednesday, March 22, 2017

The computer animation department of the Stuttgart Media University, in cooperation with the Visualisation Research Centre of the University of Stuttgart, develops a Smoothed Particle Hydrodynamics solver to simulate fluids for computer graphics applications called sphFluids.  The Code is written in C++ and was mainly developed as a cross-platform desktop application, which is parallelized with OpenMP.

The sphFluids code supports the most common pressure as well as viscosity models. Additionally, various approaches to model surface tension are integrated. More details can be found in the paper "Evaluation of Surface Tension Models for SPH-Based Fluid Animations Using a Benchmark Test".

The sphFluids code undergone a POP performance audit, which identified several issues related to the sequential computational performance. The good information exchange with the POP experts during the study helped the code developers to identify critical parts in their application.

One of the issues found was code regions with low instruction per cycle (IPC) values. Several causes for this where pointed out including:

  • Definitions of variables in inner loops
  • Unnecessary operations caused by indirections in the code design
  • Non-inlined functions
  • Cache misses, due to memory calls

Based on the audit, the code developers could optimize the identified parts in the code by, e.g., inlining very short functions that were used frequently or, regarding the cache misses, reorder the particle processing order. This modifications improved the performance of the code by about 100 %. Furthermore, they identified similar issues in other parts of the code and reviewed the overall code design. The developers came to the decision to completely rewrite the simulation code. Using the gained insights provided by the POP-Experts for the rewrite, they could optimize the simulation performance further, which led to an overall performance improvement up to 500 % - 600 %, depending on the scenario and pressure model used.