コード例 #1
0
ファイル: NVML.cs プロジェクト: tr002196/GrinbleMiner
        private static bool GetDeviceByPciBusID(string fullPciBusID, out NvmlDevice device, out string errorMessage)
        {
            device = new NvmlDevice();

            var response =
                RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? PInvokeWindows.NvmlDeviceGetHandleByPciBusId(fullPciBusID, ref device)
                : RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? PInvokeLinux.NvmlDeviceGetHandleByPciBusId(fullPciBusID, ref device)
                : 12;

            errorMessage = (response == SUCCESS)
                 ? string.Empty
                 : NvmlErrorString(response);

            return(response == SUCCESS);
        }