Replies: 3 comments 11 replies
-
|
I just ran into a compile time issue building with both |
Beta Was this translation helpful? Give feedback.
-
|
Any ideas whether the |
Beta Was this translation helpful? Give feedback.
-
|
I gave
There is probably also a desire for explicit functions from
There was also some small by-catch: in-advert conversions from |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Support for floating point types other than
doubleis going to be introduced in MFEM v4.7 with PR #3922.Summary
This is a summary of the main changes in PR #3922:
doubleis replaced throughout most of the library with a new type,real_t, which by default is just a typedef todouble.floattype) precision only. Other types may be added in the future.real_tis a typedef tofloat.MFEM_PRECISIONwith one of the strings:single/Single/SINGLE/double/Double/DOUBLE.config/_config.hpp,MFEM_PRECISIONis represented by defining exactly one of the macros:MFEM_USE_DOUBLE, orMFEM_USE_SINGLE.config.mkandMFEMConfig.cmake, the option is represented by the variablesMFEM_USE_DOUBLEandMFEM_USE_SINGLEdefined asYES/NO(make) orON/OFF(cmake).real_t operator""_r()for integer and floating-point arguments.real_tconstants as1_r,0.25_r, etc.real_ttype is to use c-style casting, e.g.real_t(1),real_t(0.25),real_t(M_PI*M_PI),reat_t(alpha(beta)), wherealphahas the signaturedouble alpha(double), etc.ex33/ex33p, were updated and support single precision, on both CPUs and GPUs.--enable-singlewhen usingMFEM_PRECISION=single.--with-precision=singlewhen usingMFEM_PRECISION=single.Discussion
Replacing
doublewithreal_tin user code is NOT necessary, as long as MFEM is built with double precision -- in this casereal_tis just an alias ofdouble, i.e. they are the same type, just different names.The only reason to convert
doubletoreal_tin user code is to add support for single precision to the user code -- and that will be just the first step. Depending on the application, adding support for single precision may require changes like: convertingdoubleconstants toreal_tconstants to prevent undesirable computations in higher precision; or increasing tolerances (whenMFEM_USE_SINGLEis defined) in iterative methods to ensure convergence is possible in the lower precision, see e.g. this code in the updated ex10:mfem/examples/ex10.cpp
Lines 462 to 472 in 6f37514
Beta Was this translation helpful? Give feedback.
All reactions