This object is siimilar to a memory pool in that allows for reuse of view allocations across the DAG and in other DataContainers and FieldManagers. More...
#include <Phalanx_MemoryManager.hpp>
Public Member Functions | |
MemoryManager (const MemoryManager &mp) | |
Allocate a new memory pool re-using allocations from other linked MemoryManagers. | |
std::shared_ptr < PHX::MemoryManager > | clone () const |
Clones MemoryManager to reuse tracker allocations with a separate FieldManager. | |
template<typename EvaluationType > | |
std::size_t | getAllocationSize (const PHX::FieldTag &tag, const std::vector< PHX::index_size_type > extended_dimensions) |
Returns the size required for the allocated view. This includes padding if relevant. | |
template<class EvaluationType > | |
void | createView (PHX::any &field, Kokkos::Impl::SharedAllocationTracker &tracker, const std::size_t &allocation_size_in_bytes, const PHX::FieldTag &tag, const std::vector< PHX::index_size_type > &extended_dimensions) |
Assigns memory to a view, allocates new memory if needed. More... | |
template<class EvaluationType > | |
PHX::any | createViewFromAllocationTracker (const PHX::FieldTag &tag, const std::vector< PHX::index_size_type > &extended_dimensions, Kokkos::Impl::SharedAllocationTracker &tracker) |
Created a kokkos view using a supplied tracker. More... | |
void | insertTracker (Kokkos::Impl::SharedAllocationTracker &t) |
Inserts tracker. | |
This object is siimilar to a memory pool in that allows for reuse of view allocations across the DAG and in other DataContainers and FieldManagers.
A field may only be used in a small section of the DAG. After topological sorting, we can find the span of evaluators in the sorted list that the field must exist over. Outside of this range, the view memory can be reused by other views that don't overlap within the same DAG.
An additional feature is that since only one evaluation type of one FieldManager is run at a time, phalanx can also reuse view allocations for different evaluation types in the same FieldManager and over all evaluation types in other FieldManagers. A special clone method exists that creates a new MemoryManager, pointing to the same allocations, but resetting the tracker objects for a new FieldManager or DataContainer.
|
inline |
Assigns memory to a view, allocates new memory if needed.
[out] | field | A newly created Kokkos::View wrapped in an any object. |
[out] | tracker | The SharedAllocatoinTracker for the created view's memory. |
[in] | allocation_size_in_bytes | Required size of the allocation. |
[in] | tag | FieldTag with information for creating the new view. |
[in] | extended_dimensions | Size of any hidden dimensions for the scalar type. This can be empty for types that don't have hidden dimensions. |
References PHX::FieldTag::identifier().
|
inline |
Created a kokkos view using a supplied tracker.
[in] | tag | A FieldTag with information for creating the new view. |
[in] | extended_dimensions | Size of any hidden dimensions for the scalar type. This can be empty for types that don't have hidden dimensions. |
[in] | tracker | The SharedAllocatoinTracker for the created view's memory. |
References PHX::FieldTag::identifier().