Clover Git
OpenCL 1.1 software implementation
Public Member Functions | Private Member Functions | Private Attributes

Coal::Context Class Reference

OpenCL context. More...

#include <context.h>

Inheritance diagram for Coal::Context:
Collaboration diagram for Coal::Context:

List of all members.

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

Detailed Description

OpenCL context.

This class is the root of all OpenCL objects, except Coal::DeviceInterface.

Definition at line 50 of file context.h.


Constructor & Destructor Documentation

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.

Parameters:
propertiesproperties of the context
num_devicesnumber of devices that will be used
devicesCoal::DeviceInterface to be used
pfn_notifyfunction to call when an error arises, to give more detail
user_datauser data to pass to pfn_notify
errcode_retreturn 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.


Member Function Documentation

bool Context::hasDevice ( DeviceInterface device) const

Check that this context contains a given device.

Parameters:
devicedevice to check
Returns:
whether this context contains 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);
Parameters:
param_nameName of the property to retrieve
param_value_sizeSize of the application-allocated buffer in which to put the value.
param_valuePointer to an application-allocated buffer where the property data will be stored. Ignored if NULL.
param_value_size_retSize of the value retrieved, ignored if NULL.
Returns:
CL_SUCCESS in case of success, otherwise a CL error code.

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]

Member Data Documentation

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]

Definition at line 96 of file context.h.

Referenced by Context().

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]

Definition at line 95 of file context.h.

Referenced by Context(), and info().

const void void* void Coal::Context::p_user_data [private]

Definition at line 90 of file context.h.

const void Coal::Context::size_t [private]

Definition at line 90 of file context.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines