AQUAgpusph 5.0.4
|
Tools base class. More...
#include <Tool.hpp>
Public Member Functions | |
Tool (const std::string tool_name, bool once=false) | |
virtual | ~Tool () |
virtual void | setup () |
virtual void | execute () |
Execute the tool measuring the elapsed time. | |
virtual Tool * | next_tool () |
Tool * | prev_tool () const |
void | prev_tool (Tool *tool) |
size_t | allocatedMemory () const |
unsigned int | used_times () const |
void | addElapsedTime (float elapsed_time) |
Add new data to the average and squared elapsed times. | |
float | elapsedTime (bool averaged=true) const |
float | elapsedTimeVariance () const |
float | elapsedTimeDeviation () const |
virtual int | scope_modifier () const |
std::vector< InputOutput::Variable * > | getInputDependencies () const |
Get the input depedencies of the tool. | |
std::vector< InputOutput::Variable * > | getOutputDependencies () const |
Get the output depedencies of the tool. | |
std::tuple< std::vector< InputOutput::Variable * >, std::vector< InputOutput::Variable * > > | getDependencies () const |
Get the depedencies of the tool. | |
cl_event | getEvent () const |
Get the tool event. | |
void | parent (Tool *tool) |
Set the tool parent. | |
Tool * | parent () |
Get the tool parent. | |
Public Member Functions inherited from Aqua::CalcServer::Named | |
Named (const std::string name) | |
~Named () | |
void | name (const std::string tool_name) |
const std::string | name () const |
Get the name. | |
Public Member Functions inherited from Aqua::CalcServer::Profiler | |
Profiler () | |
~Profiler () | |
std::vector< Profile * > | substages () const |
Get the substages. |
Protected Types | |
enum | dep_events { in = 0x01 , out = 0x02 , all = 0x03 } |
Protected Member Functions | |
int | id_in_pipeline () const |
std::string | varPrefix () const |
Produce a variable name prefix. | |
void | next_tool (Tool *tool) |
void | allocatedMemory (size_t mem_size) |
virtual cl_event | _execute (const UNUSED_PARAM std::vector< cl_event > events) |
void | setDependencies (std::vector< std::string > inputs, std::vector< std::string > outputs) |
Set the depedencies of the tool. | |
void | setDependencies (std::vector< InputOutput::Variable * > inputs, std::vector< InputOutput::Variable * > outputs) |
Set the depedencies of the tool. | |
void | setDependencies (std::vector< std::string > vars) |
Set the depedencies of the tool. | |
void | setInputDependencies (std::vector< std::string > vars) |
Set the reading depedencies of the tool. | |
void | setInputDependencies (std::vector< InputOutput::Variable * > vars) |
Set the reading depedencies of the tool. | |
void | setOutputDependencies (std::vector< std::string > vars) |
Set the writing depedencies of the tool. | |
void | setOutputDependencies (std::vector< InputOutput::Variable * > vars) |
Set the writing depedencies of the tool. | |
void | setDependencies (std::vector< InputOutput::Variable * > vars) |
Set the depedencies of the tool. | |
const std::vector< cl_event > | getEvents (dep_events which=dep_events::all) const |
Get the list of events that this tool shall wait for. | |
Protected Member Functions inherited from Aqua::CalcServer::Profiler | |
void | substages (std::vector< Profile * > instances) |
Set the tool substages. |
Static Protected Member Functions | |
static std::vector< cl_kernel > | compile (const std::string source, const std::vector< std::string > names, const std::string flags="") |
Compile an OpenCL source code and generate the corresponding kernel. | |
static cl_kernel | compile_kernel (const std::string source, const std::string kernel_name, const std::string flags="") |
Compile an OpenCL source code and generate the corresponding kernel. |
Tools base class.
The way that AQUAgpusph compute each problem is set through a set of tools that are computed sequentially. Several tools can be considered, for instance:
|
protected |
Aqua::CalcServer::Tool::Tool | ( | const std::string | tool_name, |
bool | once = false ) |
Constructor.
tool_name | Name of the tool. Useful to identify errors. |
once | Run this tool just once. Useful to make initializations. |
|
virtual |
Destructor
|
inlineprotectedvirtual |
Execute the tool
events | List of events that shall be waited before safe execution |
void Aqua::CalcServer::Tool::addElapsedTime | ( | float | elapsed_time | ) |
Add new data to the average and squared elapsed times.
elapsed_time | Elapsed time |
|
inline |
Get the allocated memory for this tool.
|
inlineprotected |
Set the allocated memory for this tool.
mem_size | allocated memory by this tool. |
|
staticprotected |
Compile an OpenCL source code and generate the corresponding kernel.
With this method several operations are carried out at the same time. First the program is compiled and linked. Afterwards, the required kernels are extracted, and the program object is released
source | Source code to be compiled |
names | Function names to be extracted in the kernel |
flags | Additional compilation flags. Some flags are used by default:
|
|
staticprotected |
Compile an OpenCL source code and generate the corresponding kernel.
With this method several operations are carried out at the same time. First the program is compiled and linked. Afterwards, the required kernel is extracted, and the program object is released
source | Source code to be compiled |
kernel_name | Function name to be extracted in the kernel |
flags | Additional compilation flags. Some flags are used by default:
|
|
inline |
Get the time consumed by the tool.
averaged | true if the avergaed time step is required, false otherwise. |
|
inline |
Get the time consumed standard deviation.
|
inline |
Get the time consumed variance.
|
virtual |
Execute the tool measuring the elapsed time.
Actually this method is just ensuring that the tool can be executed, e.g. the tool has been already executed, but it is asked to be ran just once. If the tool can be executed, then _execute() method is called, measuring the time required to carry out the task.
|
inline |
Get the depedencies of the tool.
|
inline |
Get the tool event.
That event will mark when the tool has already finished
|
protected |
Get the list of events that this tool shall wait for.
|
inline |
Get the input depedencies of the tool.
|
inline |
Get the output depedencies of the tool.
|
protected |
Get the tool index in the pipeline
|
inlinevirtual |
Get the next tool to be executed in the pipeline.
Such tool is usually just the next one in the linearized tools chain. However, conditional tools may alter the flow
Reimplemented in Aqua::CalcServer::Conditional, and Aqua::CalcServer::If.
|
inlineprotected |
Set the next tool to be executed in the pipeline.
tool | Next tool to be executed. NULL if this is the last tool of the pipeline |
|
inline |
Get the tool parent.
|
inline |
Set the tool parent.
tool | Parent tool. It can be NULL to set a top level tool |
|
inline |
Get the previous tool executed in the pipeline.
CalcServer::CalcServer will provide with this information.
|
inline |
Set the previous tool executed in the pipeline.
CalcServer::CalcServer will provide with this information.
tool | Previous enqueued tool. |
|
inlinevirtual |
Get the scope modifier
Scopes can be used to create groups of tools that can be eventually enabled/disabled in runtime. This is sueful to create conditions.
Reimplemented in Aqua::CalcServer::Conditional, and Aqua::CalcServer::End.
|
inlineprotected |
Set the depedencies of the tool.
The dependencies are the variables that this tool is either reading or writing.
inputs | Input variables |
outputs | Output variables |
|
inlineprotected |
Set the depedencies of the tool.
The dependencies are the variables that this tool is either reading or writing.
vars | Output variables |
|
inlineprotected |
Set the depedencies of the tool.
The dependencies are the variables that this tool is either reading or writing.
inputs | Names of the input variables |
outputs | Names of the output variables |
|
inlineprotected |
Set the depedencies of the tool.
The dependencies are the variables that this tool is either reading or writing.
vars | Output variable names |
|
inlineprotected |
Set the reading depedencies of the tool.
The dependencies are the variables that this tool is either reading or writing.
inputs | Input variables |
|
inlineprotected |
Set the reading depedencies of the tool.
The dependencies are the variables that this tool is either reading or writing.
inputs | Names of the input variables |
|
inlineprotected |
Set the writing depedencies of the tool.
The dependencies are the variables that this tool is either reading or writing.
inputs | Output variables |
|
inlineprotected |
Set the writing depedencies of the tool.
The dependencies are the variables that this tool is either reading or writing.
inputs | Names of the output variables |
|
virtual |
Initialize the tool.
Reimplemented in Aqua::CalcServer::Conditional, Aqua::CalcServer::Copy, Aqua::CalcServer::End, Aqua::CalcServer::Kernel, Aqua::CalcServer::LinkList, Aqua::CalcServer::MPISync, Aqua::CalcServer::Python, Aqua::CalcServer::RadixSort, Aqua::CalcServer::Reduction, Aqua::CalcServer::Reports::Dump, Aqua::CalcServer::Reports::Performance, Aqua::CalcServer::Reports::Report, Aqua::CalcServer::Reports::Screen, Aqua::CalcServer::Reports::SetTabFile, Aqua::CalcServer::Reports::TabFile, Aqua::CalcServer::ScalarExpression, Aqua::CalcServer::Set, Aqua::CalcServer::SetScalar, Aqua::CalcServer::Sort, and Aqua::CalcServer::UnSort.
|
inline |
Get the number of times that this tool has been called.
|
inlineprotected |
Produce a variable name prefix.
The prefix produced is unique for each instance of this class, granting that the variable will have a unique name, as long as the same name is not used elsewhere on the same class