How do I get the platform of an OpenCL context, which wasn't specified on creation?
02:24 07 Aug 2026

In OpenCL, one cannot directly obtain the platform (i.e. the cl_platform_id ) of a context using the clGetContextInfo(). If you explicitly specified a platform when creating the context, by passing it in a properties array - you can retrieve that through clGetContextInfo() for the CL_CONTEXT_PROPERTIES attribute. But - what if the platform was not specified that way? How do we retrieve it?

language-lawyer opencl