public void SetCurrentlySelected(ListViewItem lvi, ComputeDevice computeDevice)
        {
            // should not happen ever
            if (lvi == null) return;

            _computeDevice = computeDevice;
            var algorithm = lvi.Tag as Algorithm;
            if (algorithm != null) {
                _selected = true;
                _currentlySelectedAlgorithm = algorithm;
                _currentlySelectedLvi = lvi;
                this.Enabled = lvi.Checked;

                groupBoxSelectedAlgorithmSettings.Text = String.Format(International.GetText("AlgorithmsListView_GroupBox"),
                algorithm.GetName()); ;

                field_LessThreads.Enabled = _computeDevice.DeviceGroupType == DeviceGroupType.CPU;
                if (field_LessThreads.Enabled) {
                    field_LessThreads.EntryText = algorithm.LessThreads.ToString();
                }
                fieldBoxBenchmarkSpeed.EntryText = ParseDoubleDefault(algorithm.BenchmarkSpeed);
                richTextBoxExtraLaunchParameters.Text = ParseStringDefault(algorithm.ExtraLaunchParameters);
                this.Update();
            } else {
                // TODO this should not be null
            }
        }
 public MiningAlgorithm(ComputeDevice dev, Algorithm algo)
 {
     this.AlgoRef = algo;
     // init speed that will be avaraged later
     this.AvaragedSpeed = algo.BenchmarkSpeed;
     this.MinerPath = MinerPaths.GetOptimizedMinerPath(dev, algo);
 }
 protected override string GetBenchmarkCommandStringPart(ComputeDevice benchmarkDevice, Algorithm algorithm)
 {
     return " --opencl --opencl-platform " + GPUPlatformNumber
         + " " + algorithm.ExtraLaunchParameters
         + " --benchmark-warmup 40 --benchmark-trial 20"
         + " --opencl-devices ";
 }
Example #4
0
 // create miner creates new miners based on device type and algorithm/miner path
 public static Miner CreateMiner(ComputeDevice device, Algorithm algorithm)
 {
     var minerPath = MinerPaths.GetOptimizedMinerPath(device, algorithm);
     if (minerPath != MinerPaths.NONE) {
         return CreateMiner(device.DeviceType, minerPath);
     }
     return null;
 }
Example #5
0
 public MiningDevice(ComputeDevice device)
 {
     Device = device;
     foreach (var kvp in Device.AlgorithmSettings) {
         AlgorithmType key = kvp.Key;
         Algorithm algo = kvp.Value;
         bool isAlgoMiningCapable = GroupSetupUtils.IsAlgoMiningCapable(algo);
         bool isValidMinerPath = GroupSetupUtils.IsValidMinerPath(device, algo);
         if (isAlgoMiningCapable && isValidMinerPath) {
             Algorithms[key] = new MiningAlgorithm(device, algo);
         }
     }
 }
 public static Tuple<ComputeDevice, DeviceMiningStatus> getDeviceMiningStatus(ComputeDevice device)
 {
     DeviceMiningStatus status = DeviceMiningStatus.CanMine;
     if (device == null) { // C# is null happy
         status = DeviceMiningStatus.DeviceNull;
     } else if (device.Enabled == false) {
         status = DeviceMiningStatus.Disabled;
     } else {
         bool hasEnabledAlgo = false;
         foreach (Algorithm algo in device.AlgorithmSettings.Values) {
             hasEnabledAlgo |= IsAlgoMiningCapable(algo) && IsValidMinerPath(device, algo);
         }
         if (hasEnabledAlgo == false) {
             status = DeviceMiningStatus.NoEnabledAlgorithms;
         }
     }
     return new Tuple<ComputeDevice, DeviceMiningStatus>(device, status);
 }
        public void SetCurrentlySelected(ListViewItem lvi, ComputeDevice computeDevice)
        {
            // should not happen ever
            if (lvi == null) return;

            _computeDevice = computeDevice;
            var algorithm = lvi.Tag as Algorithm;
            if (algorithm != null) {
                _selected = true;
                _currentlySelectedAlgorithm = algorithm;
                _currentlySelectedLvi = lvi;
                this.Enabled = lvi.Checked;

                groupBoxSelectedAlgorithmSettings.Text = String.Format(International.GetText("AlgorithmsListView_GroupBox"),
                algorithm.NiceHashName); ;

                // no intensity for cpu miners and ccminer_cryptonight
                fieldIntensity.Enabled = !(
                    _computeDevice.DeviceGroupType == DeviceGroupType.CPU
                    || _computeDevice.DeviceGroupType == DeviceGroupType.AMD_OpenCL
                    || _currentlySelectedAlgorithm.NiceHashID == AlgorithmType.CryptoNight
                    || _currentlySelectedAlgorithm.NiceHashID == AlgorithmType.DaggerHashimoto);
                if (fieldIntensity.Enabled) {
                    if (algorithm.Intensity == 0) {
                        fieldIntensity.EntryText = "0";
                    } else {
                        fieldIntensity.EntryText = algorithm.Intensity.ToString("F8");
                    }
                } else {
                    fieldIntensity.EntryText = "";
                }

                field_LessThreads.Enabled = _computeDevice.DeviceGroupType == DeviceGroupType.CPU;
                if (field_LessThreads.Enabled) {
                    field_LessThreads.EntryText = algorithm.LessThreads.ToString();
                }
                fieldBoxBenchmarkSpeed.EntryText = ParseDoubleDefault(algorithm.BenchmarkSpeed);
                richTextBoxExtraLaunchParameters.Text = ParseStringDefault(algorithm.ExtraLaunchParameters);
                this.Update();
            } else {
                // TODO this should not be null
            }
        }
Example #8
0
        public Form_Settings()
        {
            InitializeComponent();
            this.Icon = NiceHashMiner.Properties.Resources.logo;

            //ret = 1; // default
            IsChange = false;
            IsChangeSaved = false;

            // backup settings
            ConfigManager.CreateBackup();

            // initialize form
            InitializeFormTranslations();

            // Initialize toolTip
            InitializeToolTip();

            // Initialize tabs
            InitializeGeneralTab();

            // initialization calls
            InitializeDevicesTab();
            // link algorithm list with algorithm settings control
            algorithmSettingsControl1.Enabled = false;
            algorithmsListView1.ComunicationInterface = algorithmSettingsControl1;
            //algorithmsListView1.RemoveRatioRates();

            // set first device selected {
            if (ComputeDeviceManager.Avaliable.AllAvaliableDevices.Count > 0) {
                _selectedComputeDevice = ComputeDeviceManager.Avaliable.AllAvaliableDevices[0];
                algorithmsListView1.SetAlgorithms(_selectedComputeDevice, _selectedComputeDevice.Enabled);
                groupBoxAlgorithmSettings.Text = String.Format(International.GetText("FormSettings_AlgorithmsSettings"), _selectedComputeDevice.Name);
            }

            // At the very end set to true
            _isInitFinished = true;
        }
        private static Dictionary <MinerBaseType, List <Algorithm> > CreateForDevice(ComputeDevice device)
        {
            if (device != null)
            {
                var algoSettings = CreateDefaultsForGroup(device.DeviceGroupType);
                if (algoSettings != null)
                {
                    if (device.DeviceType == DeviceType.AMD)
                    {
                        // sgminer stuff
                        if (algoSettings.ContainsKey(MinerBaseType.sgminer))
                        {
                            var sgminerAlgos      = algoSettings[MinerBaseType.sgminer];
                            int Lyra2REv2_Index   = sgminerAlgos.FindIndex((el) => el.NiceHashID == AlgorithmType.Lyra2REv2);
                            int NeoScrypt_Index   = sgminerAlgos.FindIndex((el) => el.NiceHashID == AlgorithmType.NeoScrypt);
                            int CryptoNight_Index = sgminerAlgos.FindIndex((el) => el.NiceHashID == AlgorithmType.CryptoNight);

                            // Check for optimized version
                            if (Lyra2REv2_Index > -1)
                            {
                                sgminerAlgos[Lyra2REv2_Index].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 64 --thread-concurrency 0 --worksize 64 --gpu-threads 2";
                            }
                            if (!device.Codename.Contains("Tahiti") && NeoScrypt_Index > -1)
                            {
                                sgminerAlgos[NeoScrypt_Index].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity    2 --thread-concurrency 8192 --worksize  64 --gpu-threads 2";
                                Helpers.ConsolePrint("ComputeDevice", "The GPU detected (" + device.Codename + ") is not Tahiti. Changing default gpu-threads to 2.");
                            }
                            if (CryptoNight_Index > -1 && device.Name.Contains("Hawaii"))
                            {
                                sgminerAlgos[CryptoNight_Index].ExtraLaunchParameters = "--rawintensity 640 -w 8 -g 2";
                            }
                        }

                        // Ellesmere, Polaris
                        // Ellesmere sgminer workaround, keep this until sgminer is fixed to work with Ellesmere
                        if ((device.Codename.Contains("Ellesmere") || device.InfSection.ToLower().Contains("polaris")))
                        {
                            foreach (var algosInMiner in algoSettings)
                            {
                                foreach (var algo in algosInMiner.Value)
                                {
                                    // disable all algos in list
                                    if (algo.NiceHashID == AlgorithmType.Decred || algo.NiceHashID == AlgorithmType.Lbry)
                                    {
                                        algo.Enabled = false;
                                    }
                                }
                            }
                        }
                        // non sgminer optimizations
                        if (algoSettings.ContainsKey(MinerBaseType.Claymore))
                        {
                            var ClaymoreAlgos     = algoSettings[MinerBaseType.Claymore];
                            int CryptoNight_Index = ClaymoreAlgos.FindIndex((el) => el.NiceHashID == AlgorithmType.CryptoNight);
                            if (CryptoNight_Index > -1)
                            {
                                //string regex_a_3 = "[5|6][0-9][0-9][0-9]";
                                List <string> a_4 = new List <string>()
                                {
                                    "270",
                                    "270x",
                                    "280",
                                    "280x",
                                    "290",
                                    "290x",
                                    "370",
                                    "380",
                                    "390",
                                    "470",
                                    "480"
                                };
                                foreach (var namePart in a_4)
                                {
                                    if (device.Name.Contains(namePart))
                                    {
                                        ClaymoreAlgos[CryptoNight_Index].ExtraLaunchParameters = "-a 4";
                                        break;
                                    }
                                }
                            }
                        }

                        // drivers algos issue
                        if (device.DriverDisableAlgos)
                        {
                            algoSettings = FilterMinerAlgos(algoSettings, new List <AlgorithmType> {
                                AlgorithmType.NeoScrypt, AlgorithmType.Lyra2REv2
                            });
                        }

                        // disable by default
                        {
                            var minerBases = new List <MinerBaseType>()
                            {
                                MinerBaseType.ethminer, MinerBaseType.OptiminerAMD
                            };
                            foreach (var minerKey in minerBases)
                            {
                                if (algoSettings.ContainsKey(minerKey))
                                {
                                    foreach (var algo in algoSettings[minerKey])
                                    {
                                        algo.Enabled = false;
                                    }
                                }
                            }
                            if (algoSettings.ContainsKey(MinerBaseType.sgminer))
                            {
                                foreach (var algo in algoSettings[MinerBaseType.sgminer])
                                {
                                    if (algo.NiceHashID == AlgorithmType.DaggerHashimoto)
                                    {
                                        algo.Enabled = false;
                                    }
                                }
                            }
                            if (algoSettings.ContainsKey(MinerBaseType.Claymore))
                            {
                                foreach (var algo in algoSettings[MinerBaseType.Claymore])
                                {
                                    if (algo.NiceHashID == AlgorithmType.CryptoNight)
                                    {
                                        algo.Enabled = false;
                                    }
                                }
                            }
                        }
                    } // END AMD case

                    // check if it is Etherum capable
                    if (device.IsEtherumCapale == false)
                    {
                        algoSettings = FilterMinerAlgos(algoSettings, new List <AlgorithmType> {
                            AlgorithmType.DaggerHashimoto
                        });
                    }

                    if (algoSettings.ContainsKey(MinerBaseType.ccminer_alexis))
                    {
                        foreach (var unstable_algo in algoSettings[MinerBaseType.ccminer_alexis])
                        {
                            unstable_algo.Enabled = false;
                        }
                    }
                    if (algoSettings.ContainsKey(MinerBaseType.experimental))
                    {
                        foreach (var unstable_algo in algoSettings[MinerBaseType.experimental])
                        {
                            unstable_algo.Enabled = false;
                        }
                    }

                    // This is not needed anymore after excavator v1.1.4a
                    //if (device.IsSM50() && algoSettings.ContainsKey(MinerBaseType.excavator)) {
                    //    int Equihash_index = algoSettings[MinerBaseType.excavator].FindIndex((algo) => algo.NiceHashID == AlgorithmType.Equihash);
                    //    if (Equihash_index > -1) {
                    //        // -c1 1 needed for SM50 to work ATM
                    //        algoSettings[MinerBaseType.excavator][Equihash_index].ExtraLaunchParameters = "-c1 1";
                    //    }
                    //}
                    // nheqminer exceptions scope
                    {
                        const MinerBaseType minerBaseKey = MinerBaseType.nheqminer;
                        if (algoSettings.ContainsKey(minerBaseKey) && device.Name.Contains("GTX") &&
                            (device.Name.Contains("560") || device.Name.Contains("650") || device.Name.Contains("680") || device.Name.Contains("770"))
                            )
                        {
                            algoSettings = FilterMinerBaseTypes(algoSettings, new List <MinerBaseType>()
                            {
                                minerBaseKey
                            });
                        }
                    }
                } // END algoSettings != null
                return(algoSettings);
            }
            return(null);
        }
Example #10
0
        void NextBenchmark()
        {
            if (_bechmarkCurrentIndex > -1) {
                StepUpBenchmarkStepProgress();
            }
            ++_bechmarkCurrentIndex;
            if (_bechmarkCurrentIndex >= _benchmarkAlgorithmsCount) {
                EndBenchmark();
                return;
            }

            Tuple<ComputeDevice, Queue<Algorithm>> currentDeviceAlgosTuple;
            Queue<Algorithm> algorithmBenchmarkQueue;
            while (_benchmarkDevicesAlgorithmQueue.Count > 0) {
                currentDeviceAlgosTuple = _benchmarkDevicesAlgorithmQueue[0];
                _currentDevice = currentDeviceAlgosTuple.Item1;
                algorithmBenchmarkQueue = currentDeviceAlgosTuple.Item2;
                if(algorithmBenchmarkQueue.Count != 0) {
                    _currentAlgorithm = algorithmBenchmarkQueue.Dequeue();
                    break;
                } else {
                    _benchmarkDevicesAlgorithmQueue.RemoveAt(0);
                }
            }

            if (_currentDevice != null && _currentAlgorithm != null) {
                _currentMiner = MinersManager.CreateMiner(_currentDevice, _currentAlgorithm);
                if(_currentDevice.DeviceType == DeviceType.CPU && string.IsNullOrEmpty(_currentAlgorithm.ExtraLaunchParameters)) {
                    __CPUBenchmarkStatus = new CPUBenchmarkStatus();
                    _currentAlgorithm.LessThreads = __CPUBenchmarkStatus.LessTreads;
                } else {
                    __CPUBenchmarkStatus = null;
                }
            }

            if (_currentMiner != null && _currentAlgorithm != null) {
                _benchmarkMiners.Add(_currentMiner);
                CurrentAlgoName = AlgorithmNiceHashNames.GetName(_currentAlgorithm.NiceHashID);
                _currentMiner.InitBenchmarkSetup(new MiningPair(_currentDevice, _currentAlgorithm));

                var time = ConfigManager.GeneralConfig.BenchmarkTimeLimits
                    .GetBenchamrktime(benchmarkOptions1.PerformanceType, _currentDevice.DeviceGroupType);
                //currentConfig.TimeLimit = time;
                if (__CPUBenchmarkStatus != null) {
                    __CPUBenchmarkStatus.Time = time;
                }

                // dagger about 4 minutes
                var showWaitTime = _currentAlgorithm.NiceHashID == AlgorithmType.DaggerHashimoto ? 4 * 60 : time;

                dotCount = 0;
                _benchmarkingTimer.Start();

                _currentMiner.BenchmarkStart(time, this);
                algorithmsListView1.SetSpeedStatus(_currentDevice, _currentAlgorithm.NiceHashID,
                    getDotsWaitString());
            } else {
                NextBenchmark();
            }
        }
Example #11
0
 private void devicesListView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
 {
     algorithmSettingsControl1.Deselect();
     // show algorithms
     _selectedComputeDevice = ComputeDeviceManager.Avaliable.GetCurrentlySelectedComputeDevice(e.ItemIndex, ShowUniqueDeviceList);
     algorithmsListView1.SetAlgorithms(_selectedComputeDevice, _selectedComputeDevice.Enabled);
     groupBoxAlgorithmSettings.Text = String.Format(International.GetText("FormSettings_AlgorithmsSettings"), _selectedComputeDevice.Name);
 }
 internal static void AddDevice(ComputeDevice dev)
 {
     _devices.Add(dev);
 }
Example #13
0
        protected override string BenchmarkCreateCommandLine(ComputeDevice benchmarkDevice, Algorithm algorithm, int time)
        {
            string CommandLine = GetBenchmarkCommandStringPart(benchmarkDevice, algorithm) + GetDevicesCommandString();
            Ethereum.GetCurrentBlock(CurrentBlockString);
            CommandLine += " --benchmark " + Ethereum.CurrentBlockNum;

            return CommandLine;
        }
 public void AddDevice(ComputeDevice computeDevice)
 {
     _groupCount[computeDevice.DeviceGroupType]++;
 }
Example #15
0
        public static Dictionary<AlgorithmType, Algorithm> CreateForDevice(ComputeDevice device)
        {
            if (device != null) {
                var algoSettings = CreateDefaultsForGroup(device.DeviceGroupType);
                if (algoSettings != null) {
                    if (device.DeviceType == DeviceType.AMD) {
                        // Check for optimized version
                        if (device.IsOptimizedVersion) {
                            if (algoSettings.ContainsKey(AlgorithmType.Qubit)) {
                                algoSettings[AlgorithmType.Qubit].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 1024 --thread-concurrency 0 --worksize 64 --gpu-threads 1" + AmdGpuDevice.TemperatureParam;
                            }
                            if (algoSettings.ContainsKey(AlgorithmType.Quark)) {
                                algoSettings[AlgorithmType.Quark].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 1024 --thread-concurrency 0 --worksize 64 --gpu-threads 1" + AmdGpuDevice.TemperatureParam;
                            }
                            if (algoSettings.ContainsKey(AlgorithmType.Lyra2REv2)) {
                                algoSettings[AlgorithmType.Lyra2REv2].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 512  --thread-concurrency 0 --worksize 64 --gpu-threads 1" + AmdGpuDevice.TemperatureParam;
                            }
                        } else {
                            // this is not the same as the constructor values?? check!
                            if (algoSettings.ContainsKey(AlgorithmType.Qubit)) {
                                algoSettings[AlgorithmType.Qubit].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 64 --thread-concurrency 0 --worksize 128 --gpu-threads 4" + AmdGpuDevice.TemperatureParam;
                            }
                            if (algoSettings.ContainsKey(AlgorithmType.Quark)) {
                                algoSettings[AlgorithmType.Quark].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 64 --thread-concurrency 0 --worksize 256 --gpu-threads 1" + AmdGpuDevice.TemperatureParam;
                            }
                            if (algoSettings.ContainsKey(AlgorithmType.Lyra2REv2)) {
                                algoSettings[AlgorithmType.Lyra2REv2].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 64 --thread-concurrency 0 --worksize 64 --gpu-threads 2" + AmdGpuDevice.TemperatureParam;
                            }
                        }
                        if (!device.Codename.Contains("Tahiti")) {
                            if (algoSettings.ContainsKey(AlgorithmType.NeoScrypt)) {
                                algoSettings[AlgorithmType.NeoScrypt].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity    2 --thread-concurrency 8192 --worksize  64 --gpu-threads 2" + AmdGpuDevice.TemperatureParam;
                                Helpers.ConsolePrint("ComputeDevice", "The GPU detected (" + device.Codename + ") is not Tahiti. Changing default gpu-threads to 2.");
                            }
                        }

                        // Ellesmere, Polaris
                        // Ellesmere sgminer workaround, keep this until sgminer is fixed to work with Ellesmere
                        if ((device.Codename.Contains("Ellesmere") || device.InfSection.ToLower().Contains("polaris")) && Globals.IsEllesmereSgminerIgnore) {
                            // remove all algos except equi and dagger
                            List<AlgorithmType> toRemove = new List<AlgorithmType>();
                            foreach (var key in algoSettings.Keys) {
                                if (AlgorithmType.DaggerHashimoto != key && AlgorithmType.Equihash != key) {
                                    toRemove.Add(key);
                                }
                            }
                            // remove keys
                            foreach (var key in toRemove) {
                                algoSettings.Remove(key);
                            }
                        } else if ((device.Codename.Contains("Ellesmere") || device.InfSection.ToLower().Contains("polaris"))) {
                            if (algoSettings.ContainsKey(AlgorithmType.NeoScrypt)) {
                                algoSettings.Remove(AlgorithmType.NeoScrypt);
                            }
                        }
                    }

                    // check if it is Etherum capable
                    if (algoSettings.ContainsKey(AlgorithmType.DaggerHashimoto) && device.IsEtherumCapale == false) {
                        algoSettings.Remove(AlgorithmType.DaggerHashimoto);
                    }
                    //// also check for Equihash as it needs 2GB GPU
                    //if (algoSettings.ContainsKey(AlgorithmType.Equihash) && device.IsEtherumCapale == false) {
                    //    algoSettings.Remove(AlgorithmType.Equihash);
                    //}
                }
                return algoSettings;
            }
            return null;
        }
Example #16
0
 protected abstract string GetBenchmarkCommandStringPart(ComputeDevice benchmarkDevice, Algorithm algorithm);
        private static string ParseForMiningPairs(List<MiningPair> MiningPairs, AlgorithmType algorithmType, DeviceType deviceType, string minerPath, bool showLog = true)
        {
            _showLog = showLog;

            // parse for nheqminer
            bool deviceCheckSkip = algorithmType == AlgorithmType.Equihash || algorithmType == AlgorithmType.DaggerHashimoto;
            if (algorithmType == AlgorithmType.Equihash) {
                // nheqminer
                if (minerPath == MinerPaths.nheqminer) {
                    if (deviceType == DeviceType.CPU) {
                        CheckAndSetCPUPairs(MiningPairs);
                        return Parse(MiningPairs, _nheqminer_CPU_Options);
                    }
                    if (deviceType == DeviceType.NVIDIA) {
                        return Parse(MiningPairs, _nheqminer_CUDA_Options);
                    }
                    if (deviceType == DeviceType.AMD) {
                        return Parse(MiningPairs, _nheqminer_AMD_Options);
                    }
                } else if (minerPath == MinerPaths.eqm) {
                    if (deviceType == DeviceType.CPU) {
                        CheckAndSetCPUPairs(MiningPairs);
                        return Parse(MiningPairs, _eqm_CPU_Options);
                    }
                    if (deviceType == DeviceType.NVIDIA) {
                        return Parse(MiningPairs, _eqm_CUDA_Options);
                    }
                } else if (minerPath == MinerPaths.ClaymoreZcashMiner) {
                    return Parse(MiningPairs, _ClaymoreZcash_Options);
                }
            } else if (algorithmType == AlgorithmType.DaggerHashimoto) { // ethminer dagger
                // use if missing compute device for correct mapping
                // init fakes workaround
                var cdevs_mappings = new List<MiningPair>();
                {
                    int id = -1;
                    var fakeAlgo = new Algorithm(AlgorithmType.DaggerHashimoto, "daggerhashimoto");
                    foreach (var pair in MiningPairs) {
                        while (++id != pair.Device.ID) {
                            var fakeCdev = new ComputeDevice(id);
                            cdevs_mappings.Add(new MiningPair(fakeCdev, fakeAlgo));
                        }
                        cdevs_mappings.Add(pair);
                    }
                }
                if (deviceType == DeviceType.NVIDIA) {
                    return Parse(cdevs_mappings, _cudaEthminerOptions);
                } else if (deviceType == DeviceType.AMD) {
                    return Parse(cdevs_mappings, _oclEthminerOptions);
                }
            } else if (deviceCheckSkip == false) {
                // parse for device
                if (deviceType == DeviceType.CPU) {
                    CheckAndSetCPUPairs(MiningPairs);
                    return Parse(MiningPairs, _cpuminerOptions);
                } else if (deviceType == DeviceType.NVIDIA) {
                    if (algorithmType != AlgorithmType.CryptoNight) {
                        return Parse(MiningPairs, _ccimerOptions);
                    } else if (algorithmType == AlgorithmType.CryptoNight) {
                        // check if any device is SM21 or SM3.x if yes return empty for stability reasons
                        foreach (var pair in MiningPairs) {
                            var groupType = pair.Device.DeviceGroupType;
                            if (groupType == DeviceGroupType.NVIDIA_2_1 || groupType == DeviceGroupType.NVIDIA_3_x) {
                                return "";
                            }
                        }
                        return Parse(MiningPairs, _ccimerCryptoNightOptions, true);
                    }
                } else if (deviceType == DeviceType.AMD) {
                    // rawIntensity overrides xintensity, xintensity overrides intensity
                    var sgminer_intensities = new List<MinerOption>() {
                        new MinerOption(MinerOptionType.Intensity, "-I", "--intensity", "d", MinerOptionFlagType.MultiParam, ","), // default is "d" check if -1 works
                        new MinerOption(MinerOptionType.Xintensity, "-X", "--xintensity", "-1", MinerOptionFlagType.MultiParam, ","), // default none
                        new MinerOption(MinerOptionType.Rawintensity, "", "--rawintensity", "-1", MinerOptionFlagType.MultiParam, ","), // default none
                    };
                    var contains_intensity = new Dictionary<MinerOptionType, bool>() {
                        { MinerOptionType.Intensity, false },
                        { MinerOptionType.Xintensity, false },
                        { MinerOptionType.Rawintensity, false },
                    };
                    // check intensity and xintensity, the latter overrides so change accordingly
                    foreach (var cDev in MiningPairs) {
                        foreach (var intensityOption in sgminer_intensities) {
                            if (!string.IsNullOrEmpty(intensityOption.ShortName) && cDev.CurrentExtraLaunchParameters.Contains(intensityOption.ShortName)) {
                                cDev.CurrentExtraLaunchParameters = cDev.CurrentExtraLaunchParameters.Replace(intensityOption.ShortName, intensityOption.LongName);
                                contains_intensity[intensityOption.Type] = true;
                            }
                            if (cDev.CurrentExtraLaunchParameters.Contains(intensityOption.LongName)) {
                                contains_intensity[intensityOption.Type] = true;
                            }
                        }
                    }
                    // replace
                    if (contains_intensity[MinerOptionType.Intensity] && contains_intensity[MinerOptionType.Xintensity]) {
                        LogParser("Sgminer replacing --intensity with --xintensity");
                        foreach (var cDev in MiningPairs) {
                            cDev.CurrentExtraLaunchParameters = cDev.CurrentExtraLaunchParameters.Replace("--intensity", "--xintensity");
                        }
                    }
                    if (contains_intensity[MinerOptionType.Xintensity] && contains_intensity[MinerOptionType.Rawintensity]) {
                        LogParser("Sgminer replacing --xintensity with --rawintensity");
                        foreach (var cDev in MiningPairs) {
                            cDev.CurrentExtraLaunchParameters = cDev.CurrentExtraLaunchParameters.Replace("--xintensity", "--rawintensity");
                        }
                    }

                    List<MinerOption> sgminerOptionsNew = new List<MinerOption>();
                    string temperatureControl = "";
                    // temp control and parse
                    if (ConfigManager.GeneralConfig.DisableAMDTempControl) {
                        LogParser("DisableAMDTempControl is TRUE, temp control parameters will be ignored");
                    } else {
                        LogParser("Sgminer parsing temperature control parameters");
                        temperatureControl = Parse(MiningPairs, _sgminerTemperatureOptions, true, _sgminerOptions);
                    }
                    LogParser("Sgminer parsing default parameters");
                    string returnStr = String.Format("{0} {1}", Parse(MiningPairs, _sgminerOptions, false, _sgminerTemperatureOptions), temperatureControl);
                    LogParser("Sgminer extra launch parameters merged: " + returnStr);
                    return returnStr;
                }
            }

            return "";
        }
        // benchmark settings
        public void SetSpeedStatus(ComputeDevice computeDevice, AlgorithmType algorithmType, string status)
        {
            var algorithm = computeDevice.AlgorithmSettings[algorithmType];
            algorithm.BenchmarkStatus = status;

            // gui update only if same as selected
            if (_computeDevice != null && computeDevice.UUID == _computeDevice.UUID) {
                foreach (ListViewItem lvi in listViewAlgorithms.Items) {
                    Algorithm algo = lvi.Tag as Algorithm;
                    if (algo != null && algo.NiceHashID == algorithmType) {
                        // TODO handle numbers
                        lvi.SubItems[SPEED].Text = algorithm.BenchmarkSpeedString();
                        lvi.SubItems[RATE].Text = algorithm.CurPayingRate;
                        lvi.SubItems[RATIO].Text = algorithm.CurPayingRatio;
                        _listItemCheckColorSetter.LviSetColor(lvi);
                        break;
                    }
                }
            }
        }
        public void SetAlgorithms(ComputeDevice computeDevice, bool isEnabled)
        {
            _computeDevice = computeDevice;
            listViewAlgorithms.BeginUpdate();
            listViewAlgorithms.Items.Clear();
            foreach (var alg in computeDevice.AlgorithmSettings) {
                ListViewItem lvi = new ListViewItem();
                ListViewItem.ListViewSubItem sub = lvi.SubItems.Add(alg.Value.GetName());

                //sub.Tag = alg.Value;
                lvi.SubItems.Add(alg.Value.BenchmarkSpeedString());
                lvi.SubItems.Add(alg.Value.CurPayingRatio);
                lvi.SubItems.Add(alg.Value.CurPayingRate);
                lvi.Tag = alg.Value;
                lvi.Checked = !alg.Value.Skip;
                listViewAlgorithms.Items.Add(lvi);
            }
            listViewAlgorithms.EndUpdate();
            this.Enabled = isEnabled;
        }
Example #20
0
 public override void InitMiningSetup(MiningSetup miningSetup)
 {
     base.InitMiningSetup(miningSetup);
     // now find the fastest for DAG generation
     double fastestSpeed = double.MinValue;
     foreach (var mPair in MiningSetup.MiningPairs) {
         double compareSpeed = mPair.Algorithm.AvaragedSpeed;
         if (fastestSpeed < compareSpeed) {
             DaggerHashimotoGenerateDevice = mPair.Device;
             fastestSpeed = compareSpeed;
         }
     }
 }
Example #21
0
 public override void SetCDevs(string[] deviceUUIDs)
 {
     base.SetCDevs(deviceUUIDs);
     // now find the fastest for DAG generation
     double fastestSpeed = double.MinValue;
     foreach (var cdev in CDevs) {
         double compareSpeed = cdev.DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.DaggerHashimoto].BenchmarkSpeed;
         if (fastestSpeed < compareSpeed) {
             DaggerHashimotoGenerateDevice = cdev;
             fastestSpeed = compareSpeed;
         }
     }
 }
Example #22
0
        public static Dictionary <MinerBaseType, List <Algorithm> > CreateForDevice(ComputeDevice device)
        {
            if (device != null)
            {
                var algoSettings = CreateDefaultsForGroup(device.DeviceGroupType);
                if (algoSettings != null)
                {
                    if (device.DeviceType == DeviceType.AMD)
                    {
                        // sgminer stuff
                        if (algoSettings.ContainsKey(MinerBaseType.sgminer))
                        {
                            var sgminerAlgos      = algoSettings[MinerBaseType.sgminer];
                            int Lyra2REv2_Index   = sgminerAlgos.FindIndex((el) => el.NiceHashID == AlgorithmType.Lyra2REv2);
                            int NeoScrypt_Index   = sgminerAlgos.FindIndex((el) => el.NiceHashID == AlgorithmType.NeoScrypt);
                            int CryptoNight_Index = sgminerAlgos.FindIndex((el) => el.NiceHashID == AlgorithmType.CryptoNight);

                            // Check for optimized version
                            if (Lyra2REv2_Index > -1)
                            {
                                if (device.IsOptimizedVersion)
                                {
                                    sgminerAlgos[Lyra2REv2_Index].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 512  --thread-concurrency 0 --worksize 64 --gpu-threads 1";
                                }
                                else
                                {
                                    sgminerAlgos[Lyra2REv2_Index].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 64 --thread-concurrency 0 --worksize 64 --gpu-threads 2";
                                }
                            }

                            if (!device.Codename.Contains("Tahiti") && NeoScrypt_Index > -1)
                            {
                                sgminerAlgos[NeoScrypt_Index].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity    2 --thread-concurrency 8192 --worksize  64 --gpu-threads 2";
                                Helpers.ConsolePrint("ComputeDevice", "The GPU detected (" + device.Codename + ") is not Tahiti. Changing default gpu-threads to 2.");
                            }
                            if (CryptoNight_Index > -1 && device.Name.Contains("Hawaii"))
                            {
                                sgminerAlgos[CryptoNight_Index].ExtraLaunchParameters = "--rawintensity 640 -w 8 -g 2";
                            }
                        }

                        // Ellesmere, Polaris
                        // Ellesmere sgminer workaround, keep this until sgminer is fixed to work with Ellesmere
                        if ((device.Codename.Contains("Ellesmere") || device.InfSection.ToLower().Contains("polaris")) && Globals.IsEllesmereSgminerIgnore)
                        {
                            // remove all algos except equi and dagger
                            var ignoreRemove = new List <AlgorithmType> {
                                AlgorithmType.DaggerHashimoto, AlgorithmType.Equihash, AlgorithmType.CryptoNight, AlgorithmType.Pascal, AlgorithmType.X11Gost
                            };
                            var toRemove = GetKeysForMinerAlgosGroup(algoSettings).FindAll((algoType) => ignoreRemove.IndexOf(algoType) == -1);
                            algoSettings = FilterMinerAlgos(algoSettings, toRemove);
                            // remove all sgminer?
                            // algoSettings = FilterMinerBaseTypes(algoSettings, [MinerBaseType.sgminer]);
                        }
                        else if ((device.Codename.Contains("Ellesmere") || device.InfSection.ToLower().Contains("polaris")))
                        {
                            algoSettings = FilterMinerAlgos(algoSettings, new List <AlgorithmType> {
                                AlgorithmType.NeoScrypt
                            });
                        }

                        // check if 3rd party is enabled and allow 3rd party only algos
                        if (algoSettings.ContainsKey(MinerBaseType.ClaymoreAMD))
                        {
                            var ClaymoreAlgos     = algoSettings[MinerBaseType.sgminer];
                            int CryptoNight_Index = ClaymoreAlgos.FindIndex((el) => el.NiceHashID == AlgorithmType.CryptoNight);
                            if (CryptoNight_Index > -1)
                            {
                                //string regex_a_3 = "[5|6][0-9][0-9][0-9]";
                                List <string> a_4 = new List <string>()
                                {
                                    "270",
                                    "270x",
                                    "280",
                                    "280x",
                                    "290",
                                    "290x",
                                    "370",
                                    "380",
                                    "390",
                                    "470",
                                    "480"
                                };
                                foreach (var namePart in a_4)
                                {
                                    if (device.Name.Contains(namePart))
                                    {
                                        ClaymoreAlgos[CryptoNight_Index].ExtraLaunchParameters = "-a 4";
                                        break;
                                    }
                                }
                            }
                        }

                        // drivers algos issue
                        if (device.DriverDisableAlgos)
                        {
                            algoSettings = FilterMinerAlgos(algoSettings, new List <AlgorithmType> {
                                AlgorithmType.NeoScrypt, AlgorithmType.Lyra2REv2
                            });
                        }

                        // disable by default
                        {
                            var minerBases = new List <MinerBaseType>()
                            {
                                MinerBaseType.ethminer, MinerBaseType.OptiminerAMD
                            };
                            foreach (var minerKey in minerBases)
                            {
                                if (algoSettings.ContainsKey(minerKey))
                                {
                                    foreach (var algo in algoSettings[minerKey])
                                    {
                                        algo.Enabled = false;
                                    }
                                }
                            }
                            if (algoSettings.ContainsKey(MinerBaseType.ClaymoreAMD))
                            {
                                foreach (var algo in algoSettings[MinerBaseType.ClaymoreAMD])
                                {
                                    if (algo.NiceHashID == AlgorithmType.CryptoNight)
                                    {
                                        algo.Enabled = false;
                                        break;
                                    }
                                }
                            }
                        }
                    } // END AMD case

                    // check if it is Etherum capable
                    if (device.IsEtherumCapale == false)
                    {
                        algoSettings = FilterMinerAlgos(algoSettings, new List <AlgorithmType> {
                            AlgorithmType.DaggerHashimoto
                        });
                    }
                }
                //if (algoSettings.ContainsKey(MinerBaseType.XmrStackCPU)) {
                //    algoSettings[MinerBaseType.XmrStackCPU][0].LessThreads = device.Threads / 2; // use half
                //}

                if (algoSettings.ContainsKey(MinerBaseType.ccminer_alexis))
                {
                    foreach (var unstable_algo in algoSettings[MinerBaseType.ccminer_alexis])
                    {
                        unstable_algo.Enabled = false;
                    }
                }

                return(algoSettings);
            }
            return(null);
        }
 protected bool Equals(ComputeDevice other)
 {
     return(ID == other.ID && DeviceGroupType == other.DeviceGroupType && DeviceType == other.DeviceType);
 }
Example #24
0
 public void CopyBenchmarkSettingsFrom(ComputeDevice copyBenchCDev)
 {
     foreach (var copyAlgSpeeds in copyBenchCDev.AlgorithmSettings) {
         if (this.AlgorithmSettings.ContainsKey(copyAlgSpeeds.Key)) {
             var setAlgo = this.AlgorithmSettings[copyAlgSpeeds.Key];
             setAlgo.BenchmarkSpeed = copyAlgSpeeds.Value.BenchmarkSpeed;
             setAlgo.ExtraLaunchParameters = copyAlgSpeeds.Value.ExtraLaunchParameters;
             setAlgo.LessThreads = copyAlgSpeeds.Value.LessThreads;
         }
     }
 }
Example #25
0
 public static bool IsValidMinerPath(ComputeDevice device, Algorithm algo)
 {
     return MinerPaths.NONE != MinerPaths.GetOptimizedMinerPath(device, algo);
 }
Example #26
0
        protected override string BenchmarkCreateCommandLine(ComputeDevice benchmarkDevice, Algorithm algorithm, int time)
        {
            string timeLimit = algorithm.NiceHashID == AlgorithmType.CryptoNight ? "" : " --time-limit " + time.ToString();
            string CommandLine = " --algo=" + algorithm.MinerName +
                              " --benchmark" +
                              timeLimit +
                              " " + algorithm.ExtraLaunchParameters +
                              " --devices ";

            CommandLine += GetDevicesCommandString();

            Path = GetOptimizedMinerPath(algorithm.NiceHashID);

            // cryptonight exception helper variables
            _cryptonightTotalCount = BenchmarkTimeInSeconds / _cryptonightTotalDelim;
            _cryptonightTotal = 0.0d;

            return CommandLine;
        }
Example #27
0
 public MiningPair(ComputeDevice d, Algorithm a)
 {
     this.Device = d;
     this.Algorithm = a;
     this.CurrentExtraLaunchParameters = Algorithm.ExtraLaunchParameters;
 }
Example #28
0
        public static Dictionary <AlgorithmType, Algorithm> CreateForDevice(ComputeDevice device)
        {
            if (device != null)
            {
                var algoSettings = CreateDefaultsForGroup(device.DeviceGroupType);
                if (algoSettings != null)
                {
                    if (device.DeviceType == DeviceType.AMD)
                    {
                        // Check for optimized version
                        if (device.IsOptimizedVersion)
                        {
                            if (algoSettings.ContainsKey(AlgorithmType.Qubit))
                            {
                                algoSettings[AlgorithmType.Qubit].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 1024 --thread-concurrency 0 --worksize 64 --gpu-threads 1" + AmdGpuDevice.TemperatureParam;
                            }
                            if (algoSettings.ContainsKey(AlgorithmType.Quark))
                            {
                                algoSettings[AlgorithmType.Quark].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 1024 --thread-concurrency 0 --worksize 64 --gpu-threads 1" + AmdGpuDevice.TemperatureParam;
                            }
                            if (algoSettings.ContainsKey(AlgorithmType.Lyra2REv2))
                            {
                                algoSettings[AlgorithmType.Lyra2REv2].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 512  --thread-concurrency 0 --worksize 64 --gpu-threads 1" + AmdGpuDevice.TemperatureParam;
                            }
                        }
                        else
                        {
                            // this is not the same as the constructor values?? check!
                            if (algoSettings.ContainsKey(AlgorithmType.Qubit))
                            {
                                algoSettings[AlgorithmType.Qubit].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 64 --thread-concurrency 0 --worksize 128 --gpu-threads 4" + AmdGpuDevice.TemperatureParam;
                            }
                            if (algoSettings.ContainsKey(AlgorithmType.Quark))
                            {
                                algoSettings[AlgorithmType.Quark].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 64 --thread-concurrency 0 --worksize 256 --gpu-threads 1" + AmdGpuDevice.TemperatureParam;
                            }
                            if (algoSettings.ContainsKey(AlgorithmType.Lyra2REv2))
                            {
                                algoSettings[AlgorithmType.Lyra2REv2].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 64 --thread-concurrency 0 --worksize 64 --gpu-threads 2" + AmdGpuDevice.TemperatureParam;
                            }
                        }
                        if (!device.Codename.Contains("Tahiti"))
                        {
                            if (algoSettings.ContainsKey(AlgorithmType.NeoScrypt))
                            {
                                algoSettings[AlgorithmType.NeoScrypt].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity    2 --thread-concurrency 8192 --worksize  64 --gpu-threads 2" + AmdGpuDevice.TemperatureParam;
                                Helpers.ConsolePrint("ComputeDevice", "The GPU detected (" + device.Codename + ") is not Tahiti. Changing default gpu-threads to 2.");
                            }
                        }

                        // Ellesmere, Polaris
                        // Ellesmere sgminer workaround, keep this until sgminer is fixed to work with Ellesmere
                        if ((device.Codename.Contains("Ellesmere") || device.InfSection.ToLower().Contains("polaris")) && Globals.IsEllesmereSgminerIgnore)
                        {
                            // remove all algos except equi and dagger
                            List <AlgorithmType> toRemove = new List <AlgorithmType>();
                            foreach (var key in algoSettings.Keys)
                            {
                                if (AlgorithmType.DaggerHashimoto != key && AlgorithmType.Equihash != key)
                                {
                                    toRemove.Add(key);
                                }
                            }
                            // remove keys
                            foreach (var key in toRemove)
                            {
                                algoSettings.Remove(key);
                            }
                        }
                        else if ((device.Codename.Contains("Ellesmere") || device.InfSection.ToLower().Contains("polaris")))
                        {
                            if (algoSettings.ContainsKey(AlgorithmType.NeoScrypt))
                            {
                                algoSettings.Remove(AlgorithmType.NeoScrypt);
                            }
                        }
                    }

                    // check if it is Etherum capable
                    if (algoSettings.ContainsKey(AlgorithmType.DaggerHashimoto) && device.IsEtherumCapale == false)
                    {
                        algoSettings.Remove(AlgorithmType.DaggerHashimoto);
                    }
                    //// also check for Equihash as it needs 2GB GPU
                    //if (algoSettings.ContainsKey(AlgorithmType.Equihash) && device.IsEtherumCapale == false) {
                    //    algoSettings.Remove(AlgorithmType.Equihash);
                    //}
                }
                return(algoSettings);
            }
            return(null);
        }