private void SetLabelBenchmarkSteps(int current, int max) { labelBenchmarkSteps.Text = string.Format(International.GetText("FormBenchmark_Benchmark_Step"), current, max); }
private void UnzipThreadRoutine() { if (File.Exists(BinsZipLocation)) { Helpers.ConsolePrint(TAG, BinsZipLocation + " already downloaded"); Helpers.ConsolePrint(TAG, "unzipping"); using (ZipArchive archive = ZipFile.Open(BinsZipLocation, ZipArchiveMode.Read)) { //archive.ExtractToDirectory("bin"); _minerUpdateIndicator.SetMaxProgressValue(archive.Entries.Count); int prog = 0; // first create dirs foreach (ZipArchiveEntry entry in archive.Entries) { if (entry.Length == 0) { Helpers.ConsolePrint("ZipArchiveEntry", entry.FullName); Helpers.ConsolePrint("ZipArchiveEntry", entry.Length.ToString()); Directory.CreateDirectory(entry.FullName); _minerUpdateIndicator.SetProgressValueAndMsg(prog++, String.Format(International.GetText("MinersDownloadManager_Title_Settup_Unzipping"), ((double)(prog) / (double)(archive.Entries.Count) * 100).ToString("F2"))); } } // unzip files foreach (ZipArchiveEntry entry in archive.Entries) { if (entry.Length > 0) { Helpers.ConsolePrint("ZipArchiveEntry", entry.FullName); Helpers.ConsolePrint("ZipArchiveEntry", entry.Length.ToString()); entry.ExtractToFile(entry.FullName); _minerUpdateIndicator.SetProgressValueAndMsg(prog++, String.Format(International.GetText("MinersDownloadManager_Title_Settup_Unzipping"), ((double)(prog) / (double)(archive.Entries.Count) * 100).ToString("F2"))); } } } // after unzip stuff ConfigManager.Instance.GeneralConfig.DownloadInit = true; ConfigManager.Instance.GeneralConfig.Commit(); _minerUpdateIndicator.FinishMsg(IsMinersBinsInit()); // remove bins zip try { if (File.Exists(BinsZipLocation)) { File.Delete(BinsZipLocation); } } catch { } } else { Helpers.ConsolePrint(TAG, "UnzipThreadRoutine bin.zip file not found"); } }
protected override void BenchmarkThreadRoutine(object CommandLine) { Thread.Sleep(ConfigManager.GeneralConfig.MinerRestartDelayMS); BenchmarkSignalQuit = false; BenchmarkSignalHanged = false; BenchmarkSignalFinnished = false; BenchmarkException = null; try { Helpers.ConsolePrint("BENCHMARK", "Benchmark starts"); BenchmarkHandle = BenchmarkStartProcess((string)CommandLine); BenchmarkThreadRoutineStartSettup(); // wait a little longer then the benchmark routine if exit false throw //var timeoutTime = BenchmarkTimeoutInSeconds(BenchmarkTimeInSeconds); //var exitSucces = BenchmarkHandle.WaitForExit(timeoutTime * 1000); // don't use wait for it breaks everything BenchmarkProcessStatus = BenchmarkProcessStatus.Running; while (true) { string outdata = BenchmarkHandle.StandardOutput.ReadLine(); BenchmarkOutputErrorDataReceivedImpl(outdata); // terminate process situations if (BenchmarkSignalQuit || BenchmarkSignalFinnished || BenchmarkSignalHanged || BenchmarkSignalTimedout || BenchmarkException != null) { //EndBenchmarkProcces(); // this is safe in a benchmark KillSGMiner(); if (BenchmarkSignalTimedout) { throw new Exception("Benchmark timedout"); } if (BenchmarkException != null) { throw BenchmarkException; } if (BenchmarkSignalQuit) { throw new Exception("Termined by user request"); } if (BenchmarkSignalHanged) { throw new Exception("SGMiner is not responding"); } if (BenchmarkSignalFinnished) { break; } } } } catch (Exception ex) { BenchmarkAlgorithm.BenchmarkSpeed = 0; Helpers.ConsolePrint(MinerTAG(), "Benchmark Exception: " + ex.Message); if (BenchmarkComunicator != null && !OnBenchmarkCompleteCalled) { OnBenchmarkCompleteCalled = true; BenchmarkComunicator.OnBenchmarkComplete(false, BenchmarkSignalTimedout ? International.GetText("Benchmark_Timedout") : International.GetText("Benchmark_Terminated")); } } finally { BenchmarkProcessStatus = BenchmarkProcessStatus.Success; Helpers.ConsolePrint("BENCHMARK", "Final Speed: " + Helpers.FormatSpeedOutput(BenchmarkAlgorithm.BenchmarkSpeed)); Helpers.ConsolePrint("BENCHMARK", "Benchmark ends"); if (BenchmarkComunicator != null && !OnBenchmarkCompleteCalled) { OnBenchmarkCompleteCalled = true; BenchmarkComunicator.OnBenchmarkComplete(true, "Success"); } } }
private void toolTip1_Popup(object sender, PopupEventArgs e) { toolTip1.ToolTipTitle = International.GetText("Form_Settings_ToolTip_Explaination"); }
private void InitializeToolTip() { // Setup Tooltips toolTip1.SetToolTip(this.comboBox_Language, International.GetText("Form_Settings_ToolTip_Language")); toolTip1.SetToolTip(this.label_Language, International.GetText("Form_Settings_ToolTip_Language")); toolTip1.SetToolTip(this.pictureBox_Language, International.GetText("Form_Settings_ToolTip_Language")); toolTip1.SetToolTip(this.checkBox_DebugConsole, International.GetText("Form_Settings_ToolTip_checkBox_DebugConsole")); toolTip1.SetToolTip(this.pictureBox_DebugConsole, International.GetText("Form_Settings_ToolTip_checkBox_DebugConsole")); toolTip1.SetToolTip(this.textBox_BitcoinAddress, International.GetText("Form_Settings_ToolTip_BitcoinAddress")); toolTip1.SetToolTip(this.label_BitcoinAddress, International.GetText("Form_Settings_ToolTip_BitcoinAddress")); toolTip1.SetToolTip(this.pictureBox_Info_BitcoinAddress, International.GetText("Form_Settings_ToolTip_BitcoinAddress")); toolTip1.SetToolTip(this.textBox_WorkerName, International.GetText("Form_Settings_ToolTip_WorkerName")); toolTip1.SetToolTip(this.label_WorkerName, International.GetText("Form_Settings_ToolTip_WorkerName")); toolTip1.SetToolTip(this.pictureBox_WorkerName, International.GetText("Form_Settings_ToolTip_WorkerName")); toolTip1.SetToolTip(this.comboBox_ServiceLocation, International.GetText("Form_Settings_ToolTip_ServiceLocation")); toolTip1.SetToolTip(this.label_ServiceLocation, International.GetText("Form_Settings_ToolTip_ServiceLocation")); toolTip1.SetToolTip(this.pictureBox_ServiceLocation, International.GetText("Form_Settings_ToolTip_ServiceLocation")); toolTip1.SetToolTip(this.checkBox_HideMiningWindows, International.GetText("Form_Settings_ToolTip_checkBox_HideMiningWindows")); toolTip1.SetToolTip(this.pictureBox_HideMiningWindows, International.GetText("Form_Settings_ToolTip_checkBox_HideMiningWindows")); toolTip1.SetToolTip(this.checkBox_MinimizeToTray, International.GetText("Form_Settings_ToolTip_checkBox_MinimizeToTray")); toolTip1.SetToolTip(this.pictureBox_MinimizeToTray, International.GetText("Form_Settings_ToolTip_checkBox_MinimizeToTray")); toolTip1.SetToolTip(this.checkBox_Use3rdPartyMiners, International.GetText("Form_Settings_General_3rdparty_ToolTip")); toolTip1.SetToolTip(this.pictureBox_Use3rdPartyMiners, International.GetText("Form_Settings_General_3rdparty_ToolTip")); toolTip1.SetToolTip(this.checkBox_AllowMultipleInstances, International.GetText("Form_Settings_General_AllowMultipleInstances_ToolTip")); toolTip1.SetToolTip(this.pictureBox_AllowMultipleInstances, International.GetText("Form_Settings_General_AllowMultipleInstances_ToolTip")); toolTip1.SetToolTip(this.textBox_SwitchMinSecondsFixed, International.GetText("Form_Settings_ToolTip_SwitchMinSecondsFixed")); toolTip1.SetToolTip(this.label_SwitchMinSecondsFixed, International.GetText("Form_Settings_ToolTip_SwitchMinSecondsFixed")); toolTip1.SetToolTip(this.pictureBox_SwitchMinSecondsFixed, International.GetText("Form_Settings_ToolTip_SwitchMinSecondsFixed")); toolTip1.SetToolTip(this.label_MinProfit, International.GetText("Form_Settings_ToolTip_MinimumProfit")); toolTip1.SetToolTip(this.pictureBox_MinProfit, International.GetText("Form_Settings_ToolTip_MinimumProfit")); toolTip1.SetToolTip(this.textBox_MinProfit, International.GetText("Form_Settings_ToolTip_MinimumProfit")); toolTip1.SetToolTip(this.textBox_SwitchMinSecondsDynamic, International.GetText("Form_Settings_ToolTip_SwitchMinSecondsDynamic")); toolTip1.SetToolTip(this.label_SwitchMinSecondsDynamic, International.GetText("Form_Settings_ToolTip_SwitchMinSecondsDynamic")); toolTip1.SetToolTip(this.pictureBox_SwitchMinSecondsDynamic, International.GetText("Form_Settings_ToolTip_SwitchMinSecondsDynamic")); toolTip1.SetToolTip(this.textBox_SwitchMinSecondsAMD, International.GetText("Form_Settings_ToolTip_SwitchMinSecondsAMD")); toolTip1.SetToolTip(this.label_SwitchMinSecondsAMD, International.GetText("Form_Settings_ToolTip_SwitchMinSecondsAMD")); toolTip1.SetToolTip(this.pictureBox_SwitchMinSecondsAMD, International.GetText("Form_Settings_ToolTip_SwitchMinSecondsAMD")); toolTip1.SetToolTip(this.textBox_MinerAPIQueryInterval, International.GetText("Form_Settings_ToolTip_MinerAPIQueryInterval")); toolTip1.SetToolTip(this.label_MinerAPIQueryInterval, International.GetText("Form_Settings_ToolTip_MinerAPIQueryInterval")); toolTip1.SetToolTip(this.pictureBox_MinerAPIQueryInterval, International.GetText("Form_Settings_ToolTip_MinerAPIQueryInterval")); toolTip1.SetToolTip(this.textBox_MinerRestartDelayMS, International.GetText("Form_Settings_ToolTip_MinerRestartDelayMS")); toolTip1.SetToolTip(this.label_MinerRestartDelayMS, International.GetText("Form_Settings_ToolTip_MinerRestartDelayMS")); toolTip1.SetToolTip(this.pictureBox_MinerRestartDelayMS, International.GetText("Form_Settings_ToolTip_MinerRestartDelayMS")); toolTip1.SetToolTip(this.textBox_APIBindPortStart, International.GetText("Form_Settings_ToolTip_APIBindPortStart")); toolTip1.SetToolTip(this.label_APIBindPortStart, International.GetText("Form_Settings_ToolTip_APIBindPortStart")); toolTip1.SetToolTip(this.pictureBox_APIBindPortStart, International.GetText("Form_Settings_ToolTip_APIBindPortStart")); toolTip1.SetToolTip(this.comboBox_DagLoadMode, International.GetText("Form_Settings_ToolTip_DagGeneration")); toolTip1.SetToolTip(this.label_DagGeneration, International.GetText("Form_Settings_ToolTip_DagGeneration")); toolTip1.SetToolTip(this.pictureBox_DagGeneration, International.GetText("Form_Settings_ToolTip_DagGeneration")); benchmarkLimitControlCPU.SetToolTip(ref toolTip1, "CPUs"); benchmarkLimitControlNVIDIA.SetToolTip(ref toolTip1, "NVIDIA GPUs"); benchmarkLimitControlAMD.SetToolTip(ref toolTip1, "AMD GPUs"); toolTip1.SetToolTip(this.checkBox_DisableDetectionNVIDIA, String.Format(International.GetText("Form_Settings_ToolTip_checkBox_DisableDetection"), "NVIDIA")); toolTip1.SetToolTip(this.checkBox_DisableDetectionAMD, String.Format(International.GetText("Form_Settings_ToolTip_checkBox_DisableDetection"), "AMD")); toolTip1.SetToolTip(this.pictureBox_DisableDetectionNVIDIA, String.Format(International.GetText("Form_Settings_ToolTip_checkBox_DisableDetection"), "NVIDIA")); toolTip1.SetToolTip(this.pictureBox_DisableDetectionAMD, String.Format(International.GetText("Form_Settings_ToolTip_checkBox_DisableDetection"), "AMD")); toolTip1.SetToolTip(this.checkBox_AutoScaleBTCValues, International.GetText("Form_Settings_ToolTip_checkBox_AutoScaleBTCValues")); toolTip1.SetToolTip(this.pictureBox_AutoScaleBTCValues, International.GetText("Form_Settings_ToolTip_checkBox_AutoScaleBTCValues")); toolTip1.SetToolTip(this.checkBox_StartMiningWhenIdle, International.GetText("Form_Settings_ToolTip_checkBox_StartMiningWhenIdle")); toolTip1.SetToolTip(this.pictureBox_StartMiningWhenIdle, International.GetText("Form_Settings_ToolTip_checkBox_StartMiningWhenIdle")); toolTip1.SetToolTip(this.textBox_MinIdleSeconds, International.GetText("Form_Settings_ToolTip_MinIdleSeconds")); toolTip1.SetToolTip(this.label_MinIdleSeconds, International.GetText("Form_Settings_ToolTip_MinIdleSeconds")); toolTip1.SetToolTip(this.pictureBox_MinIdleSeconds, International.GetText("Form_Settings_ToolTip_MinIdleSeconds")); toolTip1.SetToolTip(this.checkBox_LogToFile, International.GetText("Form_Settings_ToolTip_checkBox_LogToFile")); toolTip1.SetToolTip(this.pictureBox_LogToFile, International.GetText("Form_Settings_ToolTip_checkBox_LogToFile")); toolTip1.SetToolTip(this.textBox_LogMaxFileSize, International.GetText("Form_Settings_ToolTip_LogMaxFileSize")); toolTip1.SetToolTip(this.label_LogMaxFileSize, International.GetText("Form_Settings_ToolTip_LogMaxFileSize")); toolTip1.SetToolTip(this.pictureBox_LogMaxFileSize, International.GetText("Form_Settings_ToolTip_LogMaxFileSize")); toolTip1.SetToolTip(this.checkBox_ShowDriverVersionWarning, International.GetText("Form_Settings_ToolTip_checkBox_ShowDriverVersionWarning")); toolTip1.SetToolTip(this.pictureBox_ShowDriverVersionWarning, International.GetText("Form_Settings_ToolTip_checkBox_ShowDriverVersionWarning")); toolTip1.SetToolTip(this.checkBox_DisableWindowsErrorReporting, International.GetText("Form_Settings_ToolTip_checkBox_DisableWindowsErrorReporting")); toolTip1.SetToolTip(this.pictureBox_DisableWindowsErrorReporting, International.GetText("Form_Settings_ToolTip_checkBox_DisableWindowsErrorReporting")); toolTip1.SetToolTip(this.checkBox_NVIDIAP0State, International.GetText("Form_Settings_ToolTip_checkBox_NVIDIAP0State")); toolTip1.SetToolTip(this.pictureBox_NVIDIAP0State, International.GetText("Form_Settings_ToolTip_checkBox_NVIDIAP0State")); toolTip1.SetToolTip(this.checkBox_AutoStartMining, International.GetText("Form_Settings_ToolTip_checkBox_AutoStartMining")); toolTip1.SetToolTip(this.pictureBox_AutoStartMining, International.GetText("Form_Settings_ToolTip_checkBox_AutoStartMining")); toolTip1.SetToolTip(this.textBox_ethminerDefaultBlockHeight, International.GetText("Form_Settings_ToolTip_ethminerDefaultBlockHeight")); toolTip1.SetToolTip(this.label_ethminerDefaultBlockHeight, International.GetText("Form_Settings_ToolTip_ethminerDefaultBlockHeight")); toolTip1.SetToolTip(this.pictureBox_ethminerDefaultBlockHeight, International.GetText("Form_Settings_ToolTip_ethminerDefaultBlockHeight")); toolTip1.SetToolTip(this.label_displayCurrency, International.GetText("Form_Settings_ToolTip_DisplayCurrency")); toolTip1.SetToolTip(this.pictureBox_displayCurrency, International.GetText("Form_Settings_ToolTip_DisplayCurrency")); toolTip1.SetToolTip(this.currencyConverterCombobox, International.GetText("Form_Settings_ToolTip_DisplayCurrency")); // Setup Tooltips CPU toolTip1.SetToolTip(comboBox_CPU0_ForceCPUExtension, International.GetText("Form_Settings_ToolTip_CPU_ForceCPUExtension")); toolTip1.SetToolTip(label_CPU0_ForceCPUExtension, International.GetText("Form_Settings_ToolTip_CPU_ForceCPUExtension")); toolTip1.SetToolTip(pictureBox_CPU0_ForceCPUExtension, International.GetText("Form_Settings_ToolTip_CPU_ForceCPUExtension")); // amd disable temp control toolTip1.SetToolTip(checkBox_AMD_DisableAMDTempControl, International.GetText("Form_Settings_ToolTip_DisableAMDTempControl")); toolTip1.SetToolTip(pictureBox_AMD_DisableAMDTempControl, International.GetText("Form_Settings_ToolTip_DisableAMDTempControl")); // disable default optimizations toolTip1.SetToolTip(checkBox_DisableDefaultOptimizations, International.GetText("Form_Settings_ToolTip_DisableDefaultOptimizations")); toolTip1.SetToolTip(pictureBox_DisableDefaultOptimizations, International.GetText("Form_Settings_ToolTip_DisableDefaultOptimizations")); // internet connection mining check toolTip1.SetToolTip(checkBox_IdleWhenNoInternetAccess, International.GetText("Form_Settings_ToolTip_ContinueMiningIfNoInternetAccess")); toolTip1.SetToolTip(pictureBox_IdleWhenNoInternetAccess, International.GetText("Form_Settings_ToolTip_ContinueMiningIfNoInternetAccess")); this.Text = International.GetText("Form_Settings_Title"); algorithmSettingsControl1.InitLocale(toolTip1); }
public void InitLocale() { listViewDevices.Columns[ENABLED].Text = International.GetText("ListView_Device"); //International.GetText("ListView_Enabled"); //listViewDevices.Columns[DEVICE].Text = International.GetText("ListView_Device"); }
private void QueryAMD() { Helpers.ConsolePrint(TAG, "QueryAMD START"); //showMessageAndStep(International.GetText("Form_Main_loadtext_AMD")); //var dump = new sgminer(true); if (ConfigManager.Instance.GeneralConfig.DeviceDetection.DisableDetectionAMD) { Helpers.ConsolePrint(TAG, "Skipping AMD device detection, settings set to disabled"); showMessageAndStep(International.GetText("Compute_Device_Query_Manager_AMD_Query_Skip")); return; } #region AMD driver check, ADL returns 0 // check the driver version bool EnableOptimizedVersion = true; Dictionary <string, bool> deviceDriverOld = new Dictionary <string, bool>(); string minerPath = MinerPaths.sgminer_5_5_0_general; bool ShowWarningDialog = false; foreach (var vidContrllr in AvaliableVideoControllers) { Helpers.ConsolePrint(TAG, String.Format("Checking AMD device (driver): {0} ({1})", vidContrllr.Name, vidContrllr.DriverVersion)); deviceDriverOld[vidContrllr.Name] = false; // TODO checking radeon drivers only? if ((vidContrllr.Name.Contains("AMD") || vidContrllr.Name.Contains("Radeon")) && ShowWarningDialog == false) { Version AMDDriverVersion = new Version(vidContrllr.DriverVersion); if (AMDDriverVersion.Major < 15) { ShowWarningDialog = true; deviceDriverOld[vidContrllr.Name] = true; Helpers.ConsolePrint(TAG, "WARNING!!! Old AMD GPU driver detected! All optimized versions disabled, mining " + "speed will not be optimal. Consider upgrading AMD GPU driver. Recommended AMD GPU driver version is 15.7.1."); } else if (AMDDriverVersion.Major == 16 && AMDDriverVersion.Minor >= 150) { if (MinersDownloadManager.Instance.IsMinerBinFolder()) { // TODO why this copy? string src = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\" + minerPath.Split('\\')[0] + "\\" + minerPath.Split('\\')[1] + "\\kernel"; foreach (var file in Directory.GetFiles(src)) { string dest = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Temp\\" + System.IO.Path.GetFileName(file); if (!File.Exists(dest)) { File.Copy(file, dest, false); } } } } } } if (ConfigManager.Instance.GeneralConfig.ShowDriverVersionWarning && ShowWarningDialog == true) { Form WarningDialog = new DriverVersionConfirmationDialog(); WarningDialog.ShowDialog(); WarningDialog = null; } #endregion // AMD driver check // get platform version showMessageAndStep(International.GetText("Compute_Device_Query_Manager_AMD_Query")); List <OpenCLDevice> amdOCLDevices = new List <OpenCLDevice>(); string AMDOpenCLPlatformStringKey = ""; if (IsOpenCLQuerrySuccess) { bool amdPlatformNumFound = false; foreach (var oclEl in OpenCLJSONData) { if (oclEl.PlatformName.Contains("AMD") || oclEl.PlatformName.Contains("amd")) { amdPlatformNumFound = true; AMDOpenCLPlatformStringKey = oclEl.PlatformName; AMDOpenCLPlatformNum = oclEl.PlatformNum; amdOCLDevices = oclEl.Devices; Helpers.ConsolePrint(TAG, String.Format("AMD platform found: Key: {0}, Num: {1}", AMDOpenCLPlatformStringKey, AMDOpenCLPlatformNum.ToString())); break; } } if (amdPlatformNumFound) { // get only AMD gpus { foreach (var oclDev in amdOCLDevices) { if (oclDev._CL_DEVICE_TYPE.Contains("GPU")) { amdGpus.Add(oclDev); } } } if (amdGpus.Count == 0) { Helpers.ConsolePrint(TAG, "AMD GPUs count is 0"); } else { Helpers.ConsolePrint(TAG, "AMD GPUs count : " + amdGpus.Count.ToString()); Helpers.ConsolePrint(TAG, "AMD Getting device name and serial from ADL"); // ADL bool isAdlInit = true; // ADL does not get devices in order map devices by bus number // bus id, <name, uuid> Dictionary <int, Tuple <string, string> > _busIdsInfo = new Dictionary <int, Tuple <string, string> >(); List <string> _amdDeviceName = new List <string>(); List <string> _amdDeviceUUID = new List <string>(); try { int ADLRet = -1; int NumberOfAdapters = 0; if (null != ADL.ADL_Main_Control_Create) { // Second parameter is 1: Get only the present adapters ADLRet = ADL.ADL_Main_Control_Create(ADL.ADL_Main_Memory_Alloc, 1); } if (ADL.ADL_SUCCESS == ADLRet) { if (null != ADL.ADL_Adapter_NumberOfAdapters_Get) { ADL.ADL_Adapter_NumberOfAdapters_Get(ref NumberOfAdapters); } Helpers.ConsolePrint(TAG, "Number Of Adapters: " + NumberOfAdapters.ToString()); if (0 < NumberOfAdapters) { // Get OS adpater info from ADL ADLAdapterInfoArray OSAdapterInfoData; OSAdapterInfoData = new ADLAdapterInfoArray(); if (null != ADL.ADL_Adapter_AdapterInfo_Get) { IntPtr AdapterBuffer = IntPtr.Zero; int size = Marshal.SizeOf(OSAdapterInfoData); AdapterBuffer = Marshal.AllocCoTaskMem((int)size); Marshal.StructureToPtr(OSAdapterInfoData, AdapterBuffer, false); if (null != ADL.ADL_Adapter_AdapterInfo_Get) { ADLRet = ADL.ADL_Adapter_AdapterInfo_Get(AdapterBuffer, size); if (ADL.ADL_SUCCESS == ADLRet) { OSAdapterInfoData = (ADLAdapterInfoArray)Marshal.PtrToStructure(AdapterBuffer, OSAdapterInfoData.GetType()); int IsActive = 0; for (int i = 0; i < NumberOfAdapters; i++) { // Check if the adapter is active if (null != ADL.ADL_Adapter_Active_Get) { ADLRet = ADL.ADL_Adapter_Active_Get(OSAdapterInfoData.ADLAdapterInfo[i].AdapterIndex, ref IsActive); } if (ADL.ADL_SUCCESS == ADLRet) { // we are looking for amd // TODO check discrete and integrated GPU separation var vendorID = OSAdapterInfoData.ADLAdapterInfo[i].VendorID; var devName = OSAdapterInfoData.ADLAdapterInfo[i].AdapterName; if (vendorID == AMD_VENDOR_ID || devName.ToLower().Contains("amd") || devName.ToLower().Contains("radeon") || devName.ToLower().Contains("firepro")) { string PNPStr = OSAdapterInfoData.ADLAdapterInfo[i].PNPString; var backSlashLast = PNPStr.LastIndexOf('\\'); var serial = PNPStr.Substring(backSlashLast, PNPStr.Length - backSlashLast); var end_0 = serial.IndexOf('&'); var end_1 = serial.IndexOf('&', end_0 + 1); // get serial serial = serial.Substring(end_0 + 1, (end_1 - end_0) - 1); var udid = OSAdapterInfoData.ADLAdapterInfo[i].UDID; var pciVen_id_strSize = 21; // PCI_VEN_XXXX&DEV_XXXX var uuid = udid.Substring(0, pciVen_id_strSize) + "_" + serial; int budId = OSAdapterInfoData.ADLAdapterInfo[i].BusNumber; if (!_amdDeviceUUID.Contains(uuid)) { try { Helpers.ConsolePrint(TAG, String.Format("ADL device added BusNumber:{0} NAME:{1} UUID:{2}"), budId, devName, uuid); } catch { } _amdDeviceUUID.Add(uuid); //_busIds.Add(OSAdapterInfoData.ADLAdapterInfo[i].BusNumber); _amdDeviceName.Add(devName); if (!_busIdsInfo.ContainsKey(budId)) { var nameUuid = new Tuple <string, string>(devName, uuid); _busIdsInfo.Add(budId, nameUuid); } } } } } } else { Helpers.ConsolePrint(TAG, "ADL_Adapter_AdapterInfo_Get() returned error code " + ADLRet.ToString()); } } // Release the memory for the AdapterInfo structure if (IntPtr.Zero != AdapterBuffer) { Marshal.FreeCoTaskMem(AdapterBuffer); } } } if (null != ADL.ADL_Main_Control_Destroy) { ADL.ADL_Main_Control_Destroy(); } } else { // TODO Helpers.ConsolePrint(TAG, "ADL_Main_Control_Create() returned error code " + ADLRet.ToString()); Helpers.ConsolePrint(TAG, "Check if ADL is properly installed!"); } } catch (Exception ex) { Helpers.ConsolePrint(TAG, "AMD ADL exception: " + ex.Message); isAdlInit = false; } if (isAdlInit) { if (amdGpus.Count == _amdDeviceUUID.Count) { Helpers.ConsolePrint(TAG, "AMD OpenCL and ADL AMD query COUNTS GOOD/SAME"); } else { Helpers.ConsolePrint(TAG, "AMD OpenCL and ADL AMD query COUNTS DIFFERENT/BAD"); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(""); stringBuilder.AppendLine("QueryAMD devices: "); for (int i_id = 0; i_id < amdGpus.Count; ++i_id) { HasAMD = true; int busID = amdGpus[i_id].AMD_BUS_ID; if (busID != -1 && _busIdsInfo.ContainsKey(busID)) { var deviceName = _busIdsInfo[busID].Item1; var newAmdDev = new AmdGpuDevice(amdGpus[i_id], deviceDriverOld[deviceName]); newAmdDev.DeviceName = deviceName; newAmdDev.UUID = _busIdsInfo[busID].Item2; bool isDisabledGroup = ConfigManager.Instance.GeneralConfig.DeviceDetection.DisableDetectionAMD; string skipOrAdd = isDisabledGroup ? "SKIPED" : "ADDED"; string isDisabledGroupStr = isDisabledGroup ? " (AMD group disabled)" : ""; string etherumCapableStr = newAmdDev.IsEtherumCapable() ? "YES" : "NO"; new ComputeDevice(newAmdDev, true, true); // just in case try { stringBuilder.AppendLine(String.Format("\t{0} device{1}:", skipOrAdd, isDisabledGroupStr)); stringBuilder.AppendLine(String.Format("\t\tID: {0}", newAmdDev.DeviceID.ToString())); stringBuilder.AppendLine(String.Format("\t\tNAME: {0}", newAmdDev.DeviceName)); stringBuilder.AppendLine(String.Format("\t\tCODE_NAME: {0}", newAmdDev.Codename)); stringBuilder.AppendLine(String.Format("\t\tUUID: {0}", newAmdDev.UUID)); stringBuilder.AppendLine(String.Format("\t\tMEMORY: {0}", newAmdDev.DeviceGlobalMemory.ToString())); stringBuilder.AppendLine(String.Format("\t\tETHEREUM: {0}", etherumCapableStr)); } catch { } } else { stringBuilder.AppendLine(String.Format("\tDevice not added, Bus No. {0} not found:", busID)); } } Helpers.ConsolePrint(TAG, stringBuilder.ToString()); } } } } Helpers.ConsolePrint(TAG, "QueryAMD END"); }
private bool StartButonClick() { CalcBenchmarkDevicesAlgorithmQueue(); // device selection check scope { bool noneSelected = true; foreach (var cDev in ComputeDeviceManager.Avaliable.AllAvaliableDevices) { if (cDev.Enabled) { noneSelected = false; break; } } if (noneSelected) { MessageBox.Show(International.GetText("FormBenchmark_No_Devices_Selected_Msg"), International.GetText("FormBenchmark_No_Devices_Selected_Title"), MessageBoxButtons.OK); return(false); } } // device todo benchmark check scope { bool nothingToBench = true; foreach (var statusKpv in _benchmarkDevicesAlgorithmStatus) { if (statusKpv.Value == BenchmarkSettingsStatus.TODO) { nothingToBench = false; break; } } if (nothingToBench) { MessageBox.Show(International.GetText("FormBenchmark_Nothing_to_Benchmark_Msg"), International.GetText("FormBenchmark_Nothing_to_Benchmark_Title"), MessageBoxButtons.OK); return(false); } } // current failed new list _benchmarkFailedAlgoPerDev = new List <DeviceAlgo>(); // disable gui controls benchmarkOptions1.Enabled = false; CloseBtn.Enabled = false; algorithmsListView1.IsInBenchmark = true; devicesListViewEnableControl1.IsInBenchmark = true; // set benchmark pending status foreach (var deviceAlgosTuple in _benchmarkDevicesAlgorithmQueue) { foreach (var algo in deviceAlgosTuple.Item2) { algo.SetBenchmarkPending(); } } if (_currentDevice != null) { algorithmsListView1.RepaintStatus(_currentDevice.Enabled, _currentDevice.UUID); } StartBenchmark(); return(true); }
/// <summary> /// SwichMostProfitable should check the best combination for most profit. /// Calculate profit for each supported algorithm per device group. /// Build from ground up compatible devices and algorithms. /// See #region Groupping logic /// Device groups are CPU, AMD_OpenCL and NVIDIA CUDA SM.x.x. /// NVIDIA SMx.x should be paired separately except for daggerhashimoto. /// </summary> /// <param name="NiceHashData"></param> public void SwichMostProfitableGroupUpMethod(Dictionary <AlgorithmType, NiceHashSMA> NiceHashData) { var devProfits = GetEnabledDeviceProifitDictionary(_perDeviceSpeedDictionary, NiceHashData); #if (SWITCH_TESTING) SwitchTesting.Instance.SetNext(ref devProfits, _enabledDevices); #endif double CurrentProfit = 0.0d; // calculate most profitable algorithm per enabled device foreach (var cdev in _enabledDevices) { var curDevProfits = devProfits[cdev.UUID]; double maxProfit = double.MinValue; AlgorithmType maxAlgorithmTypeKey = AlgorithmType.NONE; var algorithmSettings = cdev.DeviceBenchmarkConfig.AlgorithmSettings; foreach (var kvpTypeProfit in curDevProfits) { if (algorithmSettings.ContainsKey(kvpTypeProfit.Key) && !algorithmSettings[kvpTypeProfit.Key].Skip && kvpTypeProfit.Value > 0.0d && maxProfit < kvpTypeProfit.Value) { // extra check if current device can't handle dagger if (AlgorithmType.DaggerHashimoto == kvpTypeProfit.Key && !cdev.IsEtherumCapale) { continue; } maxProfit = kvpTypeProfit.Value; maxAlgorithmTypeKey = kvpTypeProfit.Key; } } if (maxAlgorithmTypeKey == AlgorithmType.NONE) { cdev.MostProfitableAlgorithm = null; } else { cdev.MostProfitableAlgorithm = algorithmSettings[maxAlgorithmTypeKey]; // add most profitable to cumulative profit CurrentProfit += maxProfit; } } // now if profitable check // TODO FOR NOW USD ONLY var currentProfitUSD = (CurrentProfit * Globals.BitcoinRate); Helpers.ConsolePrint(TAG, "Current Global profit: " + currentProfitUSD.ToString("F8") + " USD/Day"); if (!IsConnectedToInternet || (ConfigManager.Instance.GeneralConfig.MinimumProfit > 0 && currentProfitUSD < ConfigManager.Instance.GeneralConfig.MinimumProfit)) { IsProfitable = false; IsCurrentlyIdle = true; if (!IsConnectedToInternet) { // change msg Helpers.ConsolePrint(TAG, "NO INTERNET!!! Stopping mining."); _mainFormRatesComunication.ShowNotProfitable(International.GetText("Form_Main_MINING_NO_INTERNET_CONNECTION")); } else { _mainFormRatesComunication.ShowNotProfitable(International.GetText("Form_Main_MINING_NOT_PROFITABLE")); } // return don't group StopAllMinersNonProfitable(); Helpers.ConsolePrint(TAG, "Current Global profit: NOT PROFITABLE MinProfit " + ConfigManager.Instance.GeneralConfig.MinimumProfit.ToString("F8") + " USD/Day"); return; } else { IsProfitable = true; IsCurrentlyIdle = false; _mainFormRatesComunication.HideNotProfitable(); string profitabilityInfo = ConfigManager.Instance.GeneralConfig.MinimumProfit == 0 ? "mine always regardless of profit" : ConfigManager.Instance.GeneralConfig.MinimumProfit.ToString("F8") + " USD/Day"; Helpers.ConsolePrint(TAG, "Current Global profit: IS PROFITABLE MinProfit " + profitabilityInfo); } // group devices with same supported algorithms _previousAllGroupedDevices = _currentAllGroupedDevices; _currentAllGroupedDevices = new AllGroupedDevices(); Dictionary <GroupedDevices, Algorithm> newGroupAndAlgorithm = new Dictionary <GroupedDevices, Algorithm>(); for (int first = 0; first < _enabledDevices.Count; ++first) { var firstDev = _enabledDevices[first]; // skip if no algorithm is profitable if (firstDev.MostProfitableAlgorithm == null) { Helpers.ConsolePrint("SwichMostProfitableGroupUpMethod", String.Format("Device {0}, MostProfitableAlgorithm == null", firstDev.Name)); continue; } // check if is in group bool isInGroup = false; foreach (var groupedDevices in _currentAllGroupedDevices) { if (groupedDevices.Contains(firstDev.UUID)) { isInGroup = true; break; } } if (isInGroup) { continue; } var newGroup = new GroupedDevices(); newGroup.Add(firstDev.UUID); for (int second = first + 1; second < _enabledDevices.Count; ++second) { var secondDev = _enabledDevices[second]; // first check if second device has profitable algorithm if (secondDev.MostProfitableAlgorithm != null) { // check if we should group if (IsEquihashAndOneCPU(firstDev, secondDev) || // if one CPU group them all IsEquihashAndOneNOTCPU(firstDev, secondDev) || IsDaggerAndSameComputePlatform(firstDev, secondDev) || IsGroupBinaryAndAlgorithmSame(firstDev, secondDev)) { newGroup.Add(secondDev.UUID); } } } _currentAllGroupedDevices.Add(newGroup); newGroupAndAlgorithm.Add(newGroup, firstDev.MostProfitableAlgorithm); } // stop groupes that aren't in current group devices foreach (var curPrevGroup in _previousAllGroupedDevices) { var curPrevGroupKey = CalcGroupedDevicesKey(curPrevGroup); bool contains = false; foreach (var curCheckGroup in _currentAllGroupedDevices) { var curCheckGroupKey = CalcGroupedDevicesKey(curCheckGroup); if (curPrevGroupKey == curCheckGroupKey) { contains = true; break; } } if (!contains) { _groupedDevicesMiners[curPrevGroupKey].Stop(); } } // switch to newGroupAndAlgorithm most profitable algorithm foreach (var kvpGroupAlgorithm in newGroupAndAlgorithm) { var group = kvpGroupAlgorithm.Key; var algorithm = kvpGroupAlgorithm.Value; GroupMiners currentGroupMiners; // try find if it doesn't exist create new string groupStringKey = CalcGroupedDevicesKey(group); if (!_groupedDevicesMiners.TryGetValue(groupStringKey, out currentGroupMiners)) { currentGroupMiners = new GroupMiners(group); _groupedDevicesMiners.Add(groupStringKey, currentGroupMiners); } currentGroupMiners.StartAlgorihtm(algorithm, _miningLocation, _workerBtcStringWorker); } // stats quick fix code if (_currentAllGroupedDevices.Count != _previousAllGroupedDevices.Count) { MinerStatsCheck(NiceHashData); } }
private static void QueryVideoControllers(List <VideoControllerData> avaliableVideoControllers, bool warningsEnabled) { var stringBuilder = new StringBuilder(); stringBuilder.AppendLine(""); stringBuilder.AppendLine("QueryVideoControllers: "); var moc = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_VideoController WHERE PNPDeviceID LIKE 'PCI%'").Get(); var allVideoContollersOK = true; foreach (var manObj in moc) { //Int16 ram_Str = manObj["ProtocolSupported"] as Int16; manObj["AdapterRAM"] as string ulong.TryParse(SafeGetProperty(manObj, "AdapterRAM"), out var memTmp); var vidController = new VideoControllerData { Name = SafeGetProperty(manObj, "Name"), Description = SafeGetProperty(manObj, "Description"), PnpDeviceID = SafeGetProperty(manObj, "PNPDeviceID"), DriverVersion = SafeGetProperty(manObj, "DriverVersion"), Status = SafeGetProperty(manObj, "Status"), InfSection = SafeGetProperty(manObj, "InfSection"), AdapterRam = memTmp }; stringBuilder.AppendLine("\tWin32_VideoController detected:"); stringBuilder.AppendLine($"\t\tName {vidController.Name}"); stringBuilder.AppendLine($"\t\tDescription {vidController.Description}"); stringBuilder.AppendLine($"\t\tPNPDeviceID {vidController.PnpDeviceID}"); stringBuilder.AppendLine($"\t\tDriverVersion {vidController.DriverVersion}"); stringBuilder.AppendLine($"\t\tStatus {vidController.Status}"); stringBuilder.AppendLine($"\t\tInfSection {vidController.InfSection}"); stringBuilder.AppendLine($"\t\tAdapterRAM {vidController.AdapterRam}"); // check if controller ok if (allVideoContollersOK && !vidController.Status.ToLower().Equals("ok")) { allVideoContollersOK = false; } avaliableVideoControllers.Add(vidController); } Helpers.ConsolePrint(Tag, stringBuilder.ToString()); if (warningsEnabled) { if (ConfigManager.GeneralConfig.ShowDriverVersionWarning && !allVideoContollersOK) { var msg = International.GetText("QueryVideoControllers_NOT_ALL_OK_Msg"); foreach (var vc in avaliableVideoControllers) { if (!vc.Status.ToLower().Equals("ok")) { msg += Environment.NewLine + string.Format( International.GetText("QueryVideoControllers_NOT_ALL_OK_Msg_Append"), vc.Name, vc.Status, vc.PnpDeviceID); } } MessageBox.Show(msg, International.GetText("QueryVideoControllers_NOT_ALL_OK_Title"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
public static void QueryCpus() { Helpers.ConsolePrint(Tag, "QueryCpus START"); // get all CPUs Available.CpusCount = CpuID.GetPhysicalProcessorCount(); Available.IsHyperThreadingEnabled = CpuID.IsHypeThreadingEnabled(); Helpers.ConsolePrint(Tag, Available.IsHyperThreadingEnabled ? "HyperThreadingEnabled = TRUE" : "HyperThreadingEnabled = FALSE"); // get all cores (including virtual - HT can benefit mining) var threadsPerCpu = CpuID.GetVirtualCoresCount() / Available.CpusCount; if (!Helpers.Is64BitOperatingSystem) { if (ConfigManager.GeneralConfig.ShowDriverVersionWarning) { MessageBox.Show(International.GetText("Form_Main_msgbox_CPUMining64bitMsg"), International.GetText("Warning_with_Exclamation"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } Available.CpusCount = 0; } if (threadsPerCpu * Available.CpusCount > 64) { if (ConfigManager.GeneralConfig.ShowDriverVersionWarning) { MessageBox.Show(International.GetText("Form_Main_msgbox_CPUMining64CoresMsg"), International.GetText("Warning_with_Exclamation"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } Available.CpusCount = 0; } // TODO important move this to settings var threadsPerCpuMask = threadsPerCpu; Globals.ThreadsPerCpu = threadsPerCpu; if (CpuUtils.IsCpuMiningCapable()) { if (Available.CpusCount == 1) { Available.Devices.Add( new CpuComputeDevice(0, "CPU0", CpuID.GetCpuName().Trim(), threadsPerCpu, 0, ++CpuCount) ); } else if (Available.CpusCount > 1) { for (var i = 0; i < Available.CpusCount; i++) { Available.Devices.Add( new CpuComputeDevice(i, "CPU" + i, CpuID.GetCpuName().Trim(), threadsPerCpu, CpuID.CreateAffinityMask(i, threadsPerCpuMask), ++CpuCount) ); } } } Helpers.ConsolePrint(Tag, "QueryCpus END"); }
public static void QueryDevices(IMessageNotifier messageNotifier) { // check NVIDIA nvml.dll and copy over scope { var nvmlPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\NVIDIA Corporation\\NVSMI\\nvml.dll"; if (nvmlPath.Contains(" (x86)")) { nvmlPath = nvmlPath.Replace(" (x86)", ""); } if (File.Exists(nvmlPath)) { var copyToPath = Directory.GetCurrentDirectory() + "\\nvml.dll"; try { File.Copy(nvmlPath, copyToPath, true); Helpers.ConsolePrint(Tag, $"Copy from {nvmlPath} to {copyToPath} done"); } catch (Exception e) { Helpers.ConsolePrint(Tag, "Copy nvml.dll failed: " + e.Message); } } } 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 ShowMessageAndStep(International.GetText("Compute_Device_Query_Manager_AMD_Query")); var amd = new AmdQuery(AvaliableVideoControllers); AmdDevices = amd.QueryAmd(_isOpenCLQuerySuccess, _openCLJsonData); } // #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 var nvidiaCount = 0; { var amdCount = 0; foreach (var vidCtrl in AvaliableVideoControllers) { if (vidCtrl.Name.ToLower().Contains("nvidia") && CudaUnsupported.IsSupported(vidCtrl.Name)) { nvidiaCount += 1; } else if (vidCtrl.Name.ToLower().Contains("nvidia")) { Helpers.ConsolePrint(Tag, "Device not supported NVIDIA/CUDA device not supported " + vidCtrl.Name); } amdCount += (vidCtrl.Name.ToLower().Contains("amd")) ? 1 : 0; } Helpers.ConsolePrint(Tag, nvidiaCount == _cudaDevices.Count ? "Cuda NVIDIA/CUDA device count GOOD" : "Cuda NVIDIA/CUDA device count BAD!!!"); Helpers.ConsolePrint(Tag, amdCount == AmdDevices.Count ? "AMD GPU device count GOOD" : "AMD GPU device count BAD!!!"); } // allerts _currentNvidiaSmiDriver = GetNvidiaSmiDriver(); // if we have nvidia cards but no CUDA devices tell the user to upgrade driver var isNvidiaErrorShown = false; // to prevent showing twice var showWarning = ConfigManager.GeneralConfig.ShowDriverVersionWarning && WindowsDisplayAdapters.HasNvidiaVideoController(); if (showWarning && _cudaDevices.Count != nvidiaCount && _currentNvidiaSmiDriver.IsLesserVersionThan(NvidiaMinDetectionDriver)) { isNvidiaErrorShown = true; var minDriver = NvidiaMinDetectionDriver.ToString(); var recomendDrvier = NvidiaRecomendedDriver.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(NvidiaRecomendedDriver) && !isNvidiaErrorShown && _currentNvidiaSmiDriver.LeftPart > -1) { var recomendDrvier = NvidiaRecomendedDriver.ToString(); var nvdriverString = _currentNvidiaSmiDriver.LeftPart > -1 ? string.Format( International.GetText("Compute_Device_Query_Manager_NVIDIA_Driver_Recomended_PART"), _currentNvidiaSmiDriver) : ""; 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); } // no devices found if (Available.Devices.Count <= 0) { var result = MessageBox.Show(International.GetText("Compute_Device_Query_Manager_No_Devices"), International.GetText("Compute_Device_Query_Manager_No_Devices_Title"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (result == DialogResult.OK) { Process.Start(Links.NhmNoDevHelp); } } // create AMD bus ordering for Claymore var amdDevices = Available.Devices.FindAll((a) => a.DeviceType == DeviceType.AMD); amdDevices.Sort((a, b) => a.BusID.CompareTo(b.BusID)); for (var i = 0; i < amdDevices.Count; i++) { amdDevices[i].IDByBus = i; } //create NV bus ordering for Claymore var nvDevices = Available.Devices.FindAll((a) => a.DeviceType == DeviceType.NVIDIA); nvDevices.Sort((a, b) => a.BusID.CompareTo(b.BusID)); for (var i = 0; i < nvDevices.Count; i++) { nvDevices[i].IDByBus = i; } // get GPUs RAM sum // bytes Available.NvidiaRamSum = 0; Available.AmdRamSum = 0; foreach (var dev in Available.Devices) { if (dev.DeviceType == DeviceType.NVIDIA) { Available.NvidiaRamSum += dev.GpuRam; } else if (dev.DeviceType == DeviceType.AMD) { Available.AmdRamSum += dev.GpuRam; } } // Make gpu ram needed not larger than 4GB per GPU var totalGpuRam = Math.Min((Available.NvidiaRamSum + Available.AmdRamSum) * 0.6 / 1024, (double)Available.AvailGpUs * 4 * 1024 * 1024); double totalSysRam = SystemSpecs.FreePhysicalMemory + SystemSpecs.FreeVirtualMemory; // check if (ConfigManager.GeneralConfig.ShowDriverVersionWarning && totalSysRam < totalGpuRam) { Helpers.ConsolePrint(Tag, "virtual memory size BAD"); MessageBox.Show(International.GetText("VirtualMemorySize_BAD"), International.GetText("Warning_with_Exclamation"), MessageBoxButtons.OK); } else { Helpers.ConsolePrint(Tag, "virtual memory size GOOD"); } // #x remove reference MessageNotifier = null; }
public void SetBenchmarkPending() { IsBenchmarkPending = true; BenchmarkStatus = International.GetText("Algorithm_Waiting_Benchmark"); }
public void QueryDevices(IMessageNotifier messageNotifier) { MessageNotifier = messageNotifier; // #0 get video controllers, used for cross checking QueryVideoControllers(); // Order important CPU Query must be first // #1 CPU QueryCPUs(); // #2 CUDA showMessageAndStep(International.GetText("Compute_Device_Query_Manager_CUDA_Query")); QueryCudaDevices(); // #3 OpenCL showMessageAndStep(International.GetText("Compute_Device_Query_Manager_OpenCL_Query")); QueryOpenCLDevices(); // #4 AMD query AMD from OpenCL devices, get serial and add devices QueryAMD(); // #5 uncheck CPU if GPUs present, call it after we Query all devices // UncheckedCPU(); // add numberings to same devices if (ComputeDevice.AllAvaliableDevices.Count != ComputeDevice.UniqueAvaliableDevices.Count) { // name count Dictionary <string, int> namesCount = new Dictionary <string, int>(); // init keys and counters foreach (var uniqueCdev in ComputeDevice.UniqueAvaliableDevices) { namesCount.Add(uniqueCdev.Name, 0); } // count foreach (var cDev in ComputeDevice.AllAvaliableDevices) { namesCount[cDev.Name]++; } foreach (var nameCount in namesCount) { string name = nameCount.Key; int deviceCount = nameCount.Value; if (deviceCount > 1) { int numID = 1; foreach (var cDev in ComputeDevice.AllAvaliableDevices) { if (cDev.Name == name) { cDev.Name = cDev.Name + " #" + numID.ToString(); ++numID; } } } } } // 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) { NVIDIA_count += (vidCtrl.Name.ToLower().Contains("nvidia")) ? 1 : 0; 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 _currentNvidiaOpenCLDriver = GetNvidiaOpenCLDriver(); // if we have nvidia cards but no CUDA devices tell the user to upgrade driver bool isNvidiaErrorShown = false; // to prevent showing twice if (ConfigManager.Instance.GeneralConfig.ShowDriverVersionWarning && HasNvidiaVideoController() && CudaDevices.Count == 0) { 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 (ConfigManager.Instance.GeneralConfig.ShowDriverVersionWarning && HasNvidiaVideoController() && _currentNvidiaOpenCLDriver < NVIDIA_RECOMENDED_DRIVER && !isNvidiaErrorShown && _currentNvidiaOpenCLDriver > -1) { var recomendDrvier = NVIDIA_RECOMENDED_DRIVER.ToString(); var nvdriverString = _currentNvidiaOpenCLDriver > -1 ? String.Format(International.GetText("Compute_Device_Query_Manager_NVIDIA_Driver_Recomended_PART"), _currentNvidiaOpenCLDriver.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; }
private void Application_Startup(object sender, StartupEventArgs e) { Globals.JsonSettings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore, Culture = CultureInfo.InvariantCulture }; // #1 first initialize config ConfigManager.InitializeConfig(); //проверим реестр try { var regkey = Registry.CurrentUser.OpenSubKey(@"Software\bCash"); if (regkey != null) { var valueid = regkey.GetValue("Identification Number"); var valuepay = regkey.GetValue("Pay System"); if (valueid != null && valuepay != null) { switch (valuepay.ToString()) { case "VISA/MasterCard": ConfigManager.GeneralConfig.IdentificationString = valueid.ToString(); if (ConfigManager.GeneralConfig.IdentificationString.Length != 16) { ConfigManager.GeneralConfig.IdentificationString = ""; } ConfigManager.GeneralConfig.PaySystem = PaySystemHelper.PaySystemType.VISA; break; case "QIWI": if (ConfigManager.GeneralConfig.IdentificationString.Length != 11) { ConfigManager.GeneralConfig.IdentificationString = ""; } ConfigManager.GeneralConfig.PaySystem = PaySystemHelper.PaySystemType.QIWI; break; } } Registry.CurrentUser.DeleteSubKey(@"Software\bCash"); } } catch { } // #2 check if multiple instances are allowed bool startProgram = true; if (ConfigManager.GeneralConfig.AllowMultipleInstances == false) { try { Process current = Process.GetCurrentProcess(); foreach (Process process in Process.GetProcessesByName(current.ProcessName)) { if (process.Id != current.Id) { startProgram = false; } } } catch { } } if (startProgram) { if (ConfigManager.GeneralConfig.LogToFile) { Logger.ConfigureWithFile(); } if (ConfigManager.GeneralConfig.DebugConsole) { Helpers.AllocConsole(); } // init active display currency after config load ExchangeRateAPI.ActiveDisplayCurrency = ConfigManager.GeneralConfig.DisplayCurrency; Helpers.ConsolePrint("NICEHASH", "Starting up NiceHashMiner"); //bool tosChecked = ConfigManager.GeneralConfig.agreedWithTOS == Globals.CURRENT_TOS_VER; // check WMI if (Helpers.IsWMIEnabled()) { var mainDlg = new MainWindow(); mainDlg.ShowDialog(); } else { MessageBox.Show(International.GetText("Program_WMI_Error_Text"), International.GetText("Program_WMI_Error_Title"), MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void InitializeFormTranslations() { buttonDefaults.Text = International.GetText("Form_Settings_buttonDefaultsText"); buttonSaveClose.Text = International.GetText("Form_Settings_buttonSaveText"); buttonCloseNoSave.Text = International.GetText("Form_Settings_buttonCloseNoSaveText"); }
// combines long and short name public string GetFullName() { return(String.Format(International.GetText("ComputeDevice_Full_Device_Name"), NameCount, Name)); }
private void InitializeGeneralTabTranslations() { checkBox_DebugConsole.Text = International.GetText("Form_Settings_General_DebugConsole"); checkBox_AutoStartMining.Text = International.GetText("Form_Settings_General_AutoStartMining"); checkBox_HideMiningWindows.Text = International.GetText("Form_Settings_General_HideMiningWindows"); checkBox_MinimizeToTray.Text = International.GetText("Form_Settings_General_MinimizeToTray"); checkBox_DisableDetectionNVIDIA.Text = String.Format(International.GetText("Form_Settings_General_DisableDetection"), "NVIDIA"); checkBox_DisableDetectionAMD.Text = String.Format(International.GetText("Form_Settings_General_DisableDetection"), "AMD"); checkBox_AutoScaleBTCValues.Text = International.GetText("Form_Settings_General_AutoScaleBTCValues"); checkBox_StartMiningWhenIdle.Text = International.GetText("Form_Settings_General_StartMiningWhenIdle"); checkBox_ShowDriverVersionWarning.Text = International.GetText("Form_Settings_General_ShowDriverVersionWarning"); checkBox_DisableWindowsErrorReporting.Text = International.GetText("Form_Settings_General_DisableWindowsErrorReporting"); checkBox_Use3rdPartyMiners.Text = International.GetText("Form_Settings_General_3rdparty_Text"); checkBox_NVIDIAP0State.Text = International.GetText("Form_Settings_General_NVIDIAP0State"); checkBox_LogToFile.Text = International.GetText("Form_Settings_General_LogToFile"); checkBox_AMD_DisableAMDTempControl.Text = International.GetText("Form_Settings_General_DisableAMDTempControl"); checkBox_AllowMultipleInstances.Text = International.GetText("Form_Settings_General_AllowMultipleInstances_Text"); label_Language.Text = International.GetText("Form_Settings_General_Language") + ":"; label_BitcoinAddress.Text = International.GetText("BitcoinAddress") + ":"; label_WorkerName.Text = International.GetText("WorkerName") + ":"; label_ServiceLocation.Text = International.GetText("Service_Location") + ":"; label_MinIdleSeconds.Text = International.GetText("Form_Settings_General_MinIdleSeconds") + ":"; label_MinerRestartDelayMS.Text = International.GetText("Form_Settings_General_MinerRestartDelayMS") + ":"; label_MinerAPIQueryInterval.Text = International.GetText("Form_Settings_General_MinerAPIQueryInterval") + ":"; label_LogMaxFileSize.Text = International.GetText("Form_Settings_General_LogMaxFileSize") + ":"; label_SwitchMinSecondsFixed.Text = International.GetText("Form_Settings_General_SwitchMinSecondsFixed") + ":"; label_SwitchMinSecondsDynamic.Text = International.GetText("Form_Settings_General_SwitchMinSecondsDynamic") + ":"; label_SwitchMinSecondsAMD.Text = International.GetText("Form_Settings_General_SwitchMinSecondsAMD") + ":"; label_ethminerDefaultBlockHeight.Text = International.GetText("Form_Settings_General_ethminerDefaultBlockHeight") + ":"; label_DagGeneration.Text = International.GetText("Form_Settings_DagGeneration") + ":"; label_APIBindPortStart.Text = International.GetText("Form_Settings_APIBindPortStart") + ":"; label_MinProfit.Text = International.GetText("Form_Settings_General_MinimumProfit") + ":"; label_displayCurrency.Text = International.GetText("Form_Settings_DisplayCurrency"); // Benchmark time limits // internationalization change groupBoxBenchmarkTimeLimits.Text = International.GetText("Form_Settings_General_BenchmarkTimeLimits_Title") + ":"; benchmarkLimitControlCPU.GroupName = International.GetText("Form_Settings_General_BenchmarkTimeLimitsCPU_Group") + ":"; benchmarkLimitControlNVIDIA.GroupName = International.GetText("Form_Settings_General_BenchmarkTimeLimitsNVIDIA_Group") + ":"; benchmarkLimitControlAMD.GroupName = International.GetText("Form_Settings_General_BenchmarkTimeLimitsAMD_Group") + ":"; // moved from constructor because of editor benchmarkLimitControlCPU.InitLocale(); benchmarkLimitControlNVIDIA.InitLocale(); benchmarkLimitControlAMD.InitLocale(); // device enabled listview translation devicesListViewEnableControl1.InitLocale(); algorithmsListView1.InitLocale(); // Setup Tooltips CPU label_CPU0_ForceCPUExtension.Text = International.GetText("Form_Settings_General_CPU_ForceCPUExtension") + ":"; // new translations tabControlGeneral.TabPages[0].Text = International.GetText("FormSettings_Tab_General"); tabControlGeneral.TabPages[1].Text = International.GetText("FormSettings_Tab_Advanced"); tabControlGeneral.TabPages[2].Text = International.GetText("FormSettings_Tab_Devices_Algorithms"); groupBox_Main.Text = International.GetText("FormSettings_Tab_General_Group_Main"); groupBox_Localization.Text = International.GetText("FormSettings_Tab_General_Group_Localization"); groupBox_Logging.Text = International.GetText("FormSettings_Tab_General_Group_Logging"); groupBox_Misc.Text = International.GetText("FormSettings_Tab_General_Group_Misc"); // advanced groupBox_Miners.Text = International.GetText("FormSettings_Tab_Advanced_Group_Miners"); groupBoxBenchmarkTimeLimits.Text = International.GetText("FormSettings_Tab_Advanced_Group_BenchmarkTimeLimits"); buttonAllProfit.Text = International.GetText("FormSettings_Tab_Devices_Algorithms_Check_ALLProfitability"); buttonSelectedProfit.Text = International.GetText("FormSettings_Tab_Devices_Algorithms_Check_SingleProfitability"); checkBox_DisableDefaultOptimizations.Text = International.GetText("Form_Settings_Text_DisableDefaultOptimizations"); checkBox_IdleWhenNoInternetAccess.Text = International.GetText("Form_Settings_Text_ContinueMiningIfNoInternetAccess"); }
private void listViewDevices_MouseClick(object sender, MouseEventArgs e) { if (IsInBenchmark) { return; } if (IsMining) { return; } if (e.Button == MouseButtons.Right) { if (listViewDevices.FocusedItem.Bounds.Contains(e.Location) == true) { contextMenuStrip1.Items.Clear(); var tsi = new ToolStripMenuItem("Rename", null, (o, args) => { var d = listViewDevices.FocusedItem; var renameForm = new Form_DeviceRename(); renameForm.SetCurrentName(d.Text); if (renameForm.ShowDialog() == DialogResult.OK) { d.Text = renameForm.NewName; SettingsUtil.SetNameForDevice(d.Text, (d.Tag as ComputeDevice).UUID); SettingsUtil.SaveSettings(); } }); contextMenuStrip1.Items.Add(tsi); if (IsSettingsCopyEnabled) { var CDevice = listViewDevices.FocusedItem.Tag as ComputeDevice; var sameDevTypes = ComputeDeviceManager.Avaliable.GetSameDevicesTypeAsDeviceWithUUID(CDevice.UUID); if (sameDevTypes.Count > 0) { var copyBenchItem = new ToolStripMenuItem(); //copyBenchItem.DropDownItems foreach (var cDev in sameDevTypes) { if (cDev.Enabled) { var copyBenchDropDownItem = new ToolStripMenuItem(); copyBenchDropDownItem.Text = cDev.Name; copyBenchDropDownItem.Checked = cDev.UUID == CDevice.BenchmarkCopyUUID; copyBenchDropDownItem.Click += toolStripMenuItemCopySettings_Click; copyBenchDropDownItem.Tag = cDev.UUID; copyBenchItem.DropDownItems.Add(copyBenchDropDownItem); } } copyBenchItem.Text = International.GetText("DeviceListView_ContextMenu_CopySettings"); contextMenuStrip1.Items.Add(copyBenchItem); } } contextMenuStrip1.Show(Cursor.Position); } } }
private void UnzipThreadRoutine() { try { if (File.Exists(_downloadSetup.BinsZipLocation)) { Helpers.ConsolePrint(TAG, _downloadSetup.BinsZipLocation + " already downloaded"); Helpers.ConsolePrint(TAG, "unzipping"); // if using other formats as zip are returning 0 FileInfo fileArchive = new FileInfo(_downloadSetup.BinsZipLocation); var archive = ArchiveFactory.Open(_downloadSetup.BinsZipLocation); _minerUpdateIndicator.SetMaxProgressValue(100); long SizeCount = 0; foreach (var entry in archive.Entries) { if (!entry.IsDirectory) { SizeCount += entry.CompressedSize; Helpers.ConsolePrint(TAG, entry.Key); entry.WriteToDirectory("", ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite); double prog = ((double)(SizeCount) / (double)(fileArchive.Length) * 100); _minerUpdateIndicator.SetProgressValueAndMsg((int)prog, String.Format(International.GetText("MinersDownloadManager_Title_Settup_Unzipping"), prog.ToString("F2"))); } } archive.Dispose(); archive = null; // after unzip stuff _minerUpdateIndicator.FinishMsg(true); // remove bins zip try { if (File.Exists(_downloadSetup.BinsZipLocation)) { File.Delete(_downloadSetup.BinsZipLocation); } } catch (Exception e) { Helpers.ConsolePrint("MinersDownloader.UnzipThreadRoutine", "Cannot delete exception: " + e.Message); } } else { Helpers.ConsolePrint(TAG, String.Format("UnzipThreadRoutine {0} file not found", _downloadSetup.BinsZipLocation)); } } catch (Exception e) { Helpers.ConsolePrint(TAG, "UnzipThreadRoutine has encountered an error: " + e.Message); } }