KIDS  ver-0.0.1
KIDS : Kernel Integrated Dynamics Simulator
Loading...
Searching...
No Matches
PROJECT_NS::Kernel_Dump_DataSet Class Reference

this class implements a process for dumping current data with stuctured format More...

#include <Kernel_Dump_DataSet.h>

Inheritance diagram for PROJECT_NS::Kernel_Dump_DataSet:
Inheritance graph
Collaboration diagram for PROJECT_NS::Kernel_Dump_DataSet:
Collaboration graph

Public Member Functions

virtual const std::string getName ()
 Get the name of the kernel.
 
virtual int getType () const
 Get the type of the kernel.
 
void setInputParam (std::shared_ptr< Param > &PM)
 Set input parameters for the kernel and its children.
 
void setInputDataSet (std::shared_ptr< DataSet > &DS)
 Set input data set for the kernel and its children.
 
std::shared_ptr< ParamgetParam () const
 Get the parameter associated with the kernel.
 
std::shared_ptr< DataSetgetDataSet () const
 Get the data set associated with the kernel.
 
StatusinitializeKernel (Status &stat)
 Prepare initial conditions for the kernel and its children.
 
StatusexecuteKernel (Status &stat)
 Execute the kernel's algorithm and those of its children.
 
StatusfinalizeKernel (Status &stat)
 Finalize the kernel and its children, performing any necessary cleanup.
 
int getID () const
 Get the ID of the kernel.
 
bool operator== (const Kernel &ker)
 Overloaded equality operator to compare two Kernel objects by their IDs.
 
KernelappendChild (std::shared_ptr< Kernel > ker)
 Append a kernel as the last child of the current tree node.
 
KernelinsertAt (std::vector< std::size_t > indexes, std::shared_ptr< Kernel > ker)
 Insert a kernel at specified indexes in the tree.
 
KernelremoveAt (std::vector< std::size_t > indexes)
 Remove kernels at specified indexes from the tree.
 
KernelupdateAt (std::vector< std::size_t > indexes, std::shared_ptr< Kernel > ker)
 Update the kernel at specified indexes in the tree.
 
std::tuple< Kernel *, std::size_t > getLastParentKernelAndChildOrder ()
 Retrieve the last parent kernel along with the order of its child kernels, if available.
 
std::shared_ptr< RuleSetgetRuleSet ()
 Get RuleSet associated with the Kernel.
 
const std::string generateInformationString (double total_time=-1.0f, int current_layer=0, int total_depth=0, int total_align_size=0)
 Generate a formatted string containing information about the kernel.
 

Static Public Member Functions

static int dump (Kernel *ker)
 
static int report (Kernel *ker)
 
static int mpi_reduce_info (Kernel *ker)
 
static const std::string serializeKernel (const Kernel &ker)
 Serialize a Kernel object into a string representation.
 
static std::shared_ptr< KerneldeserializeKernel (const std::string &str)
 Deserialize a string representation into a Kernel object.
 

Protected Member Functions

virtual void setInputDataSet_impl (std::shared_ptr< DataSet > &DS)
 Virtual function to set input data set for the kernel implementation.
 
virtual StatusfinalizeKernel_impl (Status &stat)
 Virtual function to finalize the kernel implementation.
 

Protected Attributes

bool is_timing = false
 Flag indicating whether timing is enabled for this kernel.
 
bool has_parent = false
 Flag indicating whether the kernel has a parent.
 
int count_calc = 0
 Counter for the number of calculations performed by this kernel.
 
int count_exec = 0
 Counter for the number of executions performed by this kernel.
 
int kernel_id = 0
 ID of the kernel.
 
int kernel_type = 0
 Type of the kernel.
 
double exec_time = 0.0f
 Total execution time of the kernel.
 
int depth = 0
 Depth of the kernel in the tree structure.
 
int max_align_size = 0
 Maximum alignment size used by this kernel.
 
std::string kernel_name
 Name of the kernel.
 
std::shared_ptr< Param_param
 Shared pointer to the Param object associated with this kernel.
 
std::shared_ptr< DataSet_dataset
 Shared pointer to the DataSet object associated with this kernel.
 
std::shared_ptr< RuleSet_ruleset
 Recorded Rules associated with the Kernel.
 
Kernel_parent_kernel
 Pointer to the parent kernel.
 
std::size_t _order_in_parent
 Order of this kernel in its parent's children.
 
std::vector< std::shared_ptr< Kernel > > _child_kernels
 Vector containing shared pointers to the child kernels of this kernel.
 
std::vector< std::shared_ptr< Kernel > > _all_kernels
 Vector containing shared pointers to all descendant kernels of this kernel.
 

Private Member Functions

virtual void setInputParam_impl (std::shared_ptr< Param > &PM)
 Virtual function to set input parameters for the kernel implementation.
 
virtual StatusinitializeKernel_impl (Status &stat)
 Virtual function to initialize the kernel implementation.
 
virtual StatusexecuteKernel_impl (Status &stat)
 Virtual function to execute the kernel implementation.
 
void connectRelatedKernels (std::shared_ptr< Kernel > &ker)
 Connect related kernels to this kernel.
 

Static Private Member Functions

static std::map< std::string, Kernel * > & getDictOfKernels ()
 Get the dictionary of kernels (mapping from names to kernel pointers).
 
static std::vector< Kernel * > & getKernels ()
 Get the vector of all kernel pointers.
 

Private Attributes

std::string directory
 path for dumping
 
std::string fn
 filename (stamp) for dumping
 
std::string hdlr_str
 handler type specifier
 

Detailed Description

this class implements a process for dumping current data with stuctured format

Definition at line 35 of file Kernel_Dump_DataSet.h.

Member Function Documentation

◆ appendChild()

Kernel & Kernel::appendChild ( std::shared_ptr< Kernel > ker)
inherited

Append a kernel as the last child of the current tree node.

Parameters
kerThe kernel to append as the last child.
Returns
Reference to the modified kernel.

Definition at line 78 of file Kernel.cpp.

References PROJECT_NS::Kernel::_child_kernels, PROJECT_NS::Kernel::_order_in_parent, PROJECT_NS::Kernel::_ruleset, PROJECT_NS::Kernel::depth, PROJECT_NS::Kernel::getLastParentKernelAndChildOrder(), and PROJECT_NS::Kernel::max_align_size.

Referenced by PROJECT_NS::Kernel_Elec_NAD::Kernel_Elec_NAD(), PROJECT_NS::Kernel_Elec_Switch::Kernel_Elec_Switch(), PROJECT_NS::Kernel_GWP::Kernel_GWP(), PROJECT_NS::Model_ElectronTransfer::Model_ElectronTransfer(), and PROJECT_NS::Model_SystemBath::Model_SystemBath().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ connectRelatedKernels()

void Kernel::connectRelatedKernels ( std::shared_ptr< Kernel > & ker)
privateinherited

Connect related kernels to this kernel.

This function connects related kernels to the current kernel. Related kernels are kernels that are associated with or connected to this kernel in some way.

Note
The exact definition of "related kernels" may vary depending on the context and application.

Definition at line 228 of file Kernel.cpp.

References PROJECT_NS::Kernel::_all_kernels, and PROJECT_NS::Kernel::connectRelatedKernels().

Referenced by PROJECT_NS::Kernel::connectRelatedKernels().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deserializeKernel()

std::shared_ptr< Kernel > Kernel::deserializeKernel ( const std::string & str)
staticinherited

Deserialize a string representation into a Kernel object.

Parameters
strThe string containing the serialized Kernel object.
Returns
A shared pointer to the deserialized Kernel object.

Definition at line 187 of file Kernel.cpp.

◆ dump()

static int PROJECT_NS::Kernel::dump ( Kernel * ker)
inlinestaticinherited

Definition at line 71 of file Kernel.h.

◆ executeKernel()

◆ executeKernel_impl()

Status & PROJECT_NS::Kernel_Dump_DataSet::executeKernel_impl ( Status & stat)
privatevirtual

Virtual function to execute the kernel implementation.

Parameters
statStatus object to store execution status.
Returns
Status object after execution.

Reimplemented from PROJECT_NS::Kernel.

Definition at line 30 of file Kernel_Dump_DataSet.cpp.

References PROJECT_NS::Kernel::_dataset, utils::concat(), directory, fn, and PROJECT_NS::Status::icalc.

Here is the call graph for this function:

◆ finalizeKernel()

Status & Kernel::finalizeKernel ( Status & stat)
inherited

Finalize the kernel and its children, performing any necessary cleanup.

Parameters
statThe status object to store finalization status.
Returns
The status object after finalization.

Definition at line 66 of file Kernel.cpp.

References PROJECT_NS::Kernel::_child_kernels, and PROJECT_NS::Kernel::finalizeKernel_impl().

Here is the call graph for this function:

◆ finalizeKernel_impl()

Status & Kernel::finalizeKernel_impl ( Status & stat)
protectedvirtualinherited

Virtual function to finalize the kernel implementation.

Parameters
statStatus object to store finalization status.
Returns
Status object after finalization.

Reimplemented in PROJECT_NS::Kernel_Recorder.

Definition at line 226 of file Kernel.cpp.

Referenced by PROJECT_NS::Kernel::finalizeKernel().

Here is the caller graph for this function:

◆ generateInformationString()

const std::string Kernel::generateInformationString ( double total_time = -1.0f,
int current_layer = 0,
int total_depth = 0,
int total_align_size = 0 )
inherited

Generate a formatted string containing information about the kernel.

This function generates a formatted string containing information about the kernel, including its total time, current layer, total depth, and total alignment size.

Parameters
total_timeThe total time taken by the kernel (default: -1.0f).
current_layerThe current layer of the kernel (default: 0).
total_depthThe total depth of the kernel (default: 0).
total_align_sizeThe total alignment size of the kernel (default: 0).
Returns
A formatted string containing kernel information.

Definition at line 189 of file Kernel.cpp.

References PROJECT_NS::Kernel::_child_kernels, PROJECT_NS::Kernel::depth, PROJECT_NS::Kernel::exec_time, PROJECT_NS::Kernel::getName(), PROJECT_NS::Kernel::kernel_id, and PROJECT_NS::Kernel::max_align_size.

Here is the call graph for this function:

◆ getDataSet()

std::shared_ptr< DataSet > Kernel::getDataSet ( ) const
inherited

Get the data set associated with the kernel.

Returns
Shared pointer to the DataSet object.

Definition at line 37 of file Kernel.cpp.

References PROJECT_NS::Kernel::_dataset.

◆ getDictOfKernels()

static std::map< std::string, Kernel * > & PROJECT_NS::Kernel::getDictOfKernels ( )
staticprivateinherited

Get the dictionary of kernels (mapping from names to kernel pointers).

This function returns a reference to the static map containing the dictionary of kernels. The dictionary maps kernel names to their corresponding kernel pointers.

Returns
A reference to the dictionary of kernels.

◆ getID()

int Kernel::getID ( ) const
inherited

Get the ID of the kernel.

Returns
The ID of the kernel.

Definition at line 74 of file Kernel.cpp.

References PROJECT_NS::Kernel::kernel_id.

Referenced by PROJECT_NS::Kernel_Prioritization::getName(), and PROJECT_NS::Kernel::operator==().

Here is the caller graph for this function:

◆ getKernels()

std::vector< Kernel * > & Kernel::getKernels ( )
staticprivateinherited

Get the vector of all kernel pointers.

This function returns a reference to the static vector containing pointers to all kernels.

Returns
A reference to the vector of all kernel pointers.

Definition at line 247 of file Kernel.cpp.

Referenced by PROJECT_NS::Kernel::Kernel().

Here is the caller graph for this function:

◆ getLastParentKernelAndChildOrder()

std::tuple< Kernel *, std::size_t > Kernel::getLastParentKernelAndChildOrder ( )
inherited

Retrieve the last parent kernel along with the order of its child kernels, if available.

Returns
A tuple containing a pointer to the last parent kernel and the order of its child kernels.

Definition at line 178 of file Kernel.cpp.

References PROJECT_NS::Kernel::_order_in_parent, PROJECT_NS::Kernel::_parent_kernel, and PROJECT_NS::Kernel::has_parent.

Referenced by PROJECT_NS::Kernel::appendChild(), PROJECT_NS::Kernel::insertAt(), and PROJECT_NS::Kernel::updateAt().

Here is the caller graph for this function:

◆ getName()

const std::string PROJECT_NS::Kernel_Dump_DataSet::getName ( )
virtual

Get the name of the kernel.

Returns the concatenated name of the kernel, prefixed with "Kernel__".

Returns
The name of the kernel.

Reimplemented from PROJECT_NS::Kernel.

Definition at line 8 of file Kernel_Dump_DataSet.cpp.

◆ getParam()

std::shared_ptr< Param > Kernel::getParam ( ) const
inherited

Get the parameter associated with the kernel.

Returns
Shared pointer to the Param object.

Definition at line 35 of file Kernel.cpp.

References PROJECT_NS::Kernel::_param.

◆ getRuleSet()

std::shared_ptr< RuleSet > Kernel::getRuleSet ( )
inherited

Get RuleSet associated with the Kernel.

Returns
The RuleSet (name, dataPointer, datatype, size, stride).

Definition at line 183 of file Kernel.cpp.

References PROJECT_NS::Kernel::_ruleset.

◆ getType()

int PROJECT_NS::Kernel_Dump_DataSet::getType ( ) const
virtual

Get the type of the kernel.

This function returns the type of the kernel.

Note
This function should be implemented in derived classes to return the specific type of the kernel.
Returns
The type of the kernel.

Reimplemented from PROJECT_NS::Kernel.

Definition at line 10 of file Kernel_Dump_DataSet.cpp.

References FUNCTION_NAME, and utils::hash().

Here is the call graph for this function:

◆ initializeKernel()

Status & Kernel::initializeKernel ( Status & stat)
inherited

Prepare initial conditions for the kernel and its children.

Parameters
statThe status object to store initialization status.
Returns
The status object after initialization.

Definition at line 39 of file Kernel.cpp.

References PROJECT_NS::Kernel::_child_kernels, PROJECT_NS::Kernel::_dataset, PROJECT_NS::Kernel::count_calc, and PROJECT_NS::Kernel::initializeKernel_impl().

Here is the call graph for this function:

◆ initializeKernel_impl()

Status & PROJECT_NS::Kernel_Dump_DataSet::initializeKernel_impl ( Status & stat)
privatevirtual

Virtual function to initialize the kernel implementation.

Parameters
statStatus object to store initialization status.
Returns
Status object after initialization.

Reimplemented from PROJECT_NS::Kernel.

Definition at line 19 of file Kernel_Dump_DataSet.cpp.

References PROJECT_NS::Kernel::_dataset, utils::concat(), directory, fn, hdlr_str, and PROJECT_NS::Status::icalc.

Here is the call graph for this function:

◆ insertAt()

Kernel & Kernel::insertAt ( std::vector< std::size_t > indexes,
std::shared_ptr< Kernel > ker )
inherited

Insert a kernel at specified indexes in the tree.

Parameters
indexesIndexes indicating the position to insert the kernel.
kerThe kernel to insert.
Returns
Reference to the modified kernel.

Definition at line 102 of file Kernel.cpp.

References PROJECT_NS::Kernel::_child_kernels, PROJECT_NS::Kernel::_ruleset, and PROJECT_NS::Kernel::getLastParentKernelAndChildOrder().

Here is the call graph for this function:

◆ mpi_reduce_info()

static int PROJECT_NS::Kernel::mpi_reduce_info ( Kernel * ker)
inlinestaticinherited

Definition at line 75 of file Kernel.h.

◆ operator==()

bool Kernel::operator== ( const Kernel & ker)
inherited

Overloaded equality operator to compare two Kernel objects by their IDs.

Parameters
kerThe Kernel object to compare with.
Returns
True if the IDs of the two kernels are equal, otherwise false.

Definition at line 76 of file Kernel.cpp.

References PROJECT_NS::Kernel::getID().

Here is the call graph for this function:

◆ removeAt()

Kernel & Kernel::removeAt ( std::vector< std::size_t > indexes)
inherited

Remove kernels at specified indexes from the tree.

Parameters
indexesIndexes indicating the kernels to remove.
Returns
Reference to the modified kernel.

Definition at line 128 of file Kernel.cpp.

References PROJECT_NS::Kernel::_child_kernels.

◆ report()

static int PROJECT_NS::Kernel::report ( Kernel * ker)
inlinestaticinherited

Definition at line 73 of file Kernel.h.

◆ serializeKernel()

const std::string Kernel::serializeKernel ( const Kernel & ker)
staticinherited

Serialize a Kernel object into a string representation.

Parameters
kerThe Kernel object to serialize.
Returns
A string representing the serialized Kernel object.

Definition at line 185 of file Kernel.cpp.

◆ setInputDataSet()

void Kernel::setInputDataSet ( std::shared_ptr< DataSet > & DS)
inherited

Set input data set for the kernel and its children.

Parameters
DSShared pointer to the DataSet object.

Definition at line 28 of file Kernel.cpp.

References PROJECT_NS::Kernel::_child_kernels, PROJECT_NS::Kernel::_dataset, PROJECT_NS::Kernel::_param, and PROJECT_NS::Kernel::setInputDataSet_impl().

Here is the call graph for this function:

◆ setInputDataSet_impl()

◆ setInputParam()

void Kernel::setInputParam ( std::shared_ptr< Param > & PM)
inherited

Set input parameters for the kernel and its children.

Parameters
PMShared pointer to the Param object.

Definition at line 21 of file Kernel.cpp.

References PROJECT_NS::Kernel::_child_kernels, PROJECT_NS::Kernel::_param, PROJECT_NS::Kernel::is_timing, LOC, and PROJECT_NS::Kernel::setInputParam_impl().

Here is the call graph for this function:

◆ setInputParam_impl()

void PROJECT_NS::Kernel_Dump_DataSet::setInputParam_impl ( std::shared_ptr< Param > & PM)
privatevirtual

Virtual function to set input parameters for the kernel implementation.

Parameters
PMShared pointer to the Param object containing input parameters.

Reimplemented from PROJECT_NS::Kernel.

Definition at line 12 of file Kernel_Dump_DataSet.cpp.

References directory, fn, hdlr_str, and LOC.

◆ updateAt()

Kernel & Kernel::updateAt ( std::vector< std::size_t > indexes,
std::shared_ptr< Kernel > ker )
inherited

Update the kernel at specified indexes in the tree.

build tree structure of the kernel

Parameters
indexesIndexes indicating the kernel to update.
kerThe kernel to update with.
Returns
Reference to the modified kernel.

Definition at line 147 of file Kernel.cpp.

References PROJECT_NS::Kernel::_child_kernels, PROJECT_NS::Kernel::_ruleset, and PROJECT_NS::Kernel::getLastParentKernelAndChildOrder().

Here is the call graph for this function:

Member Data Documentation

◆ _all_kernels

std::vector<std::shared_ptr<Kernel> > PROJECT_NS::Kernel::_all_kernels
protectedinherited

Vector containing shared pointers to all descendant kernels of this kernel.

Definition at line 303 of file Kernel.h.

Referenced by PROJECT_NS::Kernel::connectRelatedKernels().

◆ _child_kernels

◆ _dataset

◆ _order_in_parent

std::size_t PROJECT_NS::Kernel::_order_in_parent
protectedinherited

Order of this kernel in its parent's children.

Definition at line 293 of file Kernel.h.

Referenced by PROJECT_NS::Kernel::appendChild(), and PROJECT_NS::Kernel::getLastParentKernelAndChildOrder().

◆ _param

◆ _parent_kernel

Kernel* PROJECT_NS::Kernel::_parent_kernel
protectedinherited

Pointer to the parent kernel.

Definition at line 288 of file Kernel.h.

Referenced by PROJECT_NS::Kernel::getLastParentKernelAndChildOrder().

◆ _ruleset

◆ directory

std::string PROJECT_NS::Kernel_Dump_DataSet::directory
private

path for dumping

Definition at line 42 of file Kernel_Dump_DataSet.h.

Referenced by executeKernel_impl(), initializeKernel_impl(), and setInputParam_impl().

◆ fn

std::string PROJECT_NS::Kernel_Dump_DataSet::fn
private

filename (stamp) for dumping

Definition at line 43 of file Kernel_Dump_DataSet.h.

Referenced by executeKernel_impl(), initializeKernel_impl(), and setInputParam_impl().

◆ hdlr_str

std::string PROJECT_NS::Kernel_Dump_DataSet::hdlr_str
private

handler type specifier

Definition at line 44 of file Kernel_Dump_DataSet.h.

Referenced by initializeKernel_impl(), and setInputParam_impl().


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