/// <summary> /// Init OpenCL C language information. /// </summary> private void InitCInfo() { // Determine the supported OpenCL C version var clVersionString = CurrentAPI.GetDeviceInfo( DeviceId, CLDeviceInfoType.CL_DEVICE_OPENCL_C_VERSION); if (!CLCVersion.TryParse(clVersionString, out CLCVersion version)) { version = CLCVersion.CL10; } CVersion = version; }
/// <summary> /// Constructs a new OpenCL accelerator reference. /// </summary> /// <param name="platformId">The OpenCL platform id.</param> /// <param name="deviceId">The OpenCL device id.</param> public CLAcceleratorId(IntPtr platformId, IntPtr deviceId) : base(AcceleratorType.OpenCL) { if (platformId == IntPtr.Zero) { throw new ArgumentOutOfRangeException(nameof(platformId)); } if (deviceId == IntPtr.Zero) { throw new ArgumentOutOfRangeException(nameof(deviceId)); } PlatformId = platformId; DeviceId = deviceId; DeviceType = (CLDeviceType)CLAPI.GetDeviceInfo <long>( deviceId, CLDeviceInfoType.CL_DEVICE_TYPE); // Resolve extensions var extensionString = CLAPI.GetDeviceInfo( DeviceId, CLDeviceInfoType.CL_DEVICE_EXTENSIONS); extensionSet = new HashSet <string>( extensionString.ToLower().Split(' ')); Extensions = extensionSet.ToImmutableArray(); // Determine the supported OpenCL C version var clVersionString = CLAPI.GetDeviceInfo( DeviceId, CLDeviceInfoType.CL_DEVICE_OPENCL_C_VERSION); if (!CLCVersion.TryParse(clVersionString, out CLCVersion version)) { version = CLCVersion.CL10; } CVersion = version; // Resolve extension method getKernelSubGroupInfo = CLAPI.GetExtension <clGetKernelSubGroupInfoKHR>( platformId); }