Phalanx  Development
 All Classes Functions Variables Typedefs Enumerations Friends Pages
Classes | Public Member Functions | List of all members
PHX::MemoryManager Class Reference

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.
 

Detailed Description

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.

Member Function Documentation

template<class EvaluationType >
void PHX::MemoryManager::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 
)
inline

Assigns memory to a view, allocates new memory if needed.

Parameters
[out]fieldA newly created Kokkos::View wrapped in an any object.
[out]trackerThe SharedAllocatoinTracker for the created view's memory.
[in]allocation_size_in_bytesRequired size of the allocation.
[in]tagFieldTag with information for creating the new view.
[in]extended_dimensionsSize of any hidden dimensions for the scalar type. This can be empty for types that don't have hidden dimensions.

References PHX::FieldTag::identifier().

template<class EvaluationType >
PHX::any PHX::MemoryManager::createViewFromAllocationTracker ( const PHX::FieldTag tag,
const std::vector< PHX::index_size_type > &  extended_dimensions,
Kokkos::Impl::SharedAllocationTracker &  tracker 
)
inline

Created a kokkos view using a supplied tracker.

Parameters
[in]tagA FieldTag with information for creating the new view.
[in]extended_dimensionsSize of any hidden dimensions for the scalar type. This can be empty for types that don't have hidden dimensions.
[in]trackerThe SharedAllocatoinTracker for the created view's memory.
Returns
Newly created view wrapped in an any object.

References PHX::FieldTag::identifier().


The documentation for this class was generated from the following file: