Phalanx  Development
 All Classes Functions Variables Typedefs Enumerations Friends Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PHX::EvaluationContainer< EvalT, Traits > Class Template Reference

Container that holds all data associated with an evaluation type. More...

#include <Phalanx_EvaluationContainer.hpp>

Inheritance diagram for PHX::EvaluationContainer< EvalT, Traits >:
Inheritance graph
[legend]
Collaboration diagram for PHX::EvaluationContainer< EvalT, Traits >:
Collaboration graph
[legend]

Public Member Functions

void requireField (const PHX::FieldTag &f)
 Requests that the container must compute this field.
 
void aliasField (const PHX::FieldTag &aliasedField, const PHX::FieldTag &targetField)
 
void registerEvaluator (const Teuchos::RCP< PHX::Evaluator< Traits > > &p)
 
PHX::any getFieldData (const PHX::FieldTag &f)
 
void setUnmanagedField (const PHX::FieldTag &f, const PHX::any &a, const bool cleanup_output=true)
 Set the memory for an unmanaged field. More...
 
void bindField (const PHX::FieldTag &f, const PHX::any &a)
 Bind the memory pointer for a field in all evaluators.
 
void postRegistrationSetup (typename Traits::SetupData d, PHX::FieldManager< Traits > &fm, const bool &buildDeviceDAG, const bool &minimizeDAGMemoryUse, const PHX::MemoryManager *const memoryManager)
 
void evaluateFields (typename Traits::EvalData d)
 
void evaluateFieldsDeviceDag (const int &work_size, const int &team_size, const int &vector_size, typename Traits::EvalData d)
 
void preEvaluate (typename Traits::PreEvalData d)
 
void postEvaluate (typename Traits::PostEvalData d)
 
void setKokkosExtendedDataTypeDimensions (const std::vector< PHX::index_size_type > &dims)
 
const std::vector
< PHX::index_size_type > & 
getKokkosExtendedDataTypeDimensions () const
 
bool setupCalled () const
 Return true if the postRegistrationSetupMethod has been called.
 
const std::string evaluationType () const
 
void print (std::ostream &os) const
 
void analyzeGraph (double &speedup, double &parallelizability) const
 
void buildDag ()
 
const std::vector
< Teuchos::RCP< PHX::FieldTag > > & 
getFieldTags ()
 
void printEvaluatorStartStopMessage (const Teuchos::RCP< std::ostream > &ostr)
 Print to user specified ostream when each evaluator starts and stops. Useful for debugging. Enabled only in debug builds. More...
 
const PHX::DagManager< Traits > & getDagManager () const
 
- Public Member Functions inherited from PHX::EvaluationContainerBase< Traits >
virtual void writeGraphvizFile (const std::string filename, bool writeEvaluatedFields, bool writeDependentFields, bool debugRegisteredEvaluators) const
 

Protected Member Functions

void assignSharedFields ()
 

Protected Attributes

bool post_registration_setup_called_
 
std::unordered_map
< std::string, PHX::any
fields_
 
std::unordered_map
< std::string, PHX::any
unmanaged_fields_
 
std::unordered_map
< std::string, std::string > 
aliased_fields_
 
std::unordered_map
< std::string, std::pair
< Teuchos::RCP< PHX::FieldTag >
, std::string > > 
shared_fields_
 
std::vector< PHX::index_size_type > kokkos_extended_data_type_dimensions_
 
bool build_device_dag_
 
bool minimize_dag_memory_use_
 
std::shared_ptr
< PHX::MemoryManager
memory_manager_
 
std::unordered_map
< std::string, std::size_t > 
field_allocation_sizes_
 Size in bytes of view allocation. This includes padding if the view supports/requires it.
 
std::vector< std::pair
< std::size_t, Teuchos::RCP
< PHX::FieldTag > > > 
fields_to_allocate_
 
- Protected Attributes inherited from PHX::EvaluationContainerBase< Traits >
PHX::DagManager< Traits > dag_manager_
 

Detailed Description

template<typename EvalT, typename Traits>
class PHX::EvaluationContainer< EvalT, Traits >

Container that holds all data associated with an evaluation type.

Handles allocation and binding of all field memory.

Member Function Documentation

template<typename EvalT , typename Traits >
void PHX::EvaluationContainer< EvalT, Traits >::buildDag ( )

Build the DAG. This is automatically called by the postRegistrationSetup() method. This function is a power user feature that allows for cases where the user would like to build the dag and query it to use information from the DAG prior to allocating and binding the memory to fields.

template<typename EvalT , typename Traits >
const PHX::DagManager< Traits > & PHX::EvaluationContainer< EvalT, Traits >::getDagManager ( ) const

Returns the underlying DAGManager. Used for queries, debugging and unit testing.

template<typename EvalT , typename Traits >
const std::vector< Teuchos::RCP< PHX::FieldTag > > & PHX::EvaluationContainer< EvalT, Traits >::getFieldTags ( )

Returns the FieldTags for all fields involved in the evaluation. Will return an empty vector unless the user has built the DAG using one of the following calls: postRegistrationSetup(), postRegistrationSetupForType() or buildDagForType().

WARNING: This is a dangerous power user feature. It returns non-const field tags so that the fields can be sized after the DAG has been created.

template<typename EvalT , typename Traits >
void PHX::EvaluationContainer< EvalT, Traits >::printEvaluatorStartStopMessage ( const Teuchos::RCP< std::ostream > &  ostr)

Print to user specified ostream when each evaluator starts and stops. Useful for debugging. Enabled only in debug builds.

Parameters
[in]ostrRCP to output stream. If set to null, this disables printing.
template<typename EvalT , typename Traits >
void PHX::EvaluationContainer< EvalT, Traits >::setUnmanagedField ( const PHX::FieldTag f,
const PHX::any a,
const bool  cleanup_output = true 
)

Set the memory for an unmanaged field.

NOTE: If this method is called after postRegistrationSetup(), the field might be reported as shared when priting even though it is no longer shared (now points to user supplied memory). Output from DAG may be incorrect. Searching the field lists for potential sharing wastes time as this function may be called in the middle of an evaluation, so we will not clean up output or add this to the unmanaged field list unless the user explicitly asks for this cleanup to happen. Execution will always be correct.

References PHX::FieldTag::identifier().

Member Data Documentation

template<typename EvalT , typename Traits >
std::unordered_map<std::string,std::pair<Teuchos::RCP<PHX::FieldTag>,std::string> > PHX::EvaluationContainer< EvalT, Traits >::shared_fields_
protected

Shared fields are fields where their use range in the topological sort of the dag does not overlap. Therefore, the fields can share the same memory allocation tracker. The key is the identifier for the field that will not be allocated since it will use another field's memory. The value is a pair where first is an RCP to the shared field tag, and second is the field string identifier whose memory the shared field will point to.


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