OpenCL On Multiple Platforms

I’m slightly confused as to how OpenCL works under the hood.
When I do locate libOpenCL.so I get multiple files; presumably one for each SDK I have install (NVIDIA, Intel and AMD).

When I link my executables I don’t think too much about what I’m doing, do I have to link depending on which platform I wish to target?

What happens when I, for example, choose my Intel CPU platform but link the NVIDIA libOpenCL. Or is there a single lib that calls into the requisite libs for each SDK?

Cheers.

I remember reading that libOpenCL is supplied by khronos, so it should be the same for all vendors.

All it does is look up the icd files and then proxies the function calls to the implementation(s). So you only need to link against libopencl from any vendor, and the available platforms are discovered and instantiated at run-time.

It’s nothing to worry about, it ‘just works’.

Brilliant, thanks notzed. Thought it must have been something like that but didn’t make sense to have multiple libOpenCL on my system (e.g. One in NVIDIA dir).

Cheers.