I have a Laptop with Intel(R) HD Graphic 520 GPU in it. It added OpenCL developer Packages to Cygwin. I have found a small Mandelbrot-Set calculator program for OpenCL in C on Github. It is for Apple, so I modified the Makefile to use the proper headers and settings for gcc. Now the code compiles and executes nicely (bmp file created):
Device 0: GenuineIntel pthread-Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
I have two questions:
#1. How can I add (if it is possible) the Intel GPU to the /etc/OpenCL/vendors list? I tried to install from Intel site the Intel CPU runtime for OpenCL Applications for Windows OS and Intel Graphics Technology driver package, but I do not know where can I find the proper OpenCL dll I can point in the intel.idc file.
#2. In /etc/OpenCL/vendors I have found a pocl.icd file pointing to cygpocl-2.dll. I assume this is the pthread library. But it seems to me it is running only a single thread, although I have 4 cores. Should I do any modification to run it in multiple threads? I debugged the code and it seems that as there are only one device found, so it runs only on one thread. In the initialization function it sets the device work_size property for processing a stirp per device of the final bmp. But as there is only one device, the whole bmp is processed by one run (one clEnqueueNDRangeKernel and one clEnqueueReadBuffer is called).
To compile and run OpenCL programs in Cygwin:
- Ensure that you have the latest GPU driver by installing from https://www.intel.in/content/www/in/en/support/intel-driver-support-assistant.html
- Install OpenCL header and Library from Khronos OpenCL Registry - The Khronos Group Inc or from Intel OpenCL SDK Choose & Download Intel® SDK for OpenCL™ Applications , if you have not already done so.
- Install libOpenCL1 cygwin package via Cygwin Package Manager Cygwin Installation
- Replace the cygwin's OpenCL library with the DLL from Intel (Copy as below)
- Copy file "/cygdrive/c/Windows/System32/OpenCl.dll" to directory "/cygdrive/c/cygwin64/bin/" and alter it as "/cygdrive/c/cygwin64/bin/cygOpenCL-1.dll" (You can save old dll as "/cygdrive/c/cygwin64/bin/cygOpenCL-1-old.dll")
- Ensure that “/etc/OpenCL/vendors/intel.icd” points to “cygOpenCL-1.dll”
- Recompile and run your OpenCL program for GPU.
Please try this and share your results.