Execute a Python script.
More...
#include <CalcServer/Python.h>
|
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.
|
|
Execute a Python script.
The Python script should has a function main which will be called each time step, when execute is called.
AQUAgpusph is providing a module called aquagpusph which allows the Python script to get and set variable values.
◆ Python()
Aqua::CalcServer::Python::Python |
( |
const std::string |
tool_name, |
|
|
const std::string |
script, |
|
|
bool |
once = false |
|
) |
| |
Constructor.
- Parameters
-
tool_name | Tool name. |
script | Python script path. |
once | Run this tool just once. Useful to make initializations. |
◆ ~Python()
Aqua::CalcServer::Python::~Python |
( |
| ) |
|
◆ _execute()
cl_event Aqua::CalcServer::Python::_execute |
( |
const std::vector< cl_event > |
events | ) |
|
|
protectedvirtual |
Execute the tool
- Parameters
-
events | List of events that shall be waited before safe execution |
- Returns
- OpenCL event to be waited before accesing the dependencies
Reimplemented from Aqua::CalcServer::Tool.
◆ initPython()
void Aqua::CalcServer::Python::initPython |
( |
| ) |
|
|
protected |
Initialize the Python interpreter.
This method is safely creating the Python environment just one time, adding the execution folder to the system path (in order to import modules).
◆ load()
void Aqua::CalcServer::Python::load |
( |
| ) |
|
|
protected |
Load the script and extract the callable function.
◆ setup()
void Aqua::CalcServer::Python::setup |
( |
| ) |
|
|
virtual |
The documentation for this class was generated from the following files:
- /home/pepe/SPH/Code/aquagpusph/include/CalcServer/Python.h
- /home/pepe/SPH/Code/aquagpusph/src/CalcServer/Python.cpp