From time to time I have problem running simple application with Cloo. Exception is thrown on second line of this code:
ComputeContextPropertyList cpl = new ComputeContextPropertyList(ComputePlatform.Platforms);
ComputeContext context = new ComputeContext(ComputeDeviceTypes.Gpu, cpl, null, IntPtr.Zero);
Exception message: OpenCL error code detected: DeviceNotAvailable.
I'm compiling with VisualStudio 2010, Cloo 0.9.0 on a laptop with Quadro 140M NVS and 260.99 notebook developer drivers.
According to Khronos this happens if: "…no devices that match device_type and property values specified in properties are currently available."
I'm not sure how you would go about fixing this. Maybe you could try the following:
ComputePlatform platform = ComputePlatform.Platforms;
int i = 0;
// keep checking until the device becomes available
while (!platform.Devices.Available && i++ < 10)
if (i == 10)
//else create context
ComputeContext context = new ComputeContext(
The counter will enable you to quit the loop after some trying.