Library/ManagedCuda/CudaContext.cs
/// <summary>
/// Returns the device's compute capability of the device with ID <c>deviceID</c>
/// </summary>
/// <param name="deviceID"></param>
/// <returns>Device compute capability</returns>
Returns the device's compute capability of the device with ID deviceID
Returns the device ' s compute capability of the device with ID deviceID
public static Version GetDeviceComputeCapability(int deviceID)
		{
			int major = 0, minor = 0;
			CUResult res = DriverAPINativeMethods.DeviceManagement.cuDeviceGetAttribute(ref minor, CUDeviceAttribute.ComputeCapabilityMinor, GetCUdevice(deviceID));
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuDeviceGetAttribute", res));
			if (res == CUResult.ErrorNotInitialized)
			{
				res = DriverAPINativeMethods.cuInit(CUInitializationFlags.None);
				Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuInit", res));
				if (res != CUResult.Success)
					throw new CudaException(res);
				res = DriverAPINativeMethods.DeviceManagement.cuDeviceGetAttribute(ref minor, CUDeviceAttribute.ComputeCapabilityMinor, GetCUdevice(deviceID));
				Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuDeviceGetAttribute", res));
				if (res != CUResult.Success)
					throw new CudaException(res);
				res = DriverAPINativeMethods.DeviceManagement.cuDeviceGetAttribute(ref major, CUDeviceAttribute.ComputeCapabilityMajor, GetCUdevice(deviceID));
				Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuDeviceGetAttribute", res));
				if (res != CUResult.Success)
					throw new CudaException(res);
			}
			else
			{
				if (res != CUResult.Success)
					throw new CudaException(res);
				else
				{
					res = DriverAPINativeMethods.DeviceManagement.cuDeviceGetAttribute(ref major, CUDeviceAttribute.ComputeCapabilityMajor, GetCUdevice(deviceID));
					Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuDeviceGetAttribute", res));
					if (res != CUResult.Success)
						throw new CudaException(res);
				}
			}
			return new Version(major, minor);
		}
public static Version GetDeviceComputeCapability ( int deviceID ) { int major = 0 , minor = 0 ; CUResult res = DriverAPINativeMethods . DeviceManagement . cuDeviceGetAttribute ( ref minor , CUDeviceAttribute . ComputeCapabilityMinor , GetCUdevice ( deviceID ) ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res == CUResult . ErrorNotInitialized ) { res = DriverAPINativeMethods . cuInit ( CUInitializationFlags . None ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res != CUResult . Success ) throw new CudaException ( res ) ; res = DriverAPINativeMethods . DeviceManagement . cuDeviceGetAttribute ( ref minor , CUDeviceAttribute . ComputeCapabilityMinor , GetCUdevice ( deviceID ) ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res != CUResult . Success ) throw new CudaException ( res ) ; res = DriverAPINativeMethods . DeviceManagement . cuDeviceGetAttribute ( ref major , CUDeviceAttribute . ComputeCapabilityMajor , GetCUdevice ( deviceID ) ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res != CUResult . Success ) throw new CudaException ( res ) ; } else { if ( res != CUResult . Success ) throw new CudaException ( res ) ; else { res = DriverAPINativeMethods . DeviceManagement . cuDeviceGetAttribute ( ref major , CUDeviceAttribute . ComputeCapabilityMajor , GetCUdevice ( deviceID ) ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res != CUResult . Success ) throw new CudaException ( res ) ; } } return new Version ( major , minor ) ; }
Returns the device's compute capability of the device with ID deviceID
Returns the device ' s compute capability of the device with ID deviceID
Device compute capability
Device compute capability
deviceID
int
None