On Tue, Jan 25, 2022 at 12:22 PM Roland Haas <[email protected]> wrote: > > Hello David, > > > That makes sense. It will take me a little time to change the source > > code but I can try it out. I think this is something that should be > > included in future versions of Cactus so extra code modifications > > aren’t needed. > Agreed. If you add such code and provide a pull request then I, for my > part, would be in favour of including it, even if only for the > VECTORISE=no case. > > Note that just because the ET compiles does not guarantee that all > places in Cactus / Carpet are actually save for the case where > CCTK_REAL is "better" than a "double" (they should work fine for > CCTK_REAL == float since that has been used in the past). You are > mostly in uncharted areas I would say (though others may have used such > a setup in the past, I just do not myself recall having seen this being > done).
David To actually use CCTK_REAL16, a lot of details need to be sorted out. In many places, people use constants such as "1.0/3.0". With CCTK_REAL4, this will automatically switch to double precision (and run much slower e.g. on GPUs). With CCTK_REAL16, this will lose a lot of precision. You will need to go through the code and manually replace all such terms with e.g. "1 / CCTK_REAL(3)". You will also need to replace M_PI by e.g. "acos(-CCTK_REAL(1))" etc. In C++ and Fortran, calls to "log" or "exp" will automatically do the right thing; in C they won't (use <tgmath.h>; see e.g. <https://en.cppreference.com/w/c/numeric/math/sin>). Having done that, you will also need to update calls to printf or CCTK_VINFO to ensure that all its arguments are converted to double, or update the format specifiers (see e.g. <https://en.cppreference.com/w/cpp/io/c/fprintf>). Finally, the HDF5 output most likely doesn't support CCTK_REAL16, and neither will most visualization tools. -erik -- Erik Schnetter <[email protected]> http://www.perimeterinstitute.ca/personal/eschnetter/ _______________________________________________ Users mailing list [email protected] http://lists.einsteintoolkit.org/mailman/listinfo/users
