I am running into problems involving clCreateCommandQueueWithProperties. Whenever I pass in properties to this function, clErr is -35 which is a failure.
I am running a Radeon 290 card.
I have tried these drivers:
amd-14.41rc1-win8.1-64bit-opencl2-sep19
amd-catalyst-15.4beta-64bit-win7-apr9
amd-catalyst-omega-14.12-with-dotnet45-win7-64bit
#include <cl/opencl.h>
#include <iostream>
using namespace std;
bool printErrors(cl_int err, std::string val)
{
if (err == CL_SUCCESS)
return false;
cout << (int)err << ": " << val.c_str() << endl;
return true;
}
int main()
{
cl_int clErr;
cl_uint numPlatforms;
clErr = clGetPlatformIDs(0, NULL, &numPlatforms);
printErrors(clErr, "clGetPlatformIDs");
cout << "OpenCL Platforms found: " << numPlatforms << endl;
cl_platform_id *platforms = new cl_platform_id[numPlatforms];
clErr = clGetPlatformIDs(numPlatforms,platforms,NULL);
if (printErrors(clErr, "clGetPlatformIDs"))
return 0;
for (unsigned int i = 0; i < numPlatforms; i++)
{
cl_device_type deviceType = CL_DEVICE_TYPE_GPU; //ALL
cl_uint numDevices;
clErr = clGetDeviceIDs(platforms[i],deviceType,0,NULL,&numDevices);
if (printErrors(clErr, "clGetDeviceIDs"))
return 0;
cout << "
OpenCL Devices found: " << numDevices << endl;
// get device IDs
cl_device_id *devices = new cl_device_id[numDevices];
clErr = clGetDeviceIDs(platforms[i],deviceType,numDevices,devices,NULL);
if (printErrors(clErr, "clGetDeviceIDs"))
return 0;
//create and initialize device and list
for (unsigned int index = 0; index < numDevices; index++)
{
cout << "Device #%1" << index << endl;
//create context. We only need one.
cl_int clErr;
cl_context context = clCreateContext(0, 1, &devices[index], NULL, NULL, &clErr);
if (printErrors(clErr, "clCreateContext"))
return 0;
// create command queue
cl_queue_properties props = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT;
cl_command_queue commandQueue = clCreateCommandQueueWithProperties(context, devices[index], &props, &clErr);
if (printErrors(clErr, "clCreateCommandQueueWithProperties"))
return 0;
}
}
return 0;
}