context = clCreateContextFromType( cprops, CL_DEVICE_TYPE_ALL, NULL, NULL, &err );
I have code to load precompiled kernels to blur image (or to do any other effects with images) and I started to analyze the code. I searched what is meanning of the CL_DEVICE_TYPE_ALL and I have found the following table:
https://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/clGetDeviceIDs.html
which contains also CL_DEVICE_TYPE_CPU, and CL_DEVICE_TYPE_GPU.
Now I got a thought and ask myself these wuestions:
- Why I use here the flag CL_DEVICE_TYPE_ALL, do I really need to keep it in the context? Could I use just
context = clCreateContextFromType( cprops, CL_DEVICE_TYPE_GPU, NULL, NULL, &err );
-
Why OpenCL needs the flag CL_DEVICE_TYPE_CPU how could it be used? Does OpenCL can use the kernel for CPU? I ask this question because last days I think what would be faster/better for me to make the blur actions and similar things. Would it be faster to use 4 core / 6 core or even 8 core CPU (eg. AMD FX 8320) or to use my cheap GPU (NVIDIA GT 640 128-bit 4GDDR)? Unfortunately I am just beginner in C/C++ so I am not sure how hard is it to learn to programme for more cores. However here is my last question:
-
Could I use OpenCL to perform the job on 4 cores of CPU or even to devide the job between CPU and GPU? For example I would take image and separate it for 5 strips of same height, and I would use the kernel gaussian.bin to erform the blur actions on the strips and then splice the strips back together to created the blured image.
I don’t know answers for these questions and would be glad if you can explain them. I am using old version of OpenCL, I am still running Windows XP 32 bit