OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU.
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1718 Discussions

problem with clCreateCommandQueueWithProperties on Linux for NVIDIA Quadro K2200

Siegmar_G_
Beginner
1,285 Views
Hello, I want to use CUDA-8.0 and OpenCL on SuSE Linux Enterprise 12.1. Unfortunately NVIDIA supports only OpenCL 1.2, so that I've installed the latest version of the Intel OpenCL SDK as well. I get a warning about a deprecated function if I use "clCreateCommandQueue ()" and my program breaks with a segmentation fault if I call "clCreateCommandQueueWithProperties ()" for my NVIDIA Quadro K2200 graphics card (it doesn't matter if I use Sun C, icc, or gcc). I assume the reason for the segmentation fault is that the graphics device supports only OpenCL 1.2 and "clCreateCommandQueueWithProperties ()" doesn't honour this fact. Now I have a more or less complicated code to create a command queue and to get my program working with different platforms (OpenCL 1.2 and OpenCL 2.x, Linux and Windows) and compilers. Why do I have to determine the OpenCL version of the device at run-time, if the OpenCL SDK reports CL_VERSION_2_0? In my opinion the library should automatically use the correct function and parameters if the device supports only OpenCL 1.2. I'm new to OpenCL so I may have misunderstood something or perhaps my program is even faulty. How can I create a command queue for OpenCL 1.2 and 2.x in a portable way, so that I don't get warnings about deprecated functions and I get a program that works if I compile it on different platforms with different compilers? I don't know how "clCreateCommandQueueWithProperties ()" will be translated for the device. Is it possible that the function doesn't work as expected if the device supports only OpenCL 1.2? #if !defined(CL_VERSION_2_0) || defined(__NVCC__) if (outOfOrderQueue == 1) { printf (" Using out-of-order clCreateCommandQueue (...)\n\n"); command_queue = clCreateCommandQueue (context, device_id, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &errcode_ret); } else { printf (" Using in-order clCreateCommandQueue (...)\n\n"); command_queue = clCreateCommandQueue (context, device_id, 0, &errcode_ret); } #else /* "deviceOpenCL_MajorVersion - '0'" converts char to int */ if ((deviceOpenCL_MajorVersion - '0') == 2) { cl_queue_properties queueProps[] = { CL_QUEUE_PROPERTIES, (const cl_queue_properties) (CL_QUEUE_ON_DEVICE && CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE), 0 }; printf (" Using out-of-order clCreateCommandQueueWithProperties (...)\n\n"); command_queue = clCreateCommandQueueWithProperties (context, device_id, queueProps, &errcode_ret); } else { /* CL_VERSION_2_0 reported, but device supports only OpenCL 1.2 */ if (outOfOrderQueue == 1) { printf (" Using out-of-order clCreateCommandQueue (...)\n\n"); command_queue = clCreateCommandQueue (context, device_id, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &errcode_ret); } else { printf (" Using in-order clCreateCommandQueue (...)\n\n"); command_queue = clCreateCommandQueue (context, device_id, 0, &errcode_ret); } } #endif CheckRetValueOfOpenCLFunction (errcode_ret); I would be grateful for any comments entlighten my understanding of the problem and why I have to choose between clCreateCommandQueueWithProperties and clCreateCommandQueue myself when CL_VERSION_2_0 is reported. Thank you very much for any help in advance. Siegmar
0 Kudos
1 Reply
Ben_A_Intel
Employee
1,285 Views

"Deprecated" has different meanings for different APIs.  For OpenCL, the meaning is:

Deprecation: existing features are marked as deprecated if their usage is not recommended as that feature is being de-emphasized, superseded and may be removed from a future version of the specification.

(Taken from the OpenCL 2.2 provisional spec glossary, where the working group clarified the definition.)

Long story short, this means that you may continue to use the OpenCL 1.2 clCreateCommandQueue() function, even on OpenCL 2.0 implementations where the function is "deprecated".  The "deprecated" identifier is simply informational, to indicate that the function or feature may be removed from a future version of the specification.

If the "deprecated" warning bothers you, you may suppress the warning by #defining CL_USE_DEPRECATED_OPENCL_1_2_APIS before #including CL.h.

0 Kudos
Reply