24#ifndef KERNEL_H_INCLUDED
25#define KERNEL_H_INCLUDED
72 void start(cl_event event);
77 void end(cl_event event);
113 std::vector<InputOutput::Variable*> vars);
127 inline std::vector<InputOutput::Variable*>
getVars()
const {
return _vars; }
132 inline std::vector<Arg>
getArgs()
const {
return _args; }
149 std::vector<InputOutput::Variable*> _vars;
152 std::vector<Arg> _args;
194 inline size_t size()
const {
return _size; }
199 inline const void*
value()
const {
return _value; }
204 inline cl_event
event()
const {
return _event; }
220 return !(*
this == var);
243 std::stringstream msg;
244 msg <<
"From variable " << var->
name() << std::endl;
257 inline void set(
const size_t s,
const void* v,
const cl_event e)
263 _value = malloc(_size);
265 std::stringstream msg;
266 msg <<
"Failure allocating " << _size <<
" bytes" << std::endl;
268 throw std::bad_alloc();
271 memcpy(_value, v, s);
300 Kernel(
const std::string tool_name,
301 const std::string kernel_path,
302 const std::string entry_point =
"entry",
303 const std::string n =
"",
318 const std::string
path() {
return (
const std::string)_path; }
335 cl_event
_execute(
const std::vector<cl_event> events);
343 void make(
const std::string entry_point =
"entry",
344 const std::string flags =
"",
345 const std::string header =
"");
361 std::string _entry_point;
370 size_t _work_group_size;
373 size_t _global_work_size;
376 std::vector<InputOutput::Variable*> _vars;
#define LOG0(level, log)
Definition Logger.hpp:64
#define LOG(level, log)
Definition Logger.hpp:55
Definition Kernel.hpp:163
const void * value() const
Get the value of the argument.
Definition Kernel.hpp:199
size_t size() const
Get the size of the argument.
Definition Kernel.hpp:194
Arg()
Constructor.
Definition Kernel.hpp:166
bool operator!=(InputOutput::Variable *var)
Check whether the content of a variable is the same than this argument.
Definition Kernel.hpp:218
Arg(const Arg &arg)
Copy Constructor.
Definition Kernel.hpp:176
void operator=(const Arg &arg)
Copy other argument.
Definition Kernel.hpp:227
void set(const size_t s, const void *v, const cl_event e)
Set the argument.
Definition Kernel.hpp:257
~Arg()
Destructor.
Definition Kernel.hpp:185
bool operator==(InputOutput::Variable *var)
Check whether the content of a variable is the same than this argument.
Definition Kernel.cpp:195
cl_event event() const
Get the last recorded writing event.
Definition Kernel.hpp:204
void operator=(InputOutput::Variable *var)
Copy the variable content on the argument.
Definition Kernel.hpp:236
void execute()
Set the kernel arguments.
Definition Kernel.cpp:168
std::vector< InputOutput::Variable * > getVars() const
Get the list of variables to be set.
Definition Kernel.hpp:127
~ArgSetter()
Definition Kernel.hpp:117
std::vector< Arg > getArgs() const
Get the list of variables to be set.
Definition Kernel.hpp:132
cl_kernel getKernel() const
Get the OpenCL kernel.
Definition Kernel.hpp:122
ArgSetter(const std::string name, cl_kernel kernel, std::vector< InputOutput::Variable * > vars)
Definition Kernel.cpp:118
~EventProfile()
Definition Kernel.hpp:67
EventProfile(const std::string name, Tool *tool)
Definition Kernel.hpp:60
void end(cl_event event)
Ending event.
Definition Kernel.cpp:65
void sample()
Compute the time stamps.
Definition Kernel.cpp:86
void start(cl_event event)
Starting event.
Definition Kernel.cpp:49
void variables()
Definition Kernel.cpp:498
size_t workGroupSize() const
Definition Kernel.hpp:323
cl_event _execute(const std::vector< cl_event > events)
Definition Kernel.cpp:325
void make(const std::string entry_point="entry", const std::string flags="", const std::string header="")
Definition Kernel.cpp:355
size_t globalWorkSize() const
Definition Kernel.hpp:328
const std::string path()
Definition Kernel.hpp:318
void computeGlobalWorkSize()
Definition Kernel.cpp:559
void setup()
Definition Kernel.cpp:302
Kernel(const std::string tool_name, const std::string kernel_path, const std::string entry_point="entry", const std::string n="", bool once=false)
Definition Kernel.cpp:276
virtual ~Kernel()
Definition Kernel.cpp:293
A helper class for named objects.
Definition Tool.hpp:49
void name(const std::string tool_name)
Definition Tool.hpp:66
Profiler subinstance base class.
Definition Tool.hpp:84
Profile(const std::string name, Tool *tool)
Constructor.
Definition Tool.hpp:90
cl_event getWritingEvent() const
Alias of InputOutput::Variable::getEvent()
Definition Variable.hpp:219
Calculation server name space.
Definition Assert.cpp:32
void sync_user_event(cl_event user_event, cl_event event)
Synchronize an user event with another OpenCL event.
Definition Kernel.cpp:247
Main AQUAgpusph namespace.
Definition ArgumentsManager.cpp:50
@ L_ERROR
Definition Logger.hpp:75
@ L_DEBUG
Definition Logger.hpp:72
Set of definitions and macros related with the implementation.