How do I compile OpenCL in 2019 ?


#1

I wanted to try OpenCL for GPU programming. The problem is that I don’t know how to compile it. It seems that what I need is headers and some lib to link. I downloaded headers from Khronos Github page but lib file is vapor. The only legit copy I found belongs to Intel something SDK which is over 3GB of some tools which I don’t care about. How do I compile OpenCL ?
Platform: Windows


#2

You need two things: opencl.h header, opencl.lib library to link to (which is a dynamic wrapper around opencl.dll installed by driver, on Windows). Any OpenCL SDK (Intel, AMD, NVIDIA) will have these two pieces. I use an ancient AMD OpenCL 1.1 or 1.2 SDK because I want to avoid accidentally calling OpenCL 2.x APIs.