Inconsistent cl_device_id order

Inconsistent cl_device_id order

I tried to create a program from source, build it and save its binary, and then create a program from binary.  However, when I went to build it the second time I got the follow error: -42 (CL_INVALID_BINARY).  I tracked down the issue being that the order of the cl_device_id's I passed to clCreateContext, if not the same order I get when I query clProgramGetInfo with CL_PROGRAM_DEVICES.  This was quite an unexpected surprise.  Why wouldn't this order be maintained?  Changing that order causes me more headache as I need to query clGetDeviceInfo all over again.  I realize after reading through the spec that it does not require a consistent order, but what is to be gained from not maintaining an order even within the same program execution?


Btw, I'm using the latest non-beta Intel graphics driver and OpenCL SDK for Windows 8.1 64-bit with Visual Studio 2012 Professional.

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Sorry for the late response. Apparently its not trivial to maintain the exact order between invocations of the common runtime (a layer that routes the calls to the appropriate runtime (CPU/GPU). We do maintain the device order for the life time of the CRT. So you should get the same order when calling clGetDeviceIDs() but its not guaranteed when calling clGetPlatformIDs() multiple times.


Leave a Comment

Please sign in to add a comment. Not a member? Join today