Single, Double or Mixed Precision?

Moritz Lehmann (now working at Intel) has looked at using mixed precision in lattice Boltzmann solvers:

While the reduction in bandwidth does improve performance, it indeed limits the accuracy you can achieve, as seen from this graph:

For this test case - laminar flow in a circular channel - only the FP32 and FP64 solvers were able to reach an error lower than 1 % (which is arguably sufficient if you know there are other modelling errors that are larger). This is a relatively simple case, I imagine that in a multiphase flow or a combustion problem there would be parameters with wildly different magnitudes, and you may encounter convergence problems sooner rather than later.

At least for LBM, if you use distribution shifting (a change of variables that helps gain one extra digit of precision), single precision appears to be sufficient for many problems. I’d still remain careful if the simulation has to be performed over long time periods (the time convergence is only first order…).

I saw a similar work published recently on mixed precision in OpenFOAM, but haven’t had time to read it yet:

In a previous thread, I mentioned some works which find that for chaotic systems, even double precision may not be enough: Use case of single-precision real number - #7 by ivanpribec

1 Like