AQUAgpusph 5.0.4
|
Entity that perform the main work of the simulation. More...
#include <CalcServer.hpp>
Public Types | |
enum | cmd_queue { cmd_queue_current , cmd_queue_new , cmd_queue_mpi } |
Public Member Functions | |
CalcServer (const Aqua::InputOutput::ProblemSetup &sim_data) | |
Constructor. | |
~CalcServer () | |
Destructor. | |
void | raiseSIGINT () |
Raise a SIGINT/SIGTERM signal. | |
void | update (InputOutput::TimeManager &t_manager) |
Internal time loop. | |
void | setup () |
Setup some additional simulation data. | |
InputOutput::Variables * | variables () |
std::vector< std::string > | definitions () const |
std::vector< Tool * > | tools () const |
cl_context | context () const |
cl_platform_id | platform () const |
cl_device_id | device () const |
cl_uint | device_addr_bits () const |
Get the device address bits. | |
const char * | device_compile_flags () const |
Get the device compilation flags. | |
template<typename T> | |
cl_int | setKernelSizeArg (cl_kernel kernel, cl_uint arg_index, const T arg_value) |
wrapper to clSetKernelArg to set variables which size depends on the device address bits | |
cl_command_queue | command_queue (cmd_queue which=cmd_queue::cmd_queue_current) |
cl_int | finish () const |
std::vector< cl_event > | all_events () const |
cl_event | marker () const |
cl_event | marker (cl_command_queue cmd, std::vector< cl_event > events) const |
cl_ulong | device_timer_offset () const |
Get the offset between the device timer and the host one. | |
cl_event | getUnsortedMem (const std::string var_name, size_t offset, size_t cb, void *ptr) |
Download a unsorted variable from the device. | |
const std::string | base_path () const |
Get the AQUAgpusph root path. | |
bool | have_3d () const |
Get if 3 dimensions are considered. | |
bool | debug_mode () const |
Report if any tools debug option is enabled. | |
bool | debug_mode (debug_opts opt) const |
Report if the tools debug mode option is enabled. | |
std::tuple< std::vector< InputOutput::Variable * >, std::vector< InputOutput::Variable * > > | eventVars (cl_event event) const |
Get the variables associated to an event, if any. | |
Tool * | eventTool (cl_event event) const |
Get the tool that emitted an event, if any. | |
template<> | |
cl_int | setKernelSizeArg (cl_kernel kernel, cl_uint arg_index, const size_t arg_value) |
Public Member Functions inherited from Aqua::CalcServer::ProfilingInfo | |
ProfilingInfo (const cl_uint n=N_PROFILING_SNAPSHOTS) | |
Constructor. | |
~ProfilingInfo () | |
Destructor. | |
cl_ulong | step () const |
Get the number of times the tools pack has been executed. | |
void | sample (cl_ulong step, Tool *tool, std::string name, cl_ulong start, cl_ulong end) |
Add a new sample to an specific step. | |
void | sample (cl_ulong step, Tool *tool, Profile *substage, cl_ulong start, cl_ulong end) |
Add a new sample to an specific step. | |
std::deque< ProfilingSnapshot > | get () const |
Get the stored snapshots. |
Static Public Member Functions | |
static CalcServer * | singleton () |
Get –creating it the first time– the logger instance. | |
static cl_ulong | host_timer () |
Get the host timer. | |
Static Public Member Functions inherited from Aqua::CalcServer::ProfilingInfo | |
static cl_long | delta (const cl_ulong &t, const cl_ulong &t0) |
Get the delta time. |
Additional Inherited Members | |
Protected Member Functions inherited from Aqua::CalcServer::ProfilingInfo | |
void | newStep () |
Let the profiler know that a new step of tools execution is about to start. |
Entity that perform the main work of the simulation.
In the Aqua::CalcServer::CalcServer a time subloop is performed where the SPH simulation is performed while no output files should be updated.
Aqua::CalcServer::CalcServer::CalcServer | ( | const Aqua::InputOutput::ProblemSetup & | sim_data | ) |
Constructor.
sim_data | Simulation data read from XML files |
Aqua::CalcServer::CalcServer::~CalcServer | ( | ) |
Destructor.
std::vector< cl_event > Aqua::CalcServer::CalcServer::all_events | ( | ) | const |
Collect all the events stored on the variables
This includes the user events that shall be set by callbacks. Thus, this function is more powerful than finish() at the time to set a synchronization point. It is slower also.
|
inline |
Get the AQUAgpusph root path.
cl_command_queue Aqua::CalcServer::CalcServer::command_queue | ( | cmd_queue | which = cmd_queue::cmd_queue_current | ) |
Get a command queue
To allow the asynchronous "As-Fast-As-Possible" execution of commands they can be enqueued on different queues. The queues are always reseted when a new time step is executed.
which | cmd_queue::cmd_queue_current to enqueue the command on the current command queue, cmd_queue::cmd_queue_new to raise a new one where commands can be executed in parallel, cmd_queue::cmd_queue_mpi to get the command queue designed to exchange info with other processes |
|
inline |
Get the active context
|
inline |
Report if any tools debug option is enabled.
|
inline |
Report if the tools debug mode option is enabled.
opt | The options to check |
|
inline |
Get the definitions registered.
|
inline |
Get the device
|
inline |
Get the device address bits.
|
inline |
Get the device compilation flags.
|
inline |
Get the offset between the device timer and the host one.
Tool * Aqua::CalcServer::CalcServer::eventTool | ( | cl_event | event | ) | const |
Get the tool that emitted an event, if any.
std::tuple< std::vector< InputOutput::Variable * >, std::vector< InputOutput::Variable * > > Aqua::CalcServer::CalcServer::eventVars | ( | cl_event | event | ) | const |
Get the variables associated to an event, if any.
|
inline |
Call clFinish() on top of all known command queues
cl_event Aqua::CalcServer::CalcServer::getUnsortedMem | ( | const std::string | var_name, |
size_t | offset, | ||
size_t | cb, | ||
void * | ptr ) |
Download a unsorted variable from the device.
var_name | Variable to unsort and download. |
offset | The offset in bytes in the memory object to read from. |
cb | The size in bytes of data being downloaded. |
ptr | The host memory where the data should be copied |
|
inline |
Get if 3 dimensions are considered.
|
inlinestatic |
Get the host timer.
cl_event Aqua::CalcServer::CalcServer::marker | ( | ) | const |
Create a marker to be set as completed when all the enqued commnands on all the command queues are finished.
cl_event Aqua::CalcServer::CalcServer::marker | ( | cl_command_queue | cmd, |
std::vector< cl_event > | events ) const |
Wrapper over clEnqueueMarkerWithWaitList()
|
inline |
Get the platform
void Aqua::CalcServer::CalcServer::raiseSIGINT | ( | ) |
Raise a SIGINT/SIGTERM signal.
This can be useful for instance to asynchronously interrupt the execution after detecting errors
cl_int Aqua::CalcServer::CalcServer::setKernelSizeArg | ( | cl_kernel | kernel, |
cl_uint | arg_index, | ||
const size_t | arg_value ) |
cl_int Aqua::CalcServer::CalcServer::setKernelSizeArg | ( | cl_kernel | kernel, |
cl_uint | arg_index, | ||
const T | arg_value ) |
wrapper to clSetKernelArg to set variables which size depends on the device address bits
kernel | OpenCL kernel object |
arg_index | is the argument index |
arg_value | is a pointer to data |
void Aqua::CalcServer::CalcServer::setup | ( | ) |
Setup some additional simulation data.
Even thought this work is associated with the constructor CalcServer(), when something may fail it is preferable to let it to a separated method that could report errors, allowing the program to deal with them.
|
static |
Get –creating it the first time– the logger instance.
Just one logger can simultaneously exist
|
inline |
Get the tools registered.
void Aqua::CalcServer::CalcServer::update | ( | InputOutput::TimeManager & | t_manager | ) |
Internal time loop.
Calculation server will be iterating while no output files should be updated (or even the simulation is finished).
t_manager | Time manager to let the calculation server when shall stop the internal loop. |
|
inline |
Get the variables manager