aronnax icon indicating copy to clipboard operation
aronnax copied to clipboard

Create a single-precision mode (unless that's a bad idea)

Open axch opened this issue 7 years ago • 1 comments

The benefits of single-precision are

  • Cross-checking: If the same simulation gives materially different results in single vs double precision, one can suspect severe accumulation of roundoff error.
    • However, overlapping benefits can be derived by fiddling with the resolution of the simulation.
  • Speed: single floats can be twice as fast and half as memory intensive as doubles.
    • However, a given CPU architecture may not optimize single-precision computations, so this benefit may or may not materialize in practice.

Does Fortran make it easy to change precision, e.g. with a compiler switch, or would this just be too much work?

axch avatar Mar 16 '17 13:03 axch

I don't know of any compiler switches that would let us do this, but we might be able to make it happen through the parameter.in file.

See here for a discussion.

In practice I think we're very unlikely to see performance gains from this because of the CPU optimisations, but it would be a good sanity check.

It will also require that all of the inputs are in single precision, or that the model is clever enough to distinguish which precision it's just been handed. I think the second option will be quite difficult to implement.

edoddridge avatar Mar 16 '17 14:03 edoddridge