Library/ManagedCuda/CudaContext.cs
/// <summary>
/// Returns the device name of the device with ID <c>deviceID</c>
/// </summary>
/// <param name="deviceID"></param>
/// <returns>Device Name</returns>
Returns the device name of the device with ID deviceID
Returns the device name of the device with ID deviceID
public static string GetDeviceName(int deviceID)
		{
			byte[] devName = new byte[256];
			CUResult res = DriverAPINativeMethods.DeviceManagement.cuDeviceGetName(devName, 256, GetCUdevice(deviceID));
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuDeviceGetName", 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.cuDeviceGetName(devName, 256, GetCUdevice(deviceID));
				Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuDeviceGetName", res));
				if (res != CUResult.Success)
					throw new CudaException(res);
			}
			else
				if (res != CUResult.Success) throw new CudaException(res);
			System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
			return enc.GetString(devName).Replace("\0", "");
		}
public static string GetDeviceName ( int deviceID ) { byte [ ] devName = new byte [ 256 ] ; CUResult res = DriverAPINativeMethods . DeviceManagement . cuDeviceGetName ( devName , 256 , 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 . cuDeviceGetName ( devName , 256 , 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 ) ; System . Text . ASCIIEncoding enc = new System . Text . ASCIIEncoding ( ) ; return enc . GetString ( devName ) . Replace ( " \0 " , " " ) ; }
Returns the device name of the device with ID deviceID
Returns the device name of the device with ID deviceID
None
deviceID
int
None