/// <summary> /// Gets a read-only collection of available devices on the platform. /// </summary> /// <returns> A read-only collection of the available devices on the platform. </returns> /// <remarks> This method resets the <c>ComputePlatform.Devices</c>. This is useful if one or more of them become unavailable (<c>ComputeDevice.Available</c> is <c>false</c>) after a device and command queues that use the device have been created and commands have been queued to them. Further calls will trigger an <c>OutOfResourcesComputeException</c> until this method is executed. You will also need to recreate any <see cref="ComputeResource"/> that was created on the no longer available device. </remarks> public ReadOnlyCollection <IComputeDevice> QueryDevices() { CL10.GetDeviceIDsWrapper(Handle, ComputeDeviceTypes.All, 0, null, out int handlesLength); var handles = new CLDeviceHandle[handlesLength]; CL10.GetDeviceIDsWrapper(Handle, ComputeDeviceTypes.All, handlesLength, handles, out handlesLength); var devices = new ComputeDevice[handlesLength]; for (int i = 0; i < handlesLength; i++) { devices[i] = new ComputeDevice(this, handles[i]); } Devices = new ReadOnlyCollection <IComputeDevice>(devices); return(Devices); }