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

Exception raised when the user manually interrupts the simulation. More...

#include <CalcServer.h>

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

Public Member Functions

 CalcServer (const Aqua::InputOutput::ProblemSetup &sim_data)
 Constructor.
 
 ~CalcServer ()
 Destructor.
 
void update (InputOutput::TimeManager &t_manager)
 Internal time loop.
 
void setup ()
 Setup some additional simulation data.
 
InputOutput::Variablesvariables ()
 
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_command_queue command_queue (bool parallel=false) const
 
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 debug_mode () const
 Report if the tools debug mode is enabled.
 

Additional Inherited Members

- Static Public Member Functions inherited from Aqua::Singleton< Aqua::CalcServer::CalcServer >
static Aqua::CalcServer::CalcServersingleton ()
 Returns the instance of the class.
 
- Protected Member Functions inherited from Aqua::Singleton< Aqua::CalcServer::CalcServer >
 Singleton ()
 Constructor.
 
virtual ~Singleton ()
 Destructor.
 

Detailed Description

Exception raised when the user manually interrupts the simulation.

Entity that perform the main work of the simulation.

The target of this exception is handling the users interrumptions without returning back a core dump in the command line, which might be wrongly interpreted as an error.

In the Aqua::CalcServer::CalcServer a time subloop is performed where the SPH simulation is performed while no output files should be updated.

Note
Updating output files require to download data from the server, which due to the low bandwidth asigned is usually a bottleneck, hence letting the Aqua::CalcServer::CalcServer works without interrumptions is the best optimization technique.
Remarks
Some output files are managed internally by this class, like the log file, the energy file, pressure sensors file, or bounds file.

Constructor & Destructor Documentation

◆ CalcServer()

Aqua::CalcServer::CalcServer::CalcServer ( const Aqua::InputOutput::ProblemSetup sim_data)

Constructor.

Parameters
sim_dataSimulation data read from XML files
Here is the call graph for this function:

◆ ~CalcServer()

Aqua::CalcServer::CalcServer::~CalcServer ( )

Destructor.

Member Function Documentation

◆ base_path()

const std::string Aqua::CalcServer::CalcServer::base_path ( ) const
inline

Get the AQUAgpusph root path.

Returns
AQUAgpusph root path

◆ command_queue()

cl_command_queue Aqua::CalcServer::CalcServer::command_queue ( bool  parallel = false) const
inline

Get the command queue

Two different command queues are available. Indeed, OpenCL specification allows to create the command queues with the CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE option, which allows that a subsequent kernel/task execution begins before the preceding one has already finished. However, the specification does not allows, by any means, that a preceding kernel/task execution can be triggered after a subsequent one. Therefore, parallel tasks shall use a different queue to ensure the correct order within each queue

Parameters
paralleltrue if the command queue for task executed in parallel is queried, false otherwise
Returns
The command queue

◆ context()

cl_context Aqua::CalcServer::CalcServer::context ( ) const
inline

Get the active context

Returns
OpenCL context

◆ debug_mode()

bool Aqua::CalcServer::CalcServer::debug_mode ( ) const
inline

Report if the tools debug mode is enabled.

See also
Aqua::InputOutput::ProblemSetup::sphSettings::debug_tools
Returns
true if the tools debug mode is enabled, false otherwise

◆ definitions()

std::vector< std::string > Aqua::CalcServer::CalcServer::definitions ( ) const
inline

Get the definitions registered.

Returns
List of definitions.

◆ device()

cl_device_id Aqua::CalcServer::CalcServer::device ( ) const
inline

Get the device

Returns
OpenCL device

◆ getUnsortedMem()

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.

Parameters
var_nameVariable to unsort and download.
offsetThe offset in bytes in the memory object to read from.
cbThe size in bytes of data being downloaded.
ptrThe host memory where the data should be copied
Returns
The data download event, NULL if errors are detected.
Note
The caller must wait for the events (clWaitForEvents) before accessing the downloaded data.
Remarks
The caller must call clReleaseEvent to destroy the event. Otherwise a memory leak can be expected.
Here is the call graph for this function:

◆ platform()

cl_platform_id Aqua::CalcServer::CalcServer::platform ( ) const
inline

Get the platform

Returns
OpenCL platform

◆ setup()

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.

Here is the call graph for this function:

◆ tools()

std::vector< Tool * > Aqua::CalcServer::CalcServer::tools ( ) const
inline

Get the tools registered.

Returns
List of tools.

◆ update()

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).

Parameters
t_managerTime manager to let the calculation server when shall stop the internal loop.
Here is the call graph for this function:

◆ variables()

InputOutput::Variables * Aqua::CalcServer::CalcServer::variables ( )
inline

Get the variables manager

Returns
Variables manager

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