AQUAgpusph 5.0.4
Loading...
Searching...
No Matches
Aqua::CalcServer Namespace Reference

Calculation server name space. More...

Namespaces

namespace  Reports
 Runtime outputs name space.

Data Structures

struct  _ProfilingSample
 Profiling sample. More...
struct  _ProfilingSnapshot
 Profiling snapshot. More...
class  ArgSetter
class  Assert
 Check that a condition holds true, or throw a fatal error otherwise. More...
class  CalcServer
 Entity that perform the main work of the simulation. More...
class  Conditional
 Base class for conditional tools like While or If. More...
class  Copy
 Copy an array component by component. More...
class  End
 Close the scope open by a previous conditional tool, like While or If. More...
class  EventProfile
 Profiler for tools based on OpenCL enqueued commands. More...
class  If
 Execute all the tools in its scope if the condition is fulfilled. More...
class  Kernel
 A tool consisting in an OpenCL kernel execution. The variables used in the OpenCL kernel are automatically detected. More...
 Complex tool to perform the link-list based on an array. This tool include the following steps: More...
class  MPISync
 Synchronize arrays between processes. More...
class  Named
 A helper class for named objects. More...
class  Profile
 Profiler subinstance base class. More...
class  Profiler
 Profiling base class. More...
class  ProfilingInfo
 A FIFO list of profiling snapshots. More...
class  Python
 Execute a Python script. More...
class  RadixSort
 Methods to perform a radix sort using the GPU (or any device supported by OpenCL). The code has 3 steps: More...
class  Reduction
 Reductions, like scans, prefix sums, maximum or minimum, etc... More...
class  ScalarExpression
 Base class for tools that has to evaluate a scalar expression. More...
class  ScalarProfile
 Profiler for tools based on scalar solvers. More...
class  Set
 Set all the components of an array with the desired value. More...
class  SetScalar
 Set a scalar variable. More...
class  Sort
 Methods to perform a vector sorting using the GPU (or any device supported by OpenCL). More...
class  Tool
 Tools base class. More...
class  UnSort
 Recover the original id of each particle. More...
class  user_interruption
 Exception raised when the user manually interrupts the simulation. More...
class  While
 Execute all the tools in its scope until the condition becomes unfulfilled. More...

Typedefs

typedef InputOutput::ProblemSetup::sphSettings::debug_opts debug_opts
typedef struct Aqua::CalcServer::_ProfilingSample ProfilingSample
 Profiling sample.
typedef struct Aqua::CalcServer::_ProfilingSnapshot ProfilingSnapshot
 Profiling snapshot.

Functions

void sigint_handler (int UNUSED_PARAM s)
 Handle SIGINT signals.
std::atomic< CalcServer * > g_calcserver_singleton_ptr (nullptr)
 Singleton instance of Aqua::CalcServer::CalcServer.
cl_command_queue create_command_queue (cl_context context, cl_device_id device, cl_int *errcode_ret)
 Create an OpenCL command queue.
std::tuple< unsigned int, unsigned int > opencl_version (std::string version)
 Get the OpenCL major and minor version from the string returned by clGetPlatformInfo() and clGetDeviceInfo()
std::tuple< unsigned int, unsigned int > opencl_version (cl_platform_id platform)
 Get the paltform's OpenCL major and minor version.
std::tuple< unsigned int, unsigned int > opencl_version (cl_device_id device)
 Get the device's OpenCL major and minor version.
std::string getDeviceInfoStr (cl_device_id device, cl_device_info param_name)
 Wrapper to clGetDeviceInfo() for strings related operations.
void CL_CALLBACK context_error_notify (const char *errinfo, const void UNUSED_PARAM *private_info, size_t UNUSED_PARAM cb, void *user_data)
 Runtime error reporting tool.
void CL_CALLBACK device_timer_sampler (cl_event event, cl_int UNUSED_PARAM event_command_status, void *user_data)
 Sample both the system clock and the devie timer to compute the offset.
void CL_CALLBACK event_profile_cb (cl_event UNUSED_PARAM n_event, cl_int UNUSED_PARAM cmd_exec_status, void *user_data)
 Callback called when the profiler ending event has finished.
void debug_arg (unsigned int i, InputOutput::Variable *var, cl_kernel kernel, TLogLevel log_level=L_DEBUG, const char *indent="\t\t")
 Auxiliar function to print information about arguments.
void CL_CALLBACK cbUserEventSync (cl_event n_event, cl_int cmd_exec_status, void *user_data)
 Syncing utility to set an user event status to the same status of another OpenCL event.
void sync_user_event (cl_event user_event, cl_event event)
 Synchronize an user event with another OpenCL event.
bool isKernelArgReadOnly (cl_kernel kernel, cl_uint arg_index)
void CL_CALLBACK populator (cl_event event, cl_int event_command_status, void *user_data)
 Callback called when Aqua::CalcServer::Reduction already set the new value on the output value.
void CL_CALLBACK solver (cl_event event, cl_int event_command_status, void *user_data)
 Callback called when all the dependencies of the Aqua::CalcServer::ScalarExpression tool are fulfilled.
void CL_CALLBACK exec_status_check (cl_event event, cl_int event_command_status, void *user_data)
bool need_new_cmd (const Tool *prev_tool, std::vector< cl_event > events)
void debug_event (cl_event event, CalcServer *C, TLogLevel log_level=L_DEBUG, const char *indent="\t\t")
 Auxiliar function to print information about events, for debugging purposes.

Variables

static bool sigint_received = false
 Have been a SIGINT already registered?
std::mutex profiling_mutex
 A mutex to avoid several threads writing profiling samples simultaneously.
std::string LINKLIST_INC = xxd2string(LinkList_hcl_in, LinkList_hcl_in_len)
std::string LINKLIST_SRC = xxd2string(LinkList_cl_in, LinkList_cl_in_len)
std::string RADIXSORT_INC = xxd2string(RadixSort_hcl_in, RadixSort_hcl_in_len)
std::string RADIXSORT_SRC = xxd2string(RadixSort_cl_in, RadixSort_cl_in_len)
std::string REDUCTION_INC = xxd2string(Reduction_hcl_in, Reduction_hcl_in_len)
std::string REDUCTION_SRC = xxd2string(Reduction_cl_in, Reduction_cl_in_len)
std::string SET_INC = xxd2string(Set_hcl_in, Set_hcl_in_len)
std::string SET_SRC = xxd2string(Set_cl_in, Set_cl_in_len)
std::string SORT_INC = xxd2string(Sort_hcl_in, Sort_hcl_in_len)
std::string SORT_SRC = xxd2string(Sort_cl_in, Sort_cl_in_len)
std::string UNSORT_INC = xxd2string(UnSort_hcl_in, UnSort_hcl_in_len)
std::string UNSORT_SRC = xxd2string(UnSort_cl_in, UnSort_cl_in_len)

Detailed Description

Calculation server name space.

Typedef Documentation

◆ debug_opts

◆ ProfilingSample

◆ ProfilingSnapshot

Function Documentation

◆ cbUserEventSync()

void CL_CALLBACK Aqua::CalcServer::cbUserEventSync ( cl_event n_event,
cl_int cmd_exec_status,
void * user_data )

Syncing utility to set an user event status to the same status of another OpenCL event.

This utility shall be used by means of sync_user_event()

Parameters
n_eventAssociated event
cmd_exec_statusTriggering status
user_dataRecasted cl_event pointer
Note
If cmd_exec_status=CL_COMPLETE clReleaseEvent will be called on top of the user event. Thus, call clRetainEvent if you want to further keep the event

◆ context_error_notify()

void CL_CALLBACK Aqua::CalcServer::context_error_notify ( const char * errinfo,
const void UNUSED_PARAM * private_info,
size_t UNUSED_PARAM cb,
void * user_data )

Runtime error reporting tool.

Errors reported in this way directly depends on the implementation.

Parameters
errinfois a pointer to an error string.
private_infopointer to binary data that is returned by the OpenCL implementation that can be used to log additional information helpful in debugging the error.
cbSize of the binary data, #private_info.
user_dataCurrent tool name.

◆ create_command_queue()

cl_command_queue Aqua::CalcServer::create_command_queue ( cl_context context,
cl_device_id device,
cl_int * errcode_ret )

Create an OpenCL command queue.

This function is just a wrapper for backguard compatibility. More specifically, clCreateCommandQueue is deprecated since OpenCL 1.2

Parameters
contextOpenCL context
deviceOpenCL device
errcode_retReturning error code
See also
https://www.khronos.org/registry/OpenCL/sdk/2.0/docs/man/xhtml/deprecated.html
https://www.khronos.org/registry/OpenCL/sdk/2.0/docs/man/xhtml/clCreateCommandQueueWithProperties.html

◆ debug_arg()

void Aqua::CalcServer::debug_arg ( unsigned int i,
InputOutput::Variable * var,
cl_kernel kernel,
TLogLevel log_level = L_DEBUG,
const char * indent = "\t\t" )

Auxiliar function to print information about arguments.

Parameters
iThe index of the argument
varThe variable to be set
kernelThe kernel where the variable has to be set
CThe CalcServer instance
log_levelThe log level
indentBase indent level
Here is the call graph for this function:

◆ debug_event()

void Aqua::CalcServer::debug_event ( cl_event event,
CalcServer * C,
TLogLevel log_level = L_DEBUG,
const char * indent = "\t\t" )

Auxiliar function to print information about events, for debugging purposes.

Parameters
eventThe event to debug
CThe CalcServer instance
log_levelThe log level
indentBase indent level

◆ device_timer_sampler()

void CL_CALLBACK Aqua::CalcServer::device_timer_sampler ( cl_event event,
cl_int UNUSED_PARAM event_command_status,
void * user_data )

Sample both the system clock and the devie timer to compute the offset.

Parameters
eventThe triggering event
event_command_statusCL_COMPLETE
user_dataA casted pointer to the Aqua::CalcServer::CalcServer::_device_timer_offset value
Here is the call graph for this function:

◆ event_profile_cb()

void CL_CALLBACK Aqua::CalcServer::event_profile_cb ( cl_event UNUSED_PARAM n_event,
cl_int UNUSED_PARAM cmd_exec_status,
void * user_data )

Callback called when the profiler ending event has finished.

Parameters
eventThe Ending event
cmd_exec_statusEvent status
user_dataRecasted EventProfile pointer

◆ exec_status_check()

void CL_CALLBACK Aqua::CalcServer::exec_status_check ( cl_event event,
cl_int event_command_status,
void * user_data )
Here is the call graph for this function:

◆ g_calcserver_singleton_ptr()

std::atomic< CalcServer * > Aqua::CalcServer::g_calcserver_singleton_ptr ( nullptr )

Singleton instance of Aqua::CalcServer::CalcServer.

◆ getDeviceInfoStr()

std::string Aqua::CalcServer::getDeviceInfoStr ( cl_device_id device,
cl_device_info param_name )

Wrapper to clGetDeviceInfo() for strings related operations.

Parameters
deviceThe device
param_nameThe parameter
Returns
The returned string

◆ isKernelArgReadOnly()

bool Aqua::CalcServer::isKernelArgReadOnly ( cl_kernel kernel,
cl_uint arg_index )

◆ need_new_cmd()

bool Aqua::CalcServer::need_new_cmd ( const Tool * prev_tool,
std::vector< cl_event > events )
Here is the call graph for this function:

◆ opencl_version() [1/3]

std::tuple< unsigned int, unsigned int > Aqua::CalcServer::opencl_version ( cl_device_id device)

Get the device's OpenCL major and minor version.

Parameters
platformThe platform identifier
Returns
The major and minor version numbers. 0.0 if the version cannot be recovered
Here is the call graph for this function:

◆ opencl_version() [2/3]

std::tuple< unsigned int, unsigned int > Aqua::CalcServer::opencl_version ( cl_platform_id platform)

Get the paltform's OpenCL major and minor version.

Parameters
platformThe platform identifier
Returns
The major and minor version numbers. 0.0 if the version cannot be recovered
Here is the call graph for this function:

◆ opencl_version() [3/3]

std::tuple< unsigned int, unsigned int > Aqua::CalcServer::opencl_version ( std::string version)

Get the OpenCL major and minor version from the string returned by clGetPlatformInfo() and clGetDeviceInfo()

Parameters
versionThe version string
Returns
The major and minor version numbers. 0.0 if the string is ill-formatted
Here is the call graph for this function:

◆ populator()

void CL_CALLBACK Aqua::CalcServer::populator ( cl_event event,
cl_int event_command_status,
void * user_data )

Callback called when Aqua::CalcServer::Reduction already set the new value on the output value.

This function is just populating the variable

Parameters
eventThe triggering event
event_command_statusCL_COMPLETE upon all dependencies successfully fulfilled. A negative integer if one or mor dependencies failed.
user_dataA casted pointer to the Aqua::CalcServer::ScalarExpression tool (or the inherited one)
Here is the call graph for this function:

◆ sigint_handler()

void Aqua::CalcServer::sigint_handler ( int UNUSED_PARAM s)

Handle SIGINT signals.

The first time a SIGINT is received, Aqua::CalcServer::sigint_received is set to true, such that, at the end of the current time step the simulation will stop, the last output will be printed, and the resources will be correctly released.

If SIGINT is received twice, then this handler will enforce the inmediate program exit.

Parameters
sRecevied signal, SIGINT

◆ solver()

void CL_CALLBACK Aqua::CalcServer::solver ( cl_event event,
cl_int event_command_status,
void * user_data )

Callback called when all the dependencies of the Aqua::CalcServer::ScalarExpression tool are fulfilled.

This function is just redirecting the work to Aqua::CalcServer::ScalarExpression::solve()

Parameters
eventThe triggering event
event_command_statusCL_COMPLETE upon all dependencies successfully fulfilled. A negative integer if one or mor dependencies failed.
user_dataA casted pointer to the Aqua::CalcServer::ScalarExpression tool (or the inherited one)

◆ sync_user_event()

void Aqua::CalcServer::sync_user_event ( cl_event user_event,
cl_event event )

Synchronize an user event with another OpenCL event.

clReleaseEvent() will be called on both events. Thus, call clRetainEvent() if you want to further keep them

Parameters
user_eventUser event to be synced
eventAssociated OpenCL event
Here is the call graph for this function:

Variable Documentation

◆ LINKLIST_INC

std::string Aqua::CalcServer::LINKLIST_INC = xxd2string(LinkList_hcl_in, LinkList_hcl_in_len)

◆ LINKLIST_SRC

std::string Aqua::CalcServer::LINKLIST_SRC = xxd2string(LinkList_cl_in, LinkList_cl_in_len)

◆ profiling_mutex

std::mutex Aqua::CalcServer::profiling_mutex

A mutex to avoid several threads writing profiling samples simultaneously.

◆ RADIXSORT_INC

std::string Aqua::CalcServer::RADIXSORT_INC = xxd2string(RadixSort_hcl_in, RadixSort_hcl_in_len)

◆ RADIXSORT_SRC

std::string Aqua::CalcServer::RADIXSORT_SRC = xxd2string(RadixSort_cl_in, RadixSort_cl_in_len)

◆ REDUCTION_INC

std::string Aqua::CalcServer::REDUCTION_INC = xxd2string(Reduction_hcl_in, Reduction_hcl_in_len)

◆ REDUCTION_SRC

std::string Aqua::CalcServer::REDUCTION_SRC = xxd2string(Reduction_cl_in, Reduction_cl_in_len)

◆ SET_INC

std::string Aqua::CalcServer::SET_INC = xxd2string(Set_hcl_in, Set_hcl_in_len)

◆ SET_SRC

std::string Aqua::CalcServer::SET_SRC = xxd2string(Set_cl_in, Set_cl_in_len)

◆ sigint_received

bool Aqua::CalcServer::sigint_received = false
static

Have been a SIGINT already registered?

◆ SORT_INC

std::string Aqua::CalcServer::SORT_INC = xxd2string(Sort_hcl_in, Sort_hcl_in_len)

◆ SORT_SRC

std::string Aqua::CalcServer::SORT_SRC = xxd2string(Sort_cl_in, Sort_cl_in_len)

◆ UNSORT_INC

std::string Aqua::CalcServer::UNSORT_INC = xxd2string(UnSort_hcl_in, UnSort_hcl_in_len)

◆ UNSORT_SRC

std::string Aqua::CalcServer::UNSORT_SRC = xxd2string(UnSort_cl_in, UnSort_cl_in_len)