Skip to content

Addition of general MemoryRegion

Issue/feature addressed

Currently the Field class has member variable that is a MemoryRegionCPU with several ancillary methods that work on the variable. This member variable and the associated ancillary methods need to be generalized for general host/device usage.

Proposed solution

*A new class MemoryRegion has been introduced which the Field inherits from. At the same time this class is used in the operators so allow host/device usage.

Importantly this class uses the notion of valid host/device data rather than the notion of whether the data is "on" the device which will not work.

At the same time I have introduced the concept of execution and memory spaces which is ubiquitous in Kokkos and I believe should be moved into the base operator class. It allows for a more general way of understanding where an functor is executing and the location of the memory.

When combined with the MemoryRegion one generically asks for a pointer to memory. Depending on the memory space of the operator the appropriate data is returned.

The above have been implemented across all operators.

I have also introduced storing the basis data via the BasisKey which is similar to what is done in the CUDA implementations.

Note the MemoryRegion in BwdTransMatFree uses a vec_t whereas the BwdTransCUDA uses a TData (double).

I have also done some cleanup in the MatFree so to remove m_basis which was redundant given the expansion list is also stored. *


A more detailed description of the changes. Please include any details necessary for reviewers to understand your work, and point out particular points would like them to pay particular attention to.


Suggested reviewers

Please suggest any people who would be appropriate to review your code.


Please add any other information that could be useful for reviewers.


  • Functions and classes, or changes to them, are documented.
  • User guide/documentation is updated.
  • Changelog is updated.
  • Suitable tests added for new functionality.
  • Contributed code is correctly formatted. (See the contributing guidelines).
  • License added to any new files.
  • No extraneous files have been added (e.g. compiler output or test data files).
Edited by Allen Sanderson

Merge request reports