Clover Git
OpenCL 1.1 software implementation
|
OpenCL context. More...
#include <context.h>
Public Member Functions | |
Context (const cl_context_properties *properties, cl_uint num_devices, const cl_device_id *devices, void(CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *), void *user_data, cl_int *errcode_ret) | |
Constructor. | |
~Context () | |
cl_int | info (cl_context_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret) const |
Info about the context. | |
bool | hasDevice (DeviceInterface *device) const |
Check that this context contains a given device . | |
Private Member Functions | |
void (CL_CALLBACK *p_pfn_notify)(const char * | |
Private Attributes | |
cl_context_properties * | p_properties |
const void | size_t |
const void void *void | p_user_data |
DeviceInterface ** | p_devices |
unsigned int | p_num_devices |
unsigned int | p_props_len |
cl_platform_id | p_platform |
OpenCL context.
This class is the root of all OpenCL objects, except Coal::DeviceInterface
.
Context::Context | ( | const cl_context_properties * | properties, |
cl_uint | num_devices, | ||
const cl_device_id * | devices, | ||
void(CL_CALLBACK *pfn_notify)(const char *, const void *,size_t, void *) | , | ||
void * | user_data, | ||
cl_int * | errcode_ret | ||
) |
Constructor.
properties | properties of the context |
num_devices | number of devices that will be used |
devices | Coal::DeviceInterface to be used |
pfn_notify | function to call when an error arises, to give more detail |
user_data | user data to pass to pfn_notify |
errcode_ret | return code |
Definition at line 49 of file context.cpp.
References default_pfn_notify(), GET_PROP, p_devices, p_num_devices, p_platform, p_properties, and p_props_len.
Context::~Context | ( | ) |
Definition at line 161 of file context.cpp.
References p_devices, and p_properties.
bool Context::hasDevice | ( | DeviceInterface * | device | ) | const |
Check that this context contains a given device
.
device | device to check |
device
Definition at line 216 of file context.cpp.
References p_devices, and p_num_devices.
Referenced by Coal::CommandQueue::CommandQueue().
cl_int Context::info | ( | cl_context_info | param_name, |
size_t | param_value_size, | ||
void * | param_value, | ||
size_t * | param_value_size_ret | ||
) | const |
Info about the context.
This function is used to retrieve information about an object. Sometimes, the size of the data retrieved is unknown (for example, a string). The application can call this function twice, the first time to get the size, then it allocates a buffer, and finally get the data.
const char *string = 0; size_t len; object->info(FOO_PROPERTY_STRING, 0, 0, &len); string = std::malloc(len); object->info(FOO_PROPERTY_STRING, len, string, 0);
param_name | Name of the property to retrieve |
param_value_size | Size of the application-allocated buffer in which to put the value. |
param_value | Pointer to an application-allocated buffer where the property data will be stored. Ignored if NULL. |
param_value_size_ret | Size of the value retrieved, ignored if NULL. |
Definition at line 170 of file context.cpp.
References MEM_ASSIGN, p_devices, p_num_devices, p_properties, p_props_len, Coal::Object::references(), and SIMPLE_ASSIGN.
Referenced by clBuildProgram().
Coal::Context::void | ( | CL_CALLBACK * | p_pfn_notify | ) | const [private] |
DeviceInterface** Coal::Context::p_devices [private] |
Definition at line 94 of file context.h.
Referenced by Context(), hasDevice(), info(), and ~Context().
unsigned int Coal::Context::p_num_devices [private] |
Definition at line 95 of file context.h.
Referenced by Context(), hasDevice(), and info().
cl_platform_id Coal::Context::p_platform [private] |
cl_context_properties* Coal::Context::p_properties [private] |
Definition at line 89 of file context.h.
Referenced by Context(), info(), and ~Context().
unsigned int Coal::Context::p_props_len [private] |
const void void* void Coal::Context::p_user_data [private] |
const void Coal::Context::size_t [private] |