- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
it seems that there is a bug in the openCL implementation. With that Code:
[cpp]
for (int run = 0; run < 10; run++) {
cl_int iError;
cl_uint uiPlatformCount;
clGetPlatformIDs(0, nullptr, &uiPlatformCount);
cl_platform_id* pPlatformIDs = new cl_platform_id[uiPlatformCount];
clGetPlatformIDs(uiPlatformCount, pPlatformIDs, nullptr);
for (int i = 0; i < (int)uiPlatformCount; i++) {
cl_platform_id pID = pPlatformIDs;
char cPlatformInfo[1024];
iError = clGetPlatformInfo(pID, CL_PLATFORM_NAME, sizeof(cPlatformInfo), cPlatformInfo, nullptr);
std::wcout << " Plattform Name:\t" << cPlatformInfo << std::endl;
cl_uint uiDeviceCount;
iError = clGetDeviceIDs(pID, CL_DEVICE_TYPE_ALL, 0, nullptr, &uiDeviceCount);
cl_device_id* pDeviceIDs = new cl_device_id[uiDeviceCount];
iError = clGetDeviceIDs(pID, CL_DEVICE_TYPE_ALL, uiDeviceCount, pDeviceIDs, &uiDeviceCount);
cl_context ctx;
cl_context_properties pContextProperties[3] = {CL_CONTEXT_PLATFORM, (cl_context_properties)pID, 0};
ctx = clCreateContext(pContextProperties, uiDeviceCount, pDeviceIDs, nullptr, nullptr, &iError);
for (int j = 0; j < (int)uiDeviceCount; j++)
{
cl_device_id dID = pDeviceIDs
cl_command_queue queue = clCreateCommandQueue(ctx, dID, CL_QUEUE_PROFILING_ENABLE, &iError);
clReleaseCommandQueue(queue);
}
clReleaseContext(ctx);
}
}
[/cpp]
Deconstruction with NVidia platform works but won't work with intel platform. But when you use the intel platform by compiling a Kernel and release it again, it works.
[cpp]
for (int run = 0; run < 10; run++) {
cl_int iError; cl_uint uiPlatformCount;
clGetPlatformIDs(0, nullptr, &uiPlatformCount);
cl_platform_id* pPlatformIDs = new cl_platform_id[uiPlatformCount];
clGetPlatformIDs(uiPlatformCount, pPlatformIDs, nullptr);
for (int i = 0; i < (int)uiPlatformCount; i++) {
cl_platform_id pID = pPlatformIDs;
char cPlatformInfo[1024];
iError = clGetPlatformInfo(pID, CL_PLATFORM_NAME, sizeof(cPlatformInfo), cPlatformInfo, nullptr);
std::wcout << " Plattform Name:\t" << cPlatformInfo << std::endl;
char *sIntel = "Intel";
if(strstr(cPlatformInfo, sIntel)) {
//continue;
}
cl_uint uiDeviceCount;
iError = clGetDeviceIDs(pID, CL_DEVICE_TYPE_ALL, 0, nullptr, &uiDeviceCount);
cl_device_id* pDeviceIDs = new cl_device_id[uiDeviceCount];
iError = clGetDeviceIDs(pID, CL_DEVICE_TYPE_ALL, uiDeviceCount, pDeviceIDs, &uiDeviceCount);
cl_context ctx;
cl_context_properties pContextProperties[3] = {CL_CONTEXT_PLATFORM, (cl_context_properties)pID, 0};
ctx = clCreateContext(pContextProperties, uiDeviceCount, pDeviceIDs, nullptr, nullptr, &iError);
CString sKernel = _T("__kernel void crunch(float f) { float x,y,cs,sn,xx,yy; x = 1.0f; y = 0.0f; cs = cos(2.0f); sn = sin(2.0f); for (int i=0;i<40000;i++){ xx = cs * x - sn * y; yy = cs * y + sn * x; x = xx; y = yy; } } ");
size_t szSourceSize = (size_t) sKernel.GetLength();
CStringA saCode = sKernel;
const char* cpKernel = saCode;
cl_program pclProgram = clCreateProgramWithSource(ctx, 1, &cpKernel, &szSourceSize, &iError);
char *pOptions = "-Werror";
iError = clBuildProgram(pclProgram, uiDeviceCount, pDeviceIDs, /*nullptr*/pOptions, nullptr, nullptr);
const char* kernelName = "crunch";
cl_kernel pclKernel = clCreateKernel(pclProgram, kernelName, &iError);
for (int j = 0; j < (int)uiDeviceCount; j++) {
cl_device_id dID = pDeviceIDs
cl_command_queue queue = clCreateCommandQueue(ctx, dID, CL_QUEUE_PROFILING_ENABLE, &iError);
cl_kernel pclKernel = clCreateKernel(pclProgram, kernelName, &iError);
float f = 1.f; iError = clSetKernelArg(pclKernel, 0, sizeof(cl_mem), &f);
size_t lws[1] = {256};
size_t gws[1] = {256};
iError = clEnqueueNDRangeKernel(queue, pclKernel, 1, nullptr, gws, lws, 0,nullptr, nullptr);
clReleaseKernel(pclKernel); clReleaseProgram(pclProgram);
/*float pfTemp[4] = {0};
cl_mem pBuffer = clCreateBuffer(ctx, CL_MEM_READ_WRITE, 4 * sizeof(float), &pfTemp[0], &iError);
clReleaseMemObject(pBuffer);*/
iError = clReleaseCommandQueue(queue);
}
iError = clReleaseContext(ctx);
}
}
[/cpp]
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Forgot to say that i use windows 7 on an x990 with OpenCL 1.1 Build 31360.31441 in Visual studio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We were not able to reproduce the issue you are having. Can you share your system configuration? Also what SDK version and driver version are you using?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Deinstalled and reinstalled the SDK and it worked fine. Don't have a clue, what went wrong. Thanks for your reply
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page