public bool IsLesserVersionThan(NVIDIA_SMI_DRIVER b) { if(leftPart < b.leftPart) { return true; } if (leftPart == b.leftPart && getRightVal(rightPart) < getRightVal(b.rightPart)) { return true; } return false; }
public static void QueryDevices(IMessageNotifier messageNotifier) { MessageNotifier = messageNotifier; // #0 get video controllers, used for cross checking WindowsDisplayAdapters.QueryVideoControllers(); // Order important CPU Query must be first // #1 CPU CPU.QueryCPUs(); // #2 CUDA if (NVIDIA.IsSkipNVIDIA()) { Helpers.ConsolePrint(TAG, "Skipping NVIDIA device detection, settings are set to disabled"); } else { showMessageAndStep(International.GetText("Compute_Device_Query_Manager_CUDA_Query")); NVIDIA.QueryCudaDevices(); } // OpenCL and AMD if (ConfigManager.GeneralConfig.DeviceDetection.DisableDetectionAMD) { Helpers.ConsolePrint(TAG, "Skipping AMD device detection, settings set to disabled"); showMessageAndStep(International.GetText("Compute_Device_Query_Manager_AMD_Query_Skip")); } else { // #3 OpenCL showMessageAndStep(International.GetText("Compute_Device_Query_Manager_OpenCL_Query")); OpenCL.QueryOpenCLDevices(); // #4 AMD query AMD from OpenCL devices, get serial and add devices AMD.QueryAMD(); } // #5 uncheck CPU if GPUs present, call it after we Query all devices Group.UncheckedCPU(); // TODO update this to report undetected hardware // #6 check NVIDIA, AMD devices count int NVIDIA_count = 0; { int AMD_count = 0; foreach (var vidCtrl in AvaliableVideoControllers) { if(vidCtrl.Name.ToLower().Contains("nvidia") && CUDA_Unsupported.IsSupported(vidCtrl.Name)) { NVIDIA_count += 1; } else if (vidCtrl.Name.ToLower().Contains("nvidia")) { Helpers.ConsolePrint(TAG, "Device not supported NVIDIA/CUDA device not supported " + vidCtrl.Name); } AMD_count += (vidCtrl.Name.ToLower().Contains("amd")) ? 1 : 0; } if (NVIDIA_count == CudaDevices.Count) { Helpers.ConsolePrint(TAG, "Cuda NVIDIA/CUDA device count GOOD"); } else { Helpers.ConsolePrint(TAG, "Cuda NVIDIA/CUDA device count BAD!!!"); } if (AMD_count == amdGpus.Count) { Helpers.ConsolePrint(TAG, "AMD GPU device count GOOD"); } else { Helpers.ConsolePrint(TAG, "AMD GPU device count BAD!!!"); } } // allerts _currentNvidiaSMIDriver = GetNvidiaSMIDriver(); // if we have nvidia cards but no CUDA devices tell the user to upgrade driver bool isNvidiaErrorShown = false; // to prevent showing twice bool showWarning = ConfigManager.GeneralConfig.ShowDriverVersionWarning && WindowsDisplayAdapters.HasNvidiaVideoController(); if (showWarning && CudaDevices.Count != NVIDIA_count && _currentNvidiaSMIDriver.IsLesserVersionThan(NVIDIA_MIN_DETECTION_DRIVER)) { isNvidiaErrorShown = true; var minDriver = NVIDIA_MIN_DETECTION_DRIVER.ToString(); var recomendDrvier = NVIDIA_RECOMENDED_DRIVER.ToString(); MessageBox.Show(String.Format(International.GetText("Compute_Device_Query_Manager_NVIDIA_Driver_Detection"), minDriver, recomendDrvier), International.GetText("Compute_Device_Query_Manager_NVIDIA_RecomendedDriver_Title"), MessageBoxButtons.OK, MessageBoxIcon.Error); } // recomended driver if (showWarning && _currentNvidiaSMIDriver.IsLesserVersionThan(NVIDIA_RECOMENDED_DRIVER) && !isNvidiaErrorShown && _currentNvidiaSMIDriver.leftPart > -1) { var recomendDrvier = NVIDIA_RECOMENDED_DRIVER.ToString(); var nvdriverString = _currentNvidiaSMIDriver.leftPart > -1 ? String.Format(International.GetText("Compute_Device_Query_Manager_NVIDIA_Driver_Recomended_PART"), _currentNvidiaSMIDriver.ToString()) : ""; MessageBox.Show(String.Format(International.GetText("Compute_Device_Query_Manager_NVIDIA_Driver_Recomended"), recomendDrvier, nvdriverString, recomendDrvier), International.GetText("Compute_Device_Query_Manager_NVIDIA_RecomendedDriver_Title"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } // #x remove reference MessageNotifier = null; }