libCEED
libCEED copied to clipboard
Enable multiple precisions in CeedVector
In this branch, I have attempted to start collecting the result of many discussions, particularly with @jeremylt and @jedbrown, about expanding CeedVectors to be able to contain multiple precisions. This PR is meant as a place for further discussion and refinement, whether or not we end up merging from it.
Summary of changes so far (as of opening of the draft PR, April 22):
- Vector access functions (Get/Set/Take, as well as Sync) have changed to
*Generic
at the backend level, that is, the functions that get added to theCeedVector_private
struct. They now take void pointers instead ofCeedScalar
, and an additional parameter for the data type. (These can hopefully be used within other backend functions in the future where we allow mixed precision.) This has been changed in ref, cuda-ref, and hip-ref. - At the user level, these functions remain the same, but they now simply call the
Generic
version withCEED_SCALAR_TYPE
as the type parameter in their implementations ininterface/ceed-vector.c
- At the user level, additional versions for specific precisions have been added (named
*FP32
and*FP64
). These also just call theGeneric
version "under the hood"
in the hip-ref backend ONLY so far:
- A first implementation of all the
Generic
functions, aimed at implementing the previously-discussed multiprecision vector access rules for validity - The new
CeedScalarArray
struct is used to store data
In fd75fdf7cc4919c94f2cfa77e54d2cdeae8b776f I added a user-interface-level function for checking the current array status, inspired by the way MFEM returns memory status flags. I was using this in my own local tests. We may or may not want to keep something like this in the future.
Related issue: #778