AQUAgpusph 5.0.4
|
An array variable. More...
#include <Variable.hpp>
Public Member Functions | |
ArrayVariable (const std::string varname, const std::string vartype) | |
~ArrayVariable () | |
bool | isArray () |
Report that the varaible is an array. | |
size_t | typesize () const |
size_t | size () const |
void * | get (bool UNUSED_PARAM synced=false) |
void | set (void *ptr, bool synced=false) |
bool | reallocatable () const |
Get if a variable is reallocatable. | |
void | reallocatable (bool is) |
Set if a variable is reallocatable. | |
PyObject * | getPythonObject (int i0=0, int n=0) |
bool | setFromPythonObject (PyObject *obj, int i0=0, int n=0) |
const std::string | asString (bool synced=true) |
const std::string | asString (size_t i, bool synced=true) |
Public Member Functions inherited from Aqua::InputOutput::Variable | |
Variable (const std::string varname, const std::string vartype) | |
Constructor. | |
virtual | ~Variable () |
Destructor. | |
bool | isScalar () |
Let efficiently know whether the variable is a scalar or not. | |
std::string | name () const |
Name of the variable. | |
virtual std::string | type () const |
Type of the variable. | |
void * | get_async () |
Get variable pointer basis pointer. | |
void | set_async (void *ptr) |
Set variable from memory. | |
virtual PyObject * | getPythonObject (int UNUSED_PARAM i0=0, int UNUSED_PARAM n=0) |
Get a Python interpretation of the variable. | |
virtual bool | setFromPythonObject (PyObject UNUSED_PARAM *obj, int UNUSED_PARAM i0=0, int UNUSED_PARAM n=0) |
Set the variable from a Python object. | |
virtual const std::string | asString (bool UNUSED_PARAM synced=true) |
Get the variable text representation. | |
void | setEvent (cl_event event) |
Set the variable current writing event. | |
void | setWritingEvent (cl_event event) |
Alias of InputOutput::Variable::setEvent() | |
cl_event | getEvent () const |
Returns the last writing event associated to this variable. | |
cl_event | getWritingEvent () const |
Alias of InputOutput::Variable::getEvent() | |
void | addReadingEvent (cl_event event) |
Add a new reading event to the variable. | |
std::vector< cl_event > | getReadingEvents () const |
Get the list of reading events. | |
void | sync (bool readonly=false) |
Wait for variable reading and writing events to be completed. |
Additional Inherited Members | |
Protected Member Functions inherited from Aqua::InputOutput::Variable | |
void | cleanReadingEvents () |
Clean up the list of reading events. | |
Static Protected Member Functions inherited from Aqua::InputOutput::Variable | |
static cl_event | createDummyEvent () |
Create a competed user event to be set as the writing event when synced writing operations are carried out. |
An array variable.
Aqua::InputOutput::ArrayVariable::ArrayVariable | ( | const std::string | varname, |
const std::string | vartype ) |
Constructor.
varname | Name of the variable. |
vartype | Type of the variable. |
Aqua::InputOutput::ArrayVariable::~ArrayVariable | ( | ) |
Destructor.
const std::string Aqua::InputOutput::ArrayVariable::asString | ( | bool | synced = true | ) |
Get the variable text representation
synced | true if the function shall block until the last writing event is dispatched, false otherwise |
const std::string Aqua::InputOutput::ArrayVariable::asString | ( | size_t | i, |
bool | synced = true ) |
Get a component text representation
i | Index of the component to be extracted. |
synced | true if the function shall block until the last writing event is dispatched, false otherwise |
|
inlinevirtual |
Get variable pointer basis pointer
synced | Unused parameter |
Reimplemented from Aqua::InputOutput::Variable.
PyObject * Aqua::InputOutput::ArrayVariable::getPythonObject | ( | int | i0 = 0, |
int | n = 0 ) |
Get a PyArrayObject interpretation of the variable
i0 | First component to be read. |
n | Number of component to be read, 0 to read all available memory, i.e. All the array after i0. |
|
inlinevirtual |
|
inline |
Get if a variable is reallocatable.
|
inline |
Set if a variable is reallocatable.
is | true if the variable is reallocatable, false otherwise |
|
virtual |
Set variable from memory
ptr | Memory to copy. |
synced | Unused parameter |
std::runtime_error | if the variable is not reallocatable and it has been already set |
Reimplemented from Aqua::InputOutput::Variable.
bool Aqua::InputOutput::ArrayVariable::setFromPythonObject | ( | PyObject * | obj, |
int | i0 = 0, | ||
int | n = 0 ) |
Set the variable from a Python object
obj | PyArrayObject object. |
i0 | ignored parameter. |
n | ignored parameter |
|
virtual |
Get the array size.
Reimplemented from Aqua::InputOutput::Variable.
|
inlinevirtual |
Get the cl_mem type size.
Reimplemented from Aqua::InputOutput::Variable.