gandalfcode / gandalf

GANDALF (Graphical Astrophysics code for N-body Dynamics And Lagrangian Fluids)
GNU General Public License v2.0
44 stars 12 forks source link

Double precision in python #116

Closed rbooth200 closed 7 years ago

rbooth200 commented 7 years ago

We need to be able to use double precision with python for convergence tests, e.g. the sound wave

giovanni-rosotti commented 7 years ago

How exactly do we want this to work? Are we happy with just having a compile time flag to select the precision of the python snapshots? Note that this flag will NOT be the same as the precision of the code. The alternative of course would be to be able to select the precision at run time from python. There are only a few situations where one would actually want single precision (i.e. only if there are memory constraints), and therefore increasing the code complexity (it can be done with templates, but they don't play so nicely with SWIG and it would require to add some layers of complexity) to support the flexibility is probably not worth it.

rbooth200 commented 7 years ago

I'm happy with a compile time flag - I suspect most users will be too. I also think that this should be seperate from the precision of the code - but I would say that if possible it makes sense to force python to be in single precision if the main code is. I don't think that should be too hard. I don't have a strong opinion on what the default should be - but I'd lean towards double. If users are close to running out of memory are they really going to want to use the python interface anyway?

rbooth200 commented 7 years ago

Fixed in #124