public void StartAlgorihtm(Algorithm algorithm, string miningLocation, string worker) { bool containsSupportedMiner = false; Miner startSwitchMiner = null; var algorithmType = algorithm.NiceHashID; foreach (var miner in _miners) { if (miner.IsSupportedMinerAlgorithms(algorithmType)) { containsSupportedMiner = true; startSwitchMiner = miner; break; } } // check if contains miner if not create one if (!containsSupportedMiner) { startSwitchMiner = MinersManager.CreateMiner(_deviceGroupType, algorithmType); startSwitchMiner.SetCDevs(_deviceUUIDs); _miners.Add(startSwitchMiner); } // hanlde CurrentWorkingMiner change if (CurrentWorkingMiner != null && CurrentWorkingMiner != startSwitchMiner) { StopMiner(CurrentWorkingMiner); CurrentWorkingMiner = startSwitchMiner; } else { CurrentWorkingMiner = startSwitchMiner; } SwitchMinerAlgorithm(ref startSwitchMiner, algorithm, miningLocation, worker); }
public static string GetOptimizedMinerPath(AlgorithmType algorithmType, DeviceType deviceType, DeviceGroupType deviceGroupType, string devCodename, bool isOptimized) { // special cases // AlgorithmType.DaggerHashimoto special shared case if (algorithmType == AlgorithmType.DaggerHashimoto && (deviceType == DeviceType.AMD || deviceType == DeviceType.NVIDIA)) { return(MinerPaths.ethminer); } // AlgorithmType.Equihash special shared case if (algorithmType == AlgorithmType.Equihash) { if (deviceType == DeviceType.NVIDIA_CPU || deviceGroupType == DeviceGroupType.NVIDIA_5_x || deviceGroupType == DeviceGroupType.NVIDIA_6_x || (MinersManager.EquihashCPU_USE_eqm() && DeviceGroupType.CPU == deviceGroupType)) { return(MinerPaths.eqm); } else { return(MinerPaths.nheqminer); } } // normal stuff // CPU if (deviceType == DeviceType.CPU) { return(CPU_GROUP.cpu_miner_opt(CPUUtils.GetMostOptimized())); } // NVIDIA if (deviceType == DeviceType.NVIDIA) { var nvidiaGroup = deviceGroupType; // sm21 and sm3x have same settings if (nvidiaGroup == DeviceGroupType.NVIDIA_2_1 || nvidiaGroup == DeviceGroupType.NVIDIA_3_x) { return(NVIDIA_GROUPS.ccminer_sm21_or_sm3x(algorithmType)); } // sm5x and sm6x have same settings if (nvidiaGroup == DeviceGroupType.NVIDIA_5_x || nvidiaGroup == DeviceGroupType.NVIDIA_6_x) { return(NVIDIA_GROUPS.ccminer_sm5x_or_sm6x(algorithmType)); } } // AMD if (deviceType == DeviceType.AMD) { return(AMD_GROUP.sgminer_path(algorithmType, devCodename, isOptimized)); } return(NONE); }
private static bool IsEquihashCPU_eqm(ComputeDevice a) { return(MinersManager.EquihashCPU_USE_eqm() && a.DeviceType == DeviceType.CPU); }