25#ifndef TOOL_H_INCLUDED
26#define TOOL_H_INCLUDED
38#ifndef N_PROFILE_SAMPLES
39#define N_PROFILE_SAMPLES 100
66 inline void name(
const std::string tool_name) { _name = tool_name; };
71 inline const std::string
name()
const {
return _name; }
110 void sample(cl_ulong start, cl_ulong end);
139 for (
auto i : _instances)
146 inline std::vector<Profile*>
substages()
const {
return _instances; }
154 _instances = instances;
159 std::vector<Profile*> _instances;
182 Tool(
const std::string tool_name,
bool once =
false);
190 virtual void setup();
242 void addElapsedTime(
float elapsed_time);
252 return _elapsed_time;
253 return _average_elapsed_time;
261 return _squared_elapsed_time - pow(_average_elapsed_time, 2);
303 inline std::tuple<std::vector<InputOutput::Variable*>,
304 std::vector<InputOutput::Variable*>>
307 return { _in_vars, _out_vars };
315 inline cl_event
getEvent()
const {
return _event; }
331 int id_in_pipeline()
const;
373 std::vector<std::string> outputs)
375 _in_vars = namesToVars(inputs);
376 _out_vars = namesToVars(outputs);
388 std::vector<InputOutput::Variable*> outputs)
403 std::vector<std::string> inputs;
416 _in_vars = namesToVars(vars);
440 _out_vars = namesToVars(vars);
464 std::vector<InputOutput::Variable*> inputs;
480 const std::vector<cl_event> getEvents(
481 dep_events which = dep_events::all)
const;
499 static std::vector<cl_kernel> compile(
const std::string source,
500 const std::vector<std::string> names,
501 const std::string flags =
"");
519 static cl_kernel compile_kernel(
const std::string source,
520 const std::string kernel_name,
521 const std::string flags =
"");
529 std::vector<InputOutput::Variable*> namesToVars(
530 const std::vector<std::string>& names)
const;
542 size_t _allocated_memory;
551 float _average_elapsed_time;
554 float _squared_elapsed_time;
557 std::vector<InputOutput::Variable*> _in_vars;
560 std::vector<InputOutput::Variable*> _out_vars;
Set of auxiliar functions.
Virtual variables environment to allow the user define/manipulate the variables used in the simulatio...
A helper class for named objects.
Definition Tool.hpp:49
void name(const std::string tool_name)
Definition Tool.hpp:66
Named(const std::string name)
Definition Tool.hpp:54
~Named()
Definition Tool.hpp:61
const std::string name() const
Get the name.
Definition Tool.hpp:71
void step()
Get the step from the Aqua::CalcServer::CalcServer.
Definition Tool.cpp:36
Profile(const std::string name, Tool *tool)
Constructor.
Definition Tool.hpp:90
void sample(cl_ulong start, cl_ulong end)
Add profiling info.
Definition Tool.cpp:43
virtual ~Profile()
Destructor.
Definition Tool.hpp:99
Profiling base class.
Definition Tool.hpp:128
void substages(std::vector< Profile * > instances)
Set the tool substages.
Definition Tool.hpp:152
std::vector< Profile * > substages() const
Get the substages.
Definition Tool.hpp:146
~Profiler()
Definition Tool.hpp:137
Profiler()
Definition Tool.hpp:133
Main AQUAgpusph namespace.
Definition ArgumentsManager.cpp:50
Set of definitions and macros related with the implementation.
#define UNUSED_PARAM
Definition sphPrerequisites.hpp:391
#define DECLDIR
Prefix to export C functions on the compiled library.
Definition sphPrerequisites.hpp:65