AQUAgpusph 4.1.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions
Aqua::CalcServer::Kernel Class Reference

A tool consisting in an OpenCL kernel execution. The variables used in the OpenCL kernel are automatically detected. More...

#include <CalcServer/Kernel.h>

Inheritance diagram for Aqua::CalcServer::Kernel:
Inheritance graph
[legend]
Collaboration diagram for Aqua::CalcServer::Kernel:
Collaboration graph
[legend]

Public Member Functions

 Kernel (const std::string tool_name, const std::string kernel_path, const std::string entry_point="entry", const std::string n="N", bool once=false)
 
virtual ~Kernel ()
 
void setup ()
 
const std::string path ()
 
size_t workGroupSize () const
 
size_t globalWorkSize () const
 
- Public Member Functions inherited from Aqua::CalcServer::Tool
 Tool (const std::string tool_name, bool once=false)
 
virtual ~Tool ()
 
void name (const std::string tool_name)
 
const std::string name ()
 
virtual void setup ()
 
virtual void execute ()
 Execute the tool measuring the elapsed time.
 
virtual Toolnext_tool ()
 
size_t allocatedMemory () const
 
unsigned int used_times () const
 
float elapsedTime (bool averaged=true) const
 
float elapsedTimeVariance () const
 
float elapsedTimeDeviation () const
 
virtual const int scope_modifier ()
 

Protected Member Functions

cl_event _execute (const std::vector< cl_event > events)
 
void make (const std::string entry_point="entry", const std::string flags="", const std::string header="")
 
void variables (const std::string entry_point="main")
 
void setVariables ()
 Set the variables to the OpenCL kernel.
 
void computeGlobalWorkSize ()
 
- Protected Member Functions inherited from Aqua::CalcServer::Tool
int id_in_pipeline ()
 
void next_tool (Tool *tool)
 
void allocatedMemory (size_t mem_size)
 
virtual cl_event _execute (const std::vector< cl_event > events)
 
void addElapsedTime (float elapsed_time)
 Add new data to the average and squared elapsed times.
 
void setDependencies (std::vector< std::string > var_names)
 Set the depedencies of the tool.
 
void setDependencies (std::vector< InputOutput::Variable * > vars)
 Set the depedencies of the tool.
 
const std::vector< InputOutput::Variable * > getDependencies ()
 Get the depedencies of the tool.
 

Additional Inherited Members

- Static Protected Member Functions inherited from Aqua::CalcServer::Tool
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.
 

Detailed Description

A tool consisting in an OpenCL kernel execution. The variables used in the OpenCL kernel are automatically detected.

Constructor & Destructor Documentation

◆ Kernel()

Aqua::CalcServer::Kernel::Kernel ( const std::string  tool_name,
const std::string  kernel_path,
const std::string  entry_point = "entry",
const std::string  n = "N",
bool  once = false 
)

Constructor.

Parameters
tool_nameTool name.
kernel_pathKernel path.
nNumber of threads to launch.
onceRun this tool just once. Useful to make initializations.

◆ ~Kernel()

Aqua::CalcServer::Kernel::~Kernel ( )
virtual

Destructor

Member Function Documentation

◆ _execute()

cl_event Aqua::CalcServer::Kernel::_execute ( const std::vector< cl_event >  events)
protectedvirtual

Execute the tool

Parameters
eventsList of events that shall be waited before safe execution
Returns
OpenCL event to be waited before accessing the dependencies

Reimplemented from Aqua::CalcServer::Tool.

Here is the call graph for this function:

◆ computeGlobalWorkSize()

void Aqua::CalcServer::Kernel::computeGlobalWorkSize ( )
protected

Compute the global work size

Here is the call graph for this function:

◆ globalWorkSize()

size_t Aqua::CalcServer::Kernel::globalWorkSize ( ) const
inline

Get the work group size

Returns
Work group size

◆ make()

void Aqua::CalcServer::Kernel::make ( const std::string  entry_point = "entry",
const std::string  flags = "",
const std::string  header = "" 
)
protected

Compile the OpenCL program

Parameters
entry_pointProgram entry point method.
flagsCompiling additional flags.
headerHeader to be append at the start of the source code.
Returns
false if all gone right, true otherwise.
Here is the call graph for this function:

◆ path()

const std::string Aqua::CalcServer::Kernel::path ( )
inline

Get the kernel file path.

Returns
Tool kernel file path.

◆ setup()

void Aqua::CalcServer::Kernel::setup ( )
virtual

Initialize the tool.

Returns
false if all gone right, true otherwise.

Reimplemented from Aqua::CalcServer::Tool.

Here is the call graph for this function:

◆ setVariables()

void Aqua::CalcServer::Kernel::setVariables ( )
protected

Set the variables to the OpenCL kernel.

The method detects if a variable should be updated or if it already set either.

Here is the call graph for this function:

◆ variables()

void Aqua::CalcServer::Kernel::variables ( const std::string  entry_point = "main")
protected

Compute the variables required by the program

Parameters
entry_pointProgram entry point method.
Returns
false if all gone right, true otherwise.
Here is the call graph for this function:

◆ workGroupSize()

size_t Aqua::CalcServer::Kernel::workGroupSize ( ) const
inline

Get the work group size

Returns
Work group size

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