public void SetUp() { device = (from platformid in Cl.GetPlatformIDs(out error) from deviceid in Cl.GetDeviceIDs(platformid, Cl.DeviceType.Gpu, out error) select deviceid).First(); context = Cl.CreateContext(null, 1, new[] { device }, null, IntPtr.Zero, out error); }
public ComputeProvider(params Cl.Device[] devices) { if (devices == null) throw new ArgumentNullException("devices"); if (devices.Length == 0) throw new ArgumentException("Need at least one device!"); _devices = devices; Cl.ErrorCode error; _context = Cl.CreateContext(null, (uint)devices.Length, _devices, null, IntPtr.Zero, out error); if (error != Cl.ErrorCode.Success) throw new CLException(error); }