Example #1
0
        protected override void InitSupportedMinerAlgorithms()
        {
            var allGroupSupportedList = GroupAlgorithms.GetAlgorithmKeysForGroup(DeviceGroupType.NVIDIA_3_x);

            allGroupSupportedList.Remove(AlgorithmType.DaggerHashimoto);
            _supportedMinerAlgorithms = allGroupSupportedList.ToArray();
        }
Example #2
0
        private void checkBox_DisableDefaultOptimizations_CheckedChanged(object sender, EventArgs e)
        {
            if (!_isInitFinished)
            {
                return;
            }

            // indicate there has been a change
            IsChange = true;
            ConfigManager.GeneralConfig.DisableDefaultOptimizations = checkBox_DisableDefaultOptimizations.Checked;
            if (ConfigManager.GeneralConfig.DisableDefaultOptimizations)
            {
                foreach (var cDev in ComputeDeviceManager.Avaliable.AllAvaliableDevices)
                {
                    foreach (var algorithm in cDev.AlgorithmSettings)
                    {
                        algorithm.Value.ExtraLaunchParameters = "";
                        if (cDev.DeviceType == DeviceType.AMD && algorithm.Key != AlgorithmType.DaggerHashimoto)
                        {
                            algorithm.Value.ExtraLaunchParameters += AmdGpuDevice.TemperatureParam;
                            algorithm.Value.ExtraLaunchParameters  = ExtraLaunchParametersParser.ParseForMiningPair(
                                new MiningPair(cDev, algorithm.Value), algorithm.Key, cDev.DeviceType, false);
                        }
                    }
                }
            }
            else
            {
                foreach (var cDev in ComputeDeviceManager.Avaliable.AllAvaliableDevices)
                {
                    if (cDev.DeviceType == DeviceType.CPU)
                    {
                        continue;                                    // cpu has no defaults
                    }
                    var deviceDefaultsAlgoSettings = GroupAlgorithms.CreateForDevice(cDev);
                    foreach (var defaultAlgoSettings in deviceDefaultsAlgoSettings)
                    {
                        var algorithmKey = defaultAlgoSettings.Key;
                        if (cDev.AlgorithmSettings.ContainsKey(algorithmKey))
                        {
                            var algorithm = cDev.AlgorithmSettings[algorithmKey];
                            algorithm.ExtraLaunchParameters = defaultAlgoSettings.Value.ExtraLaunchParameters;
                            algorithm.ExtraLaunchParameters = ExtraLaunchParametersParser.ParseForMiningPair(
                                new MiningPair(cDev, algorithm), algorithmKey, cDev.DeviceType, false);
                        }
                    }
                }
            }
        }
        private void checkBox_DisableDefaultOptimizations_CheckedChanged(object sender, EventArgs e)
        {
            if (!_isInitFinished)
            {
                return;
            }

            // indicate there has been a change
            IsChange = true;
            ConfigManager.GeneralConfig.DisableDefaultOptimizations = checkBox_DisableDefaultOptimizations.Checked;
            if (ConfigManager.GeneralConfig.DisableDefaultOptimizations)
            {
                foreach (var cDev in ComputeDeviceManager.Avaliable.AllAvaliableDevices)
                {
                    foreach (var algorithm in cDev.GetAlgorithmSettings())
                    {
                        algorithm.ExtraLaunchParameters = "";
                        if (cDev.DeviceType == DeviceType.AMD && algorithm.NiceHashID != AlgorithmType.DaggerHashimoto)
                        {
                            algorithm.ExtraLaunchParameters += AmdGpuDevice.TemperatureParam;
                            algorithm.ExtraLaunchParameters  = ExtraLaunchParametersParser.ParseForMiningPair(
                                new MiningPair(cDev, algorithm), algorithm.NiceHashID, cDev.DeviceType, false);
                        }
                    }
                }
            }
            else
            {
                foreach (var cDev in ComputeDeviceManager.Avaliable.AllAvaliableDevices)
                {
                    if (cDev.DeviceType == DeviceType.CPU)
                    {
                        continue;                                    // cpu has no defaults
                    }
                    var deviceDefaultsAlgoSettings = GroupAlgorithms.CreateForDeviceList(cDev);
                    foreach (var defaultAlgoSettings in deviceDefaultsAlgoSettings)
                    {
                        var toSetAlgo = cDev.GetAlgorithm(defaultAlgoSettings.MinerBaseType, defaultAlgoSettings.NiceHashID);
                        if (toSetAlgo != null)
                        {
                            toSetAlgo.ExtraLaunchParameters = defaultAlgoSettings.ExtraLaunchParameters;
                            toSetAlgo.ExtraLaunchParameters = ExtraLaunchParametersParser.ParseForMiningPair(
                                new MiningPair(cDev, toSetAlgo), toSetAlgo.NiceHashID, cDev.DeviceType, false);
                        }
                    }
                }
            }
        }
Example #4
0
        public static void InitializePackages()
        {
            var defaults = new List <MinerPathPackage>();

            for (var i = DeviceGroupType.NONE + 1; i < DeviceGroupType.LAST; i++)
            {
                var minerTypePaths = new List <MinerTypePath>();
                var package        = GroupAlgorithms.CreateDefaultsForGroup(i);
                foreach (var type in configurableMiners)
                {
                    if (package.ContainsKey(type))
                    {
                        var minerPaths = new List <MinerPath>();
                        foreach (var algo in package[type])
                        {
                            minerPaths.Add(new MinerPath(algo.NiceHashID, GetPathFor(type, algo.NiceHashID, i, true)));
                        }
                        minerTypePaths.Add(new MinerTypePath(type, minerPaths));
                    }
                }
                if (minerTypePaths.Count > 0)
                {
                    defaults.Add(new MinerPathPackage(i, minerTypePaths));
                }
            }

            foreach (var pack in defaults)
            {
                var packageName = String.Format("MinerPathPackage_{0}", pack.Name);
                var packageFile = new MinerPathPackageFile(packageName);
                var readPack    = packageFile.ReadFile();
                if (readPack == null)     // read has failed
                {
                    Helpers.ConsolePrint("MinerPaths", "Creating internal paths config " + packageName);
                    minerPathPackages.Add(pack);
                    packageFile.Commit(pack);
                }
                else
                {
                    Helpers.ConsolePrint("MinerPaths", "Loading internal paths config " + packageName);
                    minerPathPackages.Add(readPack);
                }
            }
        }
Example #5
0
        public DeviceBenchmarkConfig(DeviceGroupType deviceGroupType,
                                     string deviceUUID,
                                     string deviceName,
                                     Dictionary <AlgorithmType, Algorithm> benchmarkSpeeds = null)
        {
            DeviceGroupType = deviceGroupType;
            DeviceUUID      = deviceUUID;
            DeviceName      = deviceName;
            if (benchmarkSpeeds != null)
            {
                AlgorithmSettings = benchmarkSpeeds;
            }
            else
            {
                AlgorithmSettings = GroupAlgorithms.CreateDefaultsForGroup(deviceGroupType);
            }

            IsAlgorithmSettingsInit = false;
        }
Example #6
0
        public static void InitializePackages()
        {
            var defaults = new List <MinerPathPackage>();

            for (var i = DeviceGroupType.NONE + 1; i < DeviceGroupType.LAST; i++)
            {
                var package        = GroupAlgorithms.CreateDefaultsForGroup(i);
                var minerTypePaths = (from type in ConfigurableMiners
                                      where package.ContainsKey(type)
                                      let minerPaths = package[type].Select(algo =>
                                                                            new MinerPath(algo.NiceHashID, GetPathFor(type, algo.NiceHashID, i, true))).ToList()
                                                       select new MinerTypePath(type, minerPaths)).ToList();
                if (minerTypePaths.Count > 0)
                {
                    defaults.Add(new MinerPathPackage(i, minerTypePaths));
                }
            }

            foreach (var pack in defaults)
            {
                var packageName = $"MinerPathPackage_{pack.Name}";
                var packageFile = new MinerPathPackageFile(packageName);
                var readPack    = packageFile.ReadFile();
                if (readPack == null)
                {
                    // read has failed
                    Helpers.ConsolePrint("MinerPaths", "Creating internal paths config " + packageName);
                    MinerPathPackages.Add(pack);
                    packageFile.Commit(pack);
                }
                else
                {
                    Helpers.ConsolePrint("MinerPaths", "Loading internal paths config " + packageName);
                    var isChange = false;
                    foreach (var miner in pack.MinerTypes)
                    {
                        var readMiner = readPack.MinerTypes.Find(x => x.Type == miner.Type);
                        if (readMiner != null)
                        {
                            // file contains miner type
                            foreach (var algo in miner.Algorithms)
                            {
                                if (!readMiner.Algorithms.Exists(x => x.Algorithm == algo.Algorithm))
                                {
                                    // file does not contain algo on this miner
                                    Helpers.ConsolePrint("PATHS",
                                                         $"Algorithm {algo.Name} not found in miner {miner.Name} on device {pack.Name}. Adding default");
                                    readMiner.Algorithms.Add(algo);
                                    isChange = true;
                                }
                            }
                        }
                        else
                        {
                            // file does not contain miner type
                            Helpers.ConsolePrint("PATHS", $"Miner {miner.Name} not found on device {pack.Name}");
                            readPack.MinerTypes.Add(miner);
                            isChange = true;
                        }
                    }
                    MinerPathPackages.Add(readPack);
                    if (isChange)
                    {
                        packageFile.Commit(readPack);
                    }
                }
            }
        }
Example #7
0
        public static void InitMinerReservedPortsFile()
        {
            var file = new MinerReservedPortsFile();

            _minerReservedPorts = new Dictionary <MinerBaseType, Dictionary <string, Dictionary <AlgorithmType, List <int> > > >();
            if (file.IsFileExists())
            {
                var read = file.ReadFile();
                if (read != null)
                {
                    _minerReservedPorts = read;
                }
            }
            try
            {
                for (var type = (MinerBaseType.NONE + 1); type < MinerBaseType.END; ++type)
                {
                    if (_minerReservedPorts.ContainsKey(type) == false)
                    {
                        _minerReservedPorts[type] = new Dictionary <string, Dictionary <AlgorithmType, List <int> > >();
                    }
                }
                for (var devGroupType = (DeviceGroupType.NONE + 1); devGroupType < DeviceGroupType.LAST; ++devGroupType)
                {
                    var minerAlgosForGroup = GroupAlgorithms.CreateDefaultsForGroup(devGroupType);
                    if (minerAlgosForGroup != null)
                    {
                        foreach (var mbaseKvp in minerAlgosForGroup)
                        {
                            var minerBaseType = mbaseKvp.Key;
                            if (_minerReservedPorts.ContainsKey(minerBaseType))
                            {
                                var algos = mbaseKvp.Value;
                                foreach (var algo in algos)
                                {
                                    var algoType    = algo.NiceHashID;
                                    var path        = MinerPaths.GetPathFor(minerBaseType, algoType, devGroupType);
                                    var isPathValid = path != MinerPaths.Data.None;
                                    if (isPathValid && _minerReservedPorts[minerBaseType].ContainsKey(path) == false)
                                    {
                                        _minerReservedPorts[minerBaseType][path] = new Dictionary <AlgorithmType, List <int> >();
                                    }
                                    if (isPathValid && _minerReservedPorts[minerBaseType][path] != null &&
                                        _minerReservedPorts[minerBaseType][path].ContainsKey(algoType) == false)
                                    {
                                        _minerReservedPorts[minerBaseType][path][algoType] = new List <int>();
                                    }
                                }
                            }
                        }
                    }
                }
                file.Commit(_minerReservedPorts);
                // set all reserved
                foreach (var paths in _minerReservedPorts.Values)
                {
                    foreach (var algos in paths.Values)
                    {
                        foreach (var ports in algos.Values)
                        {
                            foreach (var port in ports)
                            {
                                AllReservedPorts.Add(port);
                            }
                        }
                    }
                }
            }
            catch { }
        }
Example #8
0
        public static void InitializePackages()
        {
            var defaults = new List <MinerPathPackage>();

            for (var i = DeviceGroupType.NONE + 1; i < DeviceGroupType.LAST; i++)
            {
                var minerTypePaths = new List <MinerTypePath>();
                var package        = GroupAlgorithms.CreateDefaultsForGroup(i);
                foreach (var type in configurableMiners)
                {
                    if (package.ContainsKey(type))
                    {
                        var minerPaths = new List <MinerPath>();
                        foreach (var algo in package[type])
                        {
                            minerPaths.Add(new MinerPath(algo.NiceHashID, GetPathFor(type, algo.NiceHashID, i, true)));
                        }
                        minerTypePaths.Add(new MinerTypePath(type, minerPaths));
                    }
                }
                if (minerTypePaths.Count > 0)
                {
                    defaults.Add(new MinerPathPackage(i, minerTypePaths));
                }
            }

            foreach (var pack in defaults)
            {
                var packageName = String.Format("MinerPathPackage_{0}", pack.Name);
                var packageFile = new MinerPathPackageFile(packageName);
                var readPack    = packageFile.ReadFile();
                if (readPack == null)     // read has failed
                {
                    Helpers.ConsolePrint("MinerPaths", "Creating internal paths config " + packageName);
                    minerPathPackages.Add(pack);
                    packageFile.Commit(pack);
                }
                else
                {
                    Helpers.ConsolePrint("MinerPaths", "Loading internal paths config " + packageName);
                    var isChange = false;
                    foreach (var miner in pack.MinerTypes)
                    {
                        var readMiner = readPack.MinerTypes.Find(x => x.Type == miner.Type);
                        if (readMiner != null)    // file contains miner type
                        {
                            foreach (var algo in miner.Algorithms)
                            {
                                if (!readMiner.Algorithms.Exists(x => x.Algorithm == algo.Algorithm))    // file does not contain algo on this miner
                                {
                                    Helpers.ConsolePrint("PATHS", String.Format("Algorithm {0} not found in miner {1} on device {2}. Adding default", algo.Name, miner.Name, pack.Name));
                                    readMiner.Algorithms.Add(algo);
                                    isChange = true;
                                }
                            }
                        }
                        else      // file does not contain miner type
                        {
                            Helpers.ConsolePrint("PATHS", String.Format("Miner {0} not found on device {1}", miner.Name, pack.Name));
                            readPack.MinerTypes.Add(miner);
                            isChange = true;
                        }
                    }
                    minerPathPackages.Add(readPack);
                    if (isChange)
                    {
                        packageFile.Commit(readPack);
                    }
                }
            }
        }
Example #9
0
        protected override void InitSupportedMinerAlgorithms()
        {
            var allGroupSupportedList = GroupAlgorithms.GetAlgorithmKeysForGroup(DeviceGroupType.CPU);

            _supportedMinerAlgorithms = allGroupSupportedList.ToArray();
        }
Example #10
0
        public static void InitMinerReservedPortsFile()
        {
            var AMDCodenames = new List <string>()
            {
                "Hawaii", "Pitcairn", "Tahiti"
            };
            var AMDOptimizations = new List <bool>()
            {
                true, false
            };
            var CPUExtensions = new List <CPUExtensionType>()
            {
                CPUExtensionType.AVX2_AES,
                CPUExtensionType.AVX2,
                CPUExtensionType.AVX_AES,
                CPUExtensionType.AVX,
                CPUExtensionType.AES,
                CPUExtensionType.SSE2
            };
            MinerReservedPortsFile file = new MinerReservedPortsFile();

            MinerReservedPorts = new Dictionary <MinerBaseType, Dictionary <string, Dictionary <AlgorithmType, List <int> > > >();
            if (file.IsFileExists())
            {
                var read = file.ReadFile();
                if (read != null)
                {
                    MinerReservedPorts = read;
                }
            }
            try {
                for (MinerBaseType type = (MinerBaseType.NONE + 1); type < MinerBaseType.END; ++type)
                {
                    if (MinerReservedPorts.ContainsKey(type) == false)
                    {
                        MinerReservedPorts[type] = new Dictionary <string, Dictionary <AlgorithmType, List <int> > >();
                    }
                }
                for (DeviceGroupType devGroupType = (DeviceGroupType.NONE + 1); devGroupType < DeviceGroupType.LAST; ++devGroupType)
                {
                    var minerAlgosForGroup = GroupAlgorithms.CreateDefaultsForGroup(devGroupType);
                    if (minerAlgosForGroup != null)
                    {
                        foreach (var mbaseKvp in minerAlgosForGroup)
                        {
                            MinerBaseType minerBaseType = mbaseKvp.Key;
                            if (MinerReservedPorts.ContainsKey(minerBaseType))
                            {
                                var algos = mbaseKvp.Value;
                                // CPU case
                                if (MinerBaseType.cpuminer == minerBaseType)
                                {
                                    foreach (var algo in algos)
                                    {
                                        foreach (var cpuExt in CPUExtensions)
                                        {
                                            var algoType = algo.NiceHashID;
                                            var path     = MinerPaths.GetPathFor(minerBaseType, algoType, devGroupType, "", false, cpuExt);
                                            if (path != MinerPaths.NONE && MinerReservedPorts[minerBaseType].ContainsKey(path) == false)
                                            {
                                                MinerReservedPorts[minerBaseType][path] = new Dictionary <AlgorithmType, List <int> >();
                                            }
                                            if (MinerReservedPorts[minerBaseType][path] != null && MinerReservedPorts[minerBaseType][path].ContainsKey(algoType) == false)
                                            {
                                                MinerReservedPorts[minerBaseType][path][algoType] = new List <int>();
                                            }
                                        }
                                    }
                                }
                                else if (MinerBaseType.sgminer == minerBaseType)
                                {
                                    foreach (var algo in algos)
                                    {
                                        foreach (var isOptimized in AMDOptimizations)
                                        {
                                            foreach (var codename in AMDCodenames)
                                            {
                                                var algoType = algo.NiceHashID;
                                                var path     = MinerPaths.GetPathFor(minerBaseType, algoType, devGroupType, codename, isOptimized, CPUExtensionType.Automatic);
                                                if (path != MinerPaths.NONE && MinerReservedPorts[minerBaseType].ContainsKey(path) == false)
                                                {
                                                    MinerReservedPorts[minerBaseType][path] = new Dictionary <AlgorithmType, List <int> >();
                                                }
                                                if (MinerReservedPorts[minerBaseType][path] != null && MinerReservedPorts[minerBaseType][path].ContainsKey(algoType) == false)
                                                {
                                                    MinerReservedPorts[minerBaseType][path][algoType] = new List <int>();
                                                }
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    foreach (var algo in algos)
                                    {
                                        var algoType = algo.NiceHashID;
                                        var path     = MinerPaths.GetPathFor(minerBaseType, algoType, devGroupType, "", false, CPUExtensionType.Automatic);
                                        if (path != MinerPaths.NONE && MinerReservedPorts[minerBaseType].ContainsKey(path) == false)
                                        {
                                            MinerReservedPorts[minerBaseType][path] = new Dictionary <AlgorithmType, List <int> >();
                                        }
                                        if (MinerReservedPorts[minerBaseType][path] != null && MinerReservedPorts[minerBaseType][path].ContainsKey(algoType) == false)
                                        {
                                            MinerReservedPorts[minerBaseType][path][algoType] = new List <int>();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                file.Commit(MinerReservedPorts);
                // set all reserved
                foreach (var paths in MinerReservedPorts.Values)
                {
                    foreach (var algos in paths.Values)
                    {
                        foreach (var ports in algos.Values)
                        {
                            foreach (int port in ports)
                            {
                                AllReservedPorts.Add(port);
                            }
                        }
                    }
                }
            } catch {
            }
        }