Exemplo n.º 1
0
 public static string ParseForMiningPair(MiningPair miningPair, AlgorithmType algorithmType, DeviceType deviceType, bool showLog = true)
 {
     return(ParseForMiningPairs(
                new List <MiningPair>()
     {
         miningPair
     },
                deviceType, showLog));
 }
        public static void Initialize(TestContext context)
        {
            _gMiner   = new TestGMiner();
            _beamAlgo = new Algorithm(MinerBaseType.GMiner, AlgorithmType.Beam);
            var dev  = new ComputeDevice(0);
            var pair = new MiningPair(dev, _beamAlgo);

            _gMiner.InitBenchmarkSetup(pair);
            NHSmaData.Initialize();
        }
Exemplo n.º 3
0
        public override bool CanGroup(MiningPair a, MiningPair b)
        {
            var isSameDeviceType = a.Device.DeviceType == b.Device.DeviceType;

            if (!isSameDeviceType)
            {
                return(false);
            }
            return(base.CanGroup(a, b));
        }
Exemplo n.º 4
0
 /// <summary>
 /// CanGroup checks if miner can run multiple devices with same algorithm in one miner instance
 /// In following example we check if the algorithm type of first pair is DaggerHashimoto - in that case we don't group them
 /// Otherwise we check if Algorithm of first pair is same to algorithm in second pair and group them if they are same
 /// </summary>
 public bool CanGroup(MiningPair a, MiningPair b)
 {
     // we can't combine Lyra2Z for some arbitrary reason on this miner
     if (a.Algorithm.FirstAlgorithmType == AlgorithmType.Lyra2Z)
     {
         return(false);
     }
     // other algorithms can be combined
     return(a.Algorithm.FirstAlgorithmType == b.Algorithm.FirstAlgorithmType);
 }
Exemplo n.º 5
0
 public static string ParseForMiningPair(MiningPair miningPair, AlgorithmType algorithmType, DeviceType deviceType, bool showLog = true)
 {
     return(ParseForMiningPairs(
                new List <MiningPair>()
     {
         miningPair
     },
                algorithmType, deviceType,
                MinerPaths.GetOptimizedMinerPath(miningPair), showLog));
 }
Exemplo n.º 6
0
        public override bool CanGroup(MiningPair a, MiningPair b)
        {
            var canGroup = base.CanGroup(a, b);

            if (canGroup && a.Device is AMDDevice aDev && b.Device is AMDDevice bDev && aDev.OpenCLPlatformID != bDev.OpenCLPlatformID)
            {
                // OpenCLPlatorm IDs must match
                return(false);
            }
            return(canGroup);
        }
Exemplo n.º 7
0
        public virtual bool CanGroup(MiningPair a, MiningPair b)
        {
            var checkELPCompatibility = MinerOptionsPackage?.GroupMiningPairsOnlyWithCompatibleOptions ?? false;
            var isSameAlgoType        = MinerToolkit.IsSameAlgorithmType(a.Algorithm, b.Algorithm);

            if (isSameAlgoType && checkELPCompatibility)
            {
                var ignoreDefaults = MinerOptionsPackage.IgnoreDefaultValueOptions;
                var areGeneralOptionsCompatible     = ExtraLaunchParametersParser.CheckIfCanGroup(a, b, MinerOptionsPackage.GeneralOptions, ignoreDefaults);
                var areTemperatureOptionsCompatible = ExtraLaunchParametersParser.CheckIfCanGroup(a, b, MinerOptionsPackage.TemperatureOptions, ignoreDefaults);
                return(areGeneralOptionsCompatible && areTemperatureOptionsCompatible);
            }

            return(isSameAlgoType);
        }
Exemplo n.º 8
0
        public static bool ShouldGroup(MiningPair a, MiningPair b)
        {
            if (a.Algorithm.MinerID != b.Algorithm.MinerID)
            {
                return(false);
            }
            var plugin = MinerPluginsManager.GetPluginWithUuid(a.Algorithm.MinerID);

            if (plugin == null)
            {
                return(false);
            }
            var canGroup = plugin.CanGroup(a, b);

            return(canGroup);
        }
 // exception...
 public static int GetEqmCudaThreadCount(MiningPair pair)
 {
     if (pair.CurrentExtraLaunchParameters.Contains("-ct"))
     {
         List <MinerOption> eqm_CUDA_Options = new List <MinerOption>()
         {
             new MinerOption("CUDA_Solver_Thread", "-ct", "-ct", "1", MinerOptionFlagType.MultiParam, " "),
         };
         string parsedStr = Parse(new List <MiningPair>()
         {
             pair
         }, eqm_CUDA_Options, true);
         try {
             int threads = Int32.Parse(parsedStr.Trim().Replace("-ct", "").Trim());
             return(threads);
         } catch { }
     }
     return(1); // default
 }
 // exception...
 public static int GetEqmCudaThreadCount(MiningPair pair)
 {
     if (pair.CurrentExtraLaunchParameters.Contains("-ct"))
     {
         var eqmCudaOptions = new List<MinerOption>
         {
             new MinerOption("CUDA_Solver_Thread", "-ct", "-ct", "1", MinerOptionFlagType.MultiParam, " "),
         };
         var parsedStr = Parse(new List<MiningPair>
         {
             pair
         }, eqmCudaOptions);
         try
         {
             var threads = int.Parse(parsedStr.Trim().Replace("-ct", "").Trim());
             return threads;
         }
         catch { }
     }
     return 1; // default 
 }
 public static List<int> GetIntensityStak(MiningPair pair)
 {
     var algo = pair.Algorithm;
     var intensities = new List<int>();
     if (algo.ExtraLaunchParameters.Contains("--intensity"))
     {
         var strings = algo.ExtraLaunchParameters.Split(new[] {" "}, StringSplitOptions.RemoveEmptyEntries).ToList();
         var i = strings.FindIndex(a => a == "--intensity") + 1;
         if (i > -1 && strings.Count > i)
         {
             var intStrings = strings[i].Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
             foreach (var intString in intStrings)
             {
                 if (int.TryParse(intString, out var intensity))
                 {
                     intensities.Add(intensity);
                 }
             }
         }
     }
     return intensities;
 }
Exemplo n.º 12
0
 private bool CanStartMiningPair(MiningPair pair)
 {
     try
     {
         if (!IsSupportedDeviceName(pair.Device.Name))
         {
             return(false);
         }
         if (!pair.Algorithm.IDs.Any(IsSupportedAlgorithm))
         {
             return(false);
         }
         if (!IsSupportedMinerPluginUUID(pair.Algorithm.MinerID))
         {
             return(false);
         }
         return(true);
     }
     catch (Exception e)
     {
         Logger.Error("ETHLARGEMENT", $"CanStartMiningPair error: {e.Message}");
         return(false);
     }
 }
Exemplo n.º 13
0
 public bool CanGroup(MiningPair a, MiningPair b)
 {
     return(a.Algorithm.FirstAlgorithmType == b.Algorithm.FirstAlgorithmType);
 }
 public static bool GetNoPrefetch(MiningPair cpuPair)
 {
     var algo = cpuPair.Algorithm;
     return algo.ExtraLaunchParameters.Contains("--no_prefetch");
 }
Exemplo n.º 15
0
 public bool CanGroup(MiningPair a, MiningPair b)
 {
     return(CheckExec(nameof(CanGroup), () => _plugin.CanGroup(a, b), false));
 }
Exemplo n.º 16
0
        public void Parse_Test()
        {
            var device1    = new BaseDevice(DeviceType.NVIDIA, "GPU-device1", "MSI GeForce GTX 1070 Ti", 0);
            var device2    = new BaseDevice(DeviceType.NVIDIA, "GPU-device2", "MSI GeForce GTX 1060 6GB", 1);
            var algorithm1 = new Algorithm("BMiner", AlgorithmType.GrinCuckaroo29);
            var algorithm2 = new Algorithm("BMiner", AlgorithmType.GrinCuckaroo29);
            var options    = new List <MinerOption>
            {
                new MinerOption
                {
                    Type      = MinerOptionType.OptionIsParameter,
                    ID        = "optionParameter",
                    ShortName = "-nofee"
                },
                new MinerOption
                {
                    Type         = MinerOptionType.OptionWithSingleParameter,
                    ID           = "singleParam",
                    ShortName    = "-intensity",
                    DefaultValue = "6"
                },
                new MinerOption
                {
                    Type         = MinerOptionType.OptionWithMultipleParameters,
                    ID           = "multiParam",
                    ShortName    = "--multi-intensity",
                    DefaultValue = "-1",
                    Delimiter    = ","
                },
                new MinerOption
                {
                    Type         = MinerOptionType.OptionWithMultipleParameters,
                    ID           = "multiParam_EqSign",
                    ShortName    = "--multi-power=",
                    DefaultValue = "-1",
                    Delimiter    = ","
                },
            };

            //option is param
            algorithm1.ExtraLaunchParameters = "-nofee";
            var pair1 = new MiningPair
            {
                Device    = device1,
                Algorithm = algorithm1
            };
            var miningPairs = new List <MiningPair>()
            {
                pair1
            };

            var ret = Parser.Parse(miningPairs, options);
            var exp = " -nofee";

            Assert.AreEqual(ret, exp);

            // Single param
            algorithm1.ExtraLaunchParameters = "-intensity 10";
            pair1 = new MiningPair
            {
                Device    = device1,
                Algorithm = algorithm1
            };
            miningPairs = new List <MiningPair>()
            {
                pair1
            };
            ret = Parser.Parse(miningPairs, options);
            exp = " -intensity 10";
            Assert.AreEqual(ret, exp);

            algorithm1.ExtraLaunchParameters = "-intensity 10 11";
            pair1 = new MiningPair
            {
                Device    = device1,
                Algorithm = algorithm1
            };
            miningPairs = new List <MiningPair>()
            {
                pair1
            };
            ret = Parser.Parse(miningPairs, options);
            exp = " -intensity 10";
            Assert.AreEqual(ret, exp);

            // Multi param
            algorithm1.ExtraLaunchParameters = "--multi-intensity 10,11";
            pair1 = new MiningPair
            {
                Device    = device1,
                Algorithm = algorithm1
            };
            miningPairs = new List <MiningPair>()
            {
                pair1
            };
            ret = Parser.Parse(miningPairs, options);
            exp = " --multi-intensity 10,11";
            Assert.AreEqual(ret, exp);

            // multi param, equal sign
            algorithm1.ExtraLaunchParameters = "--multi-power=10,11";
            pair1 = new MiningPair
            {
                Device    = device1,
                Algorithm = algorithm1
            };
            miningPairs = new List <MiningPair>()
            {
                pair1
            };
            ret = Parser.Parse(miningPairs, options);
            exp = " --multi-power=10,11";
            Assert.AreEqual(ret, exp);

            //multi param, 1 value
            algorithm1.ExtraLaunchParameters = "--multi-intensity 15";
            pair1 = new MiningPair
            {
                Device    = device1,
                Algorithm = algorithm1
            };
            miningPairs = new List <MiningPair>()
            {
                pair1
            };
            ret = Parser.Parse(miningPairs, options);
            exp = " --multi-intensity 15";
            Assert.AreEqual(ret, exp);

            //multi param, 1 value others default
            algorithm1.ExtraLaunchParameters = "--multi-intensity 15";
            pair1 = new MiningPair
            {
                Device    = device1,
                Algorithm = algorithm1
            };
            miningPairs = new List <MiningPair>()
            {
                pair1
            };
            ret = Parser.Parse(miningPairs, options);
            exp = " --multi-intensity 15";
            Assert.AreEqual(ret, exp);

            //multi param, no value
            algorithm1.ExtraLaunchParameters = "--multi-intensity";
            pair1 = new MiningPair
            {
                Device    = device1,
                Algorithm = algorithm1
            };
            miningPairs = new List <MiningPair>()
            {
                pair1
            };
            ret = Parser.Parse(miningPairs, options);
            exp = "";
            Assert.AreEqual(ret, exp);

            //multi param, 1value, other devices default
            algorithm1.ExtraLaunchParameters = "--multi-intensity 15";
            pair1 = new MiningPair
            {
                Device    = device1,
                Algorithm = algorithm1
            };
            var pair2 = new MiningPair
            {
                Device    = device2,
                Algorithm = algorithm2
            };

            miningPairs = new List <MiningPair>()
            {
                pair1, pair2
            };
            ret = Parser.Parse(miningPairs, options);
            exp = " --multi-intensity 15,-1";
            Assert.AreEqual(ret, exp);

            //default values
            algorithm1.ExtraLaunchParameters = "";
            pair1 = new MiningPair
            {
                Device    = device1,
                Algorithm = algorithm1
            };
            miningPairs = new List <MiningPair>()
            {
                pair1
            };
            ret = Parser.Parse(miningPairs, options, true);
            exp = " -nofee -intensity 6 --multi-intensity -1 --multi-power=-1";
            Assert.AreEqual(ret, exp);
        }
Exemplo n.º 17
0
 public bool CanGroup(MiningPair a, MiningPair b)
 {
     return(false);
 }
Exemplo n.º 18
0
 public bool CanGroup(MiningPair a, MiningPair b) => false;
Exemplo n.º 19
0
 bool IMinerPlugin.CanGroup(MiningPair a, MiningPair b) => GetValueOrErrorSettings.GetValueOrError("CanGroup", false);
 public bool CanGroup(MiningPair a, MiningPair b)
 {
     return(MinerToolkit.IsSameAlgorithmType(a.Algorithm, b.Algorithm));
 }