I was wondering about the following: the OpenCL spec states that applications should try and build their CL sources once on the first run and then save the binaries created for use on subsequent runs. However, when considering how to load the binaries again, I wondered how I should save those binaries and load them onto the proper devices if the configuration is ever changed.
For example, suppose I have a platform with 2 devices, one of type CPU and one of type GPU. I load my sources, compile them and save the binaries to disk then continue to run my application.
Now the user modifies something on the system. This could range from replacing hardware (CPU, GPU) to installing another driver. What's the proper way of dealing with this when my application runs again?
One way could be to just try and load all saved binaries into the driver and if that fails, just rebuild everything. Or is there some way to uniquely identify a device so I can be sure the binary will compile onto it?