12 #include <OpenCL/opencl.h>
41 cl_device_type m_type;
44 cl_device_id m_device;
46 cl_command_queue m_queue;
56 void getDeviceProps(cl_device_id device)
58 for(std::vector<openclGenProp>::iterator it = m_deviceProp.propertyList.begin(); it != m_deviceProp.propertyList.end(); ++it)
61 err = clGetDeviceInfo(device, it->param_name, it->param_value_size, it->param_value, NULL);
64 std::cerr<<
"Error adding property value CL!!\n";
80 Device_CL(cl_device_id
id, cl_device_type type, cl_context context)
89 m_maxBlocks = (size_t)((
size_t)1<<(m_deviceProp.DEVICE_ADDRESS_BITS-1))*2-1;
94 m_queue = clCreateCommandQueue(m_context, m_device, 0, &err);
97 std::cerr<<
"Error creating queue!!\n" <<err <<
"\n";
106 clReleaseCommandQueue(m_queue);
107 clReleaseContext(m_context);
108 std::cout<<
"Release Device_cl\n";
116 return m_deviceProp.DEVICE_MAX_WORK_GROUP_SIZE;
124 return m_deviceProp.DEVICE_MAX_COMPUTE_UNITS;
132 return m_deviceProp.DEVICE_GLOBAL_MEM_SIZE;
140 return m_deviceProp.DEVICE_LOCAL_MEM_SIZE;
148 #ifdef SKEPU_MAX_GPU_THREADS
149 return SKEPU_MAX_GPU_THREADS;
160 #ifdef SKEPU_MAX_GPU_BLOCKS
161 return SKEPU_MAX_GPU_BLOCKS;
cl_ulong getSharedMemPerBlock() const
Definition: device_cl.h:138
Definition: deviceprop_cl.h:46
int getMaxThreads() const
Definition: device_cl.h:146
cl_device_type getType() const
Definition: device_cl.h:186
const cl_command_queue & getQueue() const
Definition: device_cl.h:178
cl_uint getNumComputeUnits() const
Definition: device_cl.h:122
const cl_context & getContext() const
Definition: device_cl.h:170
Device_CL(cl_device_id id, cl_device_type type, cl_context context)
Definition: device_cl.h:80
~Device_CL()
Definition: device_cl.h:104
cl_device_id getDeviceID() const
Definition: device_cl.h:194
A class representing an OpenCL device.
Definition: device_cl.h:36
Declares a struct used to store OpenCL device properties.
size_t getMaxBlockSize() const
Definition: device_cl.h:114
cl_ulong getGlobalMemSize() const
Definition: device_cl.h:130
size_t getMaxBlocks() const
Definition: device_cl.h:158