コード例 #1
0
        private static void ThrowIfReturnIsError(NVMLReturnCodes returnCode)
        {
            if (returnCode == NVMLReturnCodes.Success)
            {
                return;
            }

            // https://stackoverflow.com/a/370093/528131
            var errorMessagePtr = NVMLFunctions.GetErrorString(returnCode);
            var errorMessage    = Marshal.PtrToStringAuto(errorMessagePtr);

            throw new Exception(string.Format("NVML Failure: {0} - {1}", returnCode, errorMessage));
        }
コード例 #2
0
 public static extern IntPtr GetErrorString(NVMLReturnCodes returnCode);