Example #1
0
        public Miner(DeviceType deviceType, DeviceGroupType deviceGroupType, string minerDeviceName)
        {
            MINER_ID        = MINER_ID_COUNT++;
            CDevs           = new List <ComputeDevice>();
            DeviceType      = deviceType;
            DeviceGroupType = deviceGroupType;
            MinerDeviceName = minerDeviceName;

            //WorkingDirectory = @"bin\dlls";
            WorkingDirectory = "";

            CurrentAlgorithmType = AlgorithmType.NONE;
            CurrentRate          = 0;
            IsRunning            = false;
            PreviousTotalMH      = 0.0;

            LastCommandLine = "";

            InitSupportedMinerAlgorithms();

            APIPort            = MinersApiPortsManager.Instance.GetAvaliablePort();
            IsAPIReadException = false;
            IsNHLocked         = false;
            _MAX_CooldownTimeInMilliseconds = GET_MAX_CooldownTimeInMilliseconds();
            //
            Helpers.ConsolePrint(MinerTAG(), "NEW MINER CREATED");
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeviceGroupResponse" /> class.
 /// </summary>
 /// <param name="groupName">Name of the group created (required).</param>
 /// <param name="groupType">groupType (required).</param>
 /// <param name="locationId">Location where this group is.</param>
 /// <param name="restrictionTier">restriction tier of the device group.</param>
 /// <param name="devices">An array of devices in the group (required).</param>
 /// <param name="deviceGroupId">a GUID that identifies a group (required).</param>
 /// <param name="deviceGroupCapabilities">Lowest common denominator capability of all the devices in the group (required).</param>
 /// <param name="roomId">roomId.</param>
 public DeviceGroupResponse(string groupName = default(string), DeviceGroupType groupType = default(DeviceGroupType), string locationId = default(string), int restrictionTier = default(int), List <DeviceGroupResponseDevices> devices = default(List <DeviceGroupResponseDevices>), string deviceGroupId = default(string), List <DeviceGroupCapability> deviceGroupCapabilities = default(List <DeviceGroupCapability>), string roomId = default(string))
 {
     // to ensure "groupName" is required (not null)
     if (groupName == null)
     {
         throw new ArgumentNullException("groupName is a required property for DeviceGroupResponse and cannot be null");
     }
     this.GroupName = groupName;
     this.GroupType = groupType;
     // to ensure "devices" is required (not null)
     if (devices == null)
     {
         throw new ArgumentNullException("devices is a required property for DeviceGroupResponse and cannot be null");
     }
     this.Devices = devices;
     // to ensure "deviceGroupId" is required (not null)
     if (deviceGroupId == null)
     {
         throw new ArgumentNullException("deviceGroupId is a required property for DeviceGroupResponse and cannot be null");
     }
     this.DeviceGroupId = deviceGroupId;
     // to ensure "deviceGroupCapabilities" is required (not null)
     if (deviceGroupCapabilities == null)
     {
         throw new ArgumentNullException("deviceGroupCapabilities is a required property for DeviceGroupResponse and cannot be null");
     }
     this.DeviceGroupCapabilities = deviceGroupCapabilities;
     this.LocationId      = locationId;
     this.RestrictionTier = restrictionTier;
     this.RoomId          = roomId;
 }
Example #3
0
        //TODO fix constructor to not include 3rd party handles + refactor inside interface device info (lookup fans speed/temps/...)
        public CudaComputeDevice(CudaDevice cudaDevice, DeviceGroupType group, int gpuCount,
                                 NvPhysicalGpuHandle nvHandle, nvmlDevice nvmlHandle)
            : base((int)cudaDevice.DeviceID,
                   cudaDevice.GetName(),
                   true,
                   group,
                   DeviceType.NVIDIA,
                   string.Format(Translations.Tr("GPU#{0}"), gpuCount),
                   cudaDevice.DeviceGlobalMemory)
        {
            BusID             = cudaDevice.pciBusID;
            SMMajor           = cudaDevice.SM_major;
            SMMinor           = cudaDevice.SM_minor;
            Uuid              = cudaDevice.UUID;
            AlgorithmSettings = DefaultAlgorithms.GetAlgorithmsForDevice(this);
            Index             = ID + AvailableDevices.AvailCpus; // increment by CPU count

            _nvHandle   = nvHandle;
            _nvmlDevice = nvmlHandle;

            ShouldRunEthlargement = cudaDevice.DeviceName.Contains("1080") || cudaDevice.DeviceName.Contains("Titan Xp");
            // plugin device
            var bd = new BaseDevice(DeviceType.NVIDIA, cudaDevice.UUID, cudaDevice.GetName(), (int)cudaDevice.DeviceID);

            PluginDevice = new CUDADevice(bd, cudaDevice.pciBusID, cudaDevice.DeviceGlobalMemory, cudaDevice.SM_major, cudaDevice.SM_minor);
        }
        //TODO fix constructor to not include 3rd party handles + refactor inside interface device info (lookup fans speed/temps/...)
        public CudaComputeDevice(CudaDevice cudaDevice, DeviceGroupType group, int gpuCount,
                                 NvPhysicalGpuHandle nvHandle, nvmlDevice nvmlHandle)
            : base((int)cudaDevice.DeviceID,
                   cudaDevice.GetName(),
                   true,
                   group,
                   DeviceType.NVIDIA,
                   string.Format(Translations.Tr("GPU#{0}"), gpuCount),
                   cudaDevice.DeviceGlobalMemory)
        {
            BusID   = cudaDevice.pciBusID;
            SMMajor = cudaDevice.SM_major;
            SMMinor = cudaDevice.SM_minor;
            // if no nvml loaded fallback ID
            if (string.IsNullOrEmpty(cudaDevice.UUID))
            {
                Uuid = GetUuid(ID, GroupNames.GetGroupName(DeviceGroupType, ID), Name, DeviceGroupType);
            }
            else
            {
                Uuid = cudaDevice.UUID;
            }
            AlgorithmSettings = DefaultAlgorithms.GetAlgorithmsForDevice(this);
            Index             = ID + AvailableDevices.AvailCpus; // increment by CPU count

            _nvHandle   = nvHandle;
            _nvmlDevice = nvmlHandle;

            ShouldRunEthlargement = cudaDevice.DeviceName.Contains("1080") || cudaDevice.DeviceName.Contains("Titan Xp");
        }
Example #5
0
 // GPU AMD
 /// <summary>
 /// Initializes a new instance of the <see cref="ComputeDevice"/> class.
 /// </summary>
 /// <param name="amdDevice">The <see cref="AmdGpuDevice"/></param>
 /// <param name="GPUCount">The <see cref="int"/></param>
 /// <param name="isDetectionFallback">The <see cref="bool"/></param>
 public ComputeDevice(AmdGpuDevice amdDevice, int GPUCount, bool isDetectionFallback)
 {
     ID              = amdDevice.DeviceID;
     BusID           = amdDevice.BusID;
     DeviceGroupType = DeviceGroupType.AMD_OpenCL;
     Name            = amdDevice.DeviceName;
     Enabled         = true;
     IsEtherumCapale = amdDevice.IsEtherumCapable();
     DeviceType      = DeviceType.AMD;
     NameCount       = String.Format(International.GetText("ComputeDevice_Short_Name_AMD_GPU"), GPUCount);
     if (isDetectionFallback)
     {
         UUID = GetUUID(ID, GroupNames.GetGroupName(DeviceGroupType, ID), Name, DeviceGroupType);
     }
     else
     {
         UUID = amdDevice.UUID;
     }
     // sgminer extra
     //IsOptimizedVersion = amdDevice.UseOptimizedVersion;
     Codename           = amdDevice.Codename;
     InfSection         = amdDevice.InfSection;
     AlgorithmSettings  = GroupAlgorithms.CreateForDeviceList(this);
     DriverDisableAlgos = amdDevice.DriverDisableAlgos;
     GpuRam             = amdDevice.DeviceGlobalMemory;
 }
Example #6
0
            public GroupMiners(GroupedDevices deviceUUIDSet)
            {
                _miners      = new List <Miner>();
                _deviceNames = new SortedSet <string>();
                foreach (var uuid in deviceUUIDSet)
                {
                    var tmpCdev = ComputeDevice.GetDeviceWithUUID(uuid);
                    _deviceNames.Add(tmpCdev.NameCount);
                    if (_deviceGroupType == DeviceGroupType.NONE)
                    {
                        _deviceGroupType = tmpCdev.DeviceGroupType;
                    }
                }
                // init device uuids
                _deviceUUIDs = deviceUUIDSet.ToArray();
                // init DevicesInfoString
                string[] _deviceNamesCount = new string[_deviceNames.Count];
                {
                    int i = 0;
                    foreach (var devName in _deviceNames)
                    {
                        _deviceNamesCount[i++] =
                            ComputeDevice.GetEnabledDeviceNameCount(devName).ToString()
                            + " * " + devName;
                    }
                }

                DevicesInfoString = "{ " + string.Join(", ", _deviceNames) + " }";
            }
Example #7
0
            public GroupMiners(GroupedDevices deviceUUIDSet)
            {
                _miners = new List<Miner>();
                _deviceNames = new SortedSet<string>();
                foreach (var uuid in deviceUUIDSet) {
                    var tmpCdev = ComputeDevice.GetDeviceWithUUID(uuid);
                    _deviceNames.Add(tmpCdev.NameCount);
                    if (_deviceGroupType == DeviceGroupType.NONE) {
                        _deviceGroupType = tmpCdev.DeviceGroupType;
                    }
                }
                // init device uuids
                _deviceUUIDs = deviceUUIDSet.ToArray();
                // init DevicesInfoString
                string[] _deviceNamesCount = new string[_deviceNames.Count];
                {
                    int i = 0;
                    foreach (var devName in _deviceNames) {
                        _deviceNamesCount[i++] =
                            ComputeDevice.GetEnabledDeviceNameCount(devName).ToString()
                            + " * " + devName;
                    }
                }

                DevicesInfoString = "{ " + string.Join(", ", _deviceNames) + " }";
            }
Example #8
0
 public static string GetPath(AlgorithmType algoType, DeviceGroupType devGroupType)
 {
     if (devGroupType == DeviceGroupType.NVIDIA_6_x)
     {
         return(NVIDIA_GROUPS.Ccminer_path(algoType, devGroupType));
     }
     return(Data.NONE); // should not happen
 }
Example #9
0
 // untested might not need anymore
 /// <summary>
 /// The Ccminer_unstable_path
 /// </summary>
 /// <param name="algorithmType">The <see cref="AlgorithmType"/></param>
 /// <param name="nvidiaGroup">The <see cref="DeviceGroupType"/></param>
 /// <returns>The <see cref="string"/></returns>
 public static string Ccminer_unstable_path(AlgorithmType algorithmType, DeviceGroupType nvidiaGroup)
 {
     // sm5x and sm6x have same settings
     if (nvidiaGroup == DeviceGroupType.NVIDIA_5_x || nvidiaGroup == DeviceGroupType.NVIDIA_6_x)
     {
     }
     // TODO wrong case?
     return(Data.ccminer_tpruvot2); // should not happen
 }
 protected ComputeDeviceGroupManager()
     : base()
 {
     _groupCount = new Dictionary <DeviceGroupType, int>();
     for (DeviceGroupType type = 0; type < DeviceGroupType.LAST; ++type)
     {
         _groupCount.Add(type, 0);
     }
 }
Example #11
0
 public static string GetGroupName(DeviceGroupType type, int id)
 {
     if(DeviceGroupType.CPU == type) {
         return "CPU"+id;
     } else if ((int)type < _names.Length && (int)type >= 0) {
         return _names[(int)type];
     }
     return "UnknownGroup";
 }
Example #12
0
        public static List <AlgorithmType> GetAlgorithmKeysForGroup(DeviceGroupType deviceGroupType)
        {
            var ret = CreateDefaultsForGroup(deviceGroupType);

            if (ret != null)
            {
                return(new List <AlgorithmType>(ret.Keys));
            }
            return(null);
        }
Example #13
0
 public static string ccminer_unstable_path(AlgorithmType algorithmType, DeviceGroupType nvidiaGroup) {
     // sm5x and sm6x have same settings
     if (nvidiaGroup == DeviceGroupType.NVIDIA_5_x || nvidiaGroup == DeviceGroupType.NVIDIA_6_x) {
         if (AlgorithmType.X11Gost == algorithmType) {
             return Data.ccminer_x11gost;
         }
     }
     // TODO wrong case?
     return Data.NONE; // should not happen
 }
 public static string CcminerUnstablePath(AlgorithmType algorithmType, DeviceGroupType nvidiaGroup)
 {
     // sm5x and sm6x have same settings
     if ((nvidiaGroup == DeviceGroupType.NVIDIA_5_x || nvidiaGroup == DeviceGroupType.NVIDIA_6_x) && (AlgorithmType.Keccak == algorithmType))
     {
         return(Data.CcminerX11Gost);
     }
     // TODO wrong case?
     return(Data.None); // should not happen
 }
Example #15
0
 // Ambiguous constructor
 /// <summary>
 /// Initializes a new instance of the <see cref="ComputeDevice"/> class.
 /// </summary>
 /// <param name="id">The <see cref="int"/></param>
 /// <param name="name">The <see cref="string"/></param>
 /// <param name="enabled">The <see cref="bool"/></param>
 /// <param name="group">The <see cref="DeviceGroupType"/></param>
 /// <param name="ethereumCapable">The <see cref="bool"/></param>
 /// <param name="type">The <see cref="DeviceType"/></param>
 /// <param name="nameCount">The <see cref="string"/></param>
 /// <param name="gpuRAM">The <see cref="ulong"/></param>
 protected ComputeDevice(int id, string name, bool enabled, DeviceGroupType group, bool ethereumCapable, DeviceType type, string nameCount, ulong gpuRAM)
 {
     ID              = id;
     Name            = name;
     Enabled         = enabled;
     DeviceGroupType = group;
     IsEtherumCapale = ethereumCapable;
     DeviceType      = type;
     NameCount       = nameCount;
     GpuRam          = gpuRAM;
 }
 // Ambiguous constructor
 protected ComputeDevice(int id, string name, bool enabled, DeviceGroupType group,
                         DeviceType type, string nameCount, ulong gpuRam)
 {
     ID              = id;
     Name            = name;
     Enabled         = enabled;
     DeviceGroupType = group;
     DeviceType      = type;
     NameCount       = nameCount;
     GpuRam          = gpuRam;
 }
        public int GetBenchamrktime(BenchmarkPerformanceType benchmarkPerformanceType, DeviceGroupType deviceGroupType)
        {
            if (deviceGroupType == DeviceGroupType.CPU) {
                return CPU[(int)benchmarkPerformanceType];
            }
            if (deviceGroupType == DeviceGroupType.AMD_OpenCL) {
                return AMD[(int)benchmarkPerformanceType];
            }

            return NVIDIA[(int)benchmarkPerformanceType];
        }
Example #18
0
 public static string GetGroupName(DeviceGroupType type, int id)
 {
     if (DeviceGroupType.CPU == type)
     {
         return("CPU" + id);
     }
     else if ((int)type < _names.Length)
     {
         return(_names[(int)type]);
     }
     return("UnknownGroup");
 }
Example #19
0
 public static string ccminer_path(AlgorithmType algorithmType, DeviceGroupType nvidiaGroup) {
     // 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);
     }
     // TODO wrong case?
     return Data.NONE; // should not happen
 }
 public static string GetGroupName(DeviceGroupType type, int id)
 {
     if (DeviceGroupType.CPU == type)
     {
         return("CPU" + id);
     }
     if ((int)type < Names.Length && (int)type >= 0)
     {
         return(Names[(int)type]);
     }
     return("UnknownGroup");
 }
 // GPU NVIDIA
 public ComputeDevice(CudaDevice cudaDevice, DeviceGroupType group, int GPUCount)
 {
     ID                = (int)cudaDevice.DeviceID;
     Name              = cudaDevice.GetName();
     Enabled           = true;
     DeviceGroupType   = group;
     IsEtherumCapale   = cudaDevice.IsEtherumCapable();
     DeviceType        = DeviceType.NVIDIA;
     NameCount         = String.Format(International.GetText("ComputeDevice_Short_Name_NVIDIA_GPU"), GPUCount);
     UUID              = cudaDevice.UUID;
     AlgorithmSettings = GroupAlgorithms.CreateForDevice(this);
 }
Example #22
0
 private static void InitAlgosInGroup()
 {
     for (DeviceGroupType type = DeviceGroupType.CPU; type < DeviceGroupType.LAST; ++type)
     {
         var supportedList = GetAlgorithmKeysForGroup(type);
         if (supportedList != null)
         {
             _algosInGroup[type] = supportedList;
         }
     }
     _IsAlgosInGroupInit = true;
 }
Example #23
0
 // GPU NVIDIA
 public ComputeDevice(CudaDevice cudaDevice, DeviceGroupType group, int GPUCount)
 {
     _cudaDevice     = cudaDevice;
     ID              = (int)cudaDevice.DeviceID;
     Name            = cudaDevice.GetName();
     _nameNoNums     = cudaDevice.GetName();
     Enabled         = true;
     DeviceGroupType = group;
     IsEtherumCapale = cudaDevice.IsEtherumCapable();
     DeviceType      = DeviceType.NVIDIA;
     NameCount       = String.Format(International.GetText("ComputeDevice_Short_Name_NVIDIA_GPU"), GPUCount);
     UUID            = cudaDevice.UUID;
 }
Example #24
0
 // Fake dev
 public ComputeDevice(int id)
 {
     ID = id;
     Name = "fake_" + id;
     NameCount = Name;
     Enabled = true;
     DeviceType = DeviceType.CPU;
     DeviceGroupType = DeviceGroupType.NONE;
     IsEtherumCapale = false;
     IsOptimizedVersion = false;
     Codename = "fake";
     UUID = GetUUID(ID, GroupNames.GetGroupName(DeviceGroupType, ID), Name, DeviceGroupType);
 }
 // Fake dev
 public ComputeDevice(int id)
 {
     ID              = id;
     Name            = "fake_" + id;
     NameCount       = Name;
     Enabled         = true;
     DeviceType      = DeviceType.CPU;
     DeviceGroupType = DeviceGroupType.NONE;
     //IsOptimizedVersion = false;
     Codename = "fake";
     Uuid     = GetUuid(ID, GroupNames.GetGroupName(DeviceGroupType, ID), Name, DeviceGroupType);
     GpuRam   = 0;
 }
Example #26
0
 public static bool IsAlgorithmSupportedForGroup(AlgorithmType algorithmType, DeviceGroupType deviceGroupType)
 {
     // lazy init
     if (_IsAlgosInGroupInit == false)
     {
         InitAlgosInGroup();
     }
     if (_algosInGroup.ContainsKey(deviceGroupType))
     {
         return(_algosInGroup[deviceGroupType].Contains(algorithmType));
     }
     return(false);
 }
Example #27
0
 // CPU
 public ComputeDevice(int id, string group, string name, int threads, ulong affinityMask, int CPUCount)
 {
     ID              = id;
     Name            = name;
     Threads         = threads;
     AffinityMask    = affinityMask;
     _nameNoNums     = name;
     Enabled         = true;
     DeviceGroupType = DeviceGroupType.CPU;
     DeviceType      = DeviceType.CPU;
     NameCount       = String.Format(International.GetText("ComputeDevice_Short_Name_CPU"), CPUCount);
     UUID            = GetUUID(ID, GroupNames.GetGroupName(DeviceGroupType, ID), Name, DeviceGroupType);
 }
 // Fake dev
 public ComputeDevice(int id)
 {
     ID                 = id;
     Name               = "fake_" + id;
     NameCount          = Name;
     Enabled            = true;
     DeviceType         = DeviceType.CPU;
     DeviceGroupType    = DeviceGroupType.NONE;
     IsEtherumCapale    = false;
     IsOptimizedVersion = false;
     Codename           = "fake";
     UUID               = GetUUID(ID, GroupNames.GetGroupName(DeviceGroupType, ID), Name, DeviceGroupType);
 }
        public DeviceBenchmarkConfig GetConfig(DeviceGroupType deviceGroupType,
                                               string deviceUUID, string deviceName)
        {
            DeviceBenchmarkConfig retConfig = GetConfig(deviceUUID);

            if (retConfig == null)
            {
                retConfig = new DeviceBenchmarkConfig(deviceGroupType, deviceUUID, deviceName);
                _benchmarkConfigs.Add(deviceUUID, retConfig);
            }

            return(retConfig);
        }
Example #30
0
        // create miner creates new miners, except cpuminer, those are saves and called from GetCpuMiner()
        public static Miner CreateMiner(DeviceGroupType deviceGroupType, AlgorithmType algorithmType)
        {
            if (AlgorithmType.Equihash == algorithmType)
            {
                if (DeviceGroupType.NVIDIA_5_x == deviceGroupType || DeviceGroupType.NVIDIA_6_x == deviceGroupType ||
                    (EquihashCPU_USE_eqm() && DeviceGroupType.CPU == deviceGroupType))
                {
                    return(new eqm());
                }
                else
                {
                    return(new nheqminer());
                }
            }
            else if (AlgorithmType.DaggerHashimoto == algorithmType)
            {
                if (DeviceGroupType.AMD_OpenCL == deviceGroupType)
                {
                    return(new MinerEtherumOCL());
                }
                else
                {
                    return(new MinerEtherumCUDA());
                }
            }
            else
            {
                switch (deviceGroupType)
                {
                case DeviceGroupType.AMD_OpenCL:
                    return(new sgminer());

                case DeviceGroupType.NVIDIA_2_1:
                    return(new ccminer_sm21());

                case DeviceGroupType.NVIDIA_3_x:
                    return(new ccminer_sm3x());

                case DeviceGroupType.NVIDIA_5_x:
                    return(new ccminer_sm5x());

                case DeviceGroupType.NVIDIA_6_x:
                    return(new ccminer_sm6x());

                case DeviceGroupType.CPU:
                    return(new cpuminer());
                }
            }

            return(null);
        }
Example #31
0
        // static methods
        /// <summary>
        /// The GetUUID
        /// </summary>
        /// <param name="id">The <see cref="int"/></param>
        /// <param name="group">The <see cref="string"/></param>
        /// <param name="name">The <see cref="string"/></param>
        /// <param name="deviceGroupType">The <see cref="DeviceGroupType"/></param>
        /// <returns>The <see cref="string"/></returns>
        protected static string GetUUID(int id, string group, string name, DeviceGroupType deviceGroupType)
        {
            var    SHA256    = new SHA256Managed();
            var    hash      = new StringBuilder();
            string mixedAttr = id.ToString() + group + name + ((int)deviceGroupType).ToString();

            byte[] hashedBytes = SHA256.ComputeHash(Encoding.UTF8.GetBytes(mixedAttr), 0, Encoding.UTF8.GetByteCount(mixedAttr));
            foreach (var b in hashedBytes)
            {
                hash.Append(b.ToString("x2"));
            }
            // GEN indicates the UUID has been generated and cannot be presumed to be immutable
            return("GEN-" + hash.ToString());
        }
 // CPU
 public ComputeDevice(int id, string group, string name, bool addToGlobalList = false, bool enabled = true)
 {
     ID = id;
     Group = group;
     Name = name;
     _nameNoNums = name;
     Enabled = enabled;
     DeviceGroupType = GroupNames.GetType(Group);
     DeviceGroupString = GroupNames.GetNameGeneral(DeviceGroupType);
     DeviceType = DeviceType.CPU;
     InitGlobalsList(addToGlobalList);
     NameCount = String.Format(International.GetText("ComputeDevice_Short_Name_CPU"), ++CPUCount);
     UUID = GetUUID(ID, Group, Name, DeviceGroupType);
 }
        public static string GetId(DeviceGroupType deviceGroupType,
                                   string deviceGroupName)
        {
            var    SHA256    = new SHA256Managed();
            var    hash      = new StringBuilder();
            string mixedAttr = ((int)deviceGroupType).ToString() + deviceGroupName;

            byte[] hashedBytes = SHA256.ComputeHash(Encoding.UTF8.GetBytes(mixedAttr), 0, Encoding.UTF8.GetByteCount(mixedAttr));
            foreach (var b in hashedBytes)
            {
                hash.Append(b.ToString("x2"));
            }
            return(hash.ToString());
        }
 // CPU
 public ComputeDevice(int id, string group, string name, int threads, ulong affinityMask, int CPUCount)
 {
     ID                = id;
     Name              = name;
     Threads           = threads;
     AffinityMask      = affinityMask;
     Enabled           = true;
     DeviceGroupType   = DeviceGroupType.CPU;
     DeviceType        = DeviceType.CPU;
     NameCount         = String.Format(International.GetText("ComputeDevice_Short_Name_CPU"), CPUCount);
     UUID              = GetUUID(ID, GroupNames.GetGroupName(DeviceGroupType, ID), Name, DeviceGroupType);
     AlgorithmSettings = GroupAlgorithms.CreateForDevice(this);
     IsEtherumCapale   = false;
 }
Example #35
0
 // CPU
 public ComputeDevice(int id, string group, string name, int threads, ulong affinityMask, int CPUCount)
 {
     ID = id;
     Name = name;
     Threads = threads;
     AffinityMask = affinityMask;
     Enabled = true;
     DeviceGroupType = DeviceGroupType.CPU;
     DeviceType = DeviceType.CPU;
     NameCount = String.Format(International.GetText("ComputeDevice_Short_Name_CPU"), CPUCount);
     UUID = GetUUID(ID, GroupNames.GetGroupName(DeviceGroupType, ID), Name, DeviceGroupType);
     AlgorithmSettings = GroupAlgorithms.CreateForDevice(this);
     IsEtherumCapale = false;
 }
Example #36
0
        public static string GetOptimizedMinerPath(ComputeDevice computeDevice, Algorithm algorithm)
        {
            if (computeDevice == null || algorithm == null)
            {
                return(NONE);
            }
            AlgorithmType   algoType     = algorithm.NiceHashID;
            DeviceType      devType      = computeDevice.DeviceType;
            DeviceGroupType devGroupType = computeDevice.DeviceGroupType;
            string          devCodename  = computeDevice.Codename;
            bool            isOptimized  = computeDevice.IsOptimizedVersion;

            return(GetOptimizedMinerPath(algoType, devType, devGroupType, devCodename, isOptimized));
        }
 // GPU AMD
 public ComputeDevice(AmdGpuDevice amdDevice, bool addToGlobalList = false, bool enabled = true)
 {
     _amdDevice = amdDevice;
     ID = amdDevice.DeviceID;
     DeviceGroupType = DeviceGroupType.AMD_OpenCL;
     Group = GroupNames.GetName(DeviceGroupType.AMD_OpenCL);
     DeviceGroupString = GroupNames.GetNameGeneral(DeviceGroupType);
     Name = amdDevice.DeviceName;
     _nameNoNums = amdDevice.DeviceName;
     Enabled = enabled;
     IsEtherumCapale = amdDevice.IsEtherumCapable();
     DeviceType = DeviceType.AMD;
     InitGlobalsList(addToGlobalList);
     NameCount = String.Format(International.GetText("ComputeDevice_Short_Name_AMD_GPU"), ++GPUCount);
     UUID = amdDevice.UUID;
     // sgminer extra
     IsOptimizedVersion = amdDevice.UseOptimizedVersion;
     Codename = amdDevice.Codename;
 }
 // GPU NVIDIA
 public ComputeDevice(CudaDevice cudaDevice, string group, bool addToGlobalList = false, bool enabled = true)
 {
     _cudaDevice = cudaDevice;
     ID = (int)cudaDevice.DeviceID;
     Group = group;
     Name = cudaDevice.GetName();
     _nameNoNums = cudaDevice.GetName();
     Enabled = enabled;
     DeviceGroupType = GroupNames.GetType(Group);
     DeviceGroupString = GroupNames.GetNameGeneral(DeviceGroupType);
     IsEtherumCapale = cudaDevice.IsEtherumCapable();
     DeviceType = DeviceType.NVIDIA;
     InitGlobalsList(addToGlobalList);
     NameCount = String.Format(International.GetText("ComputeDevice_Short_Name_NVIDIA_GPU"), ++GPUCount);
     UUID = cudaDevice.UUID;
 }
        public static Dictionary<AlgorithmType, Algorithm> CreateDefaultsForGroup(DeviceGroupType deviceGroupType)
        {
            if (DeviceGroupType.CPU == deviceGroupType) {
                return new Dictionary<AlgorithmType, Algorithm>() {
                { AlgorithmType.Lyra2RE, new Algorithm(AlgorithmType.Lyra2RE, "lyra2") },
                { AlgorithmType.Hodl, new Algorithm(AlgorithmType.Hodl, "hodl") },
                { AlgorithmType.CryptoNight, new Algorithm(AlgorithmType.CryptoNight, "cryptonight") /* NOT NEDDED { ExtraLaunchParameters = "--no-extranonce"}*/ }
                };
            }
            if (DeviceGroupType.AMD_OpenCL == deviceGroupType) {
                // DisableAMDTempControl = false; so temperature params are enabled by default, not sure if TemperatureParam should be lastly appended
                string DefaultParam = AmdGpuDevice.DefaultParam;
                return new Dictionary<AlgorithmType, Algorithm>() {
                { AlgorithmType.X13 , new Algorithm(AlgorithmType.X13,  "x13")
                    { ExtraLaunchParameters = DefaultParam + "--nfactor 10 --xintensity   64 --thread-concurrency    0 --worksize  64 --gpu-threads 2" + AmdGpuDevice.TemperatureParam } },
                { AlgorithmType.Keccak , new Algorithm(AlgorithmType.Keccak,  "keccak")
                    { ExtraLaunchParameters = DefaultParam + "--nfactor 10 --xintensity  300 --thread-concurrency    0 --worksize  64 --gpu-threads 1" + AmdGpuDevice.TemperatureParam } },
                { AlgorithmType.X15 , new Algorithm(AlgorithmType.X15,  "x15")
                    { ExtraLaunchParameters = DefaultParam + "--nfactor 10 --xintensity   64 --thread-concurrency    0 --worksize  64 --gpu-threads 2"  + AmdGpuDevice.TemperatureParam} },
                { AlgorithmType.Nist5 , new Algorithm(AlgorithmType.Nist5,  "nist5")
                    { ExtraLaunchParameters = DefaultParam + "--nfactor 10 --xintensity   16 --thread-concurrency    0 --worksize  64 --gpu-threads 2" + AmdGpuDevice.TemperatureParam } },
                { AlgorithmType.NeoScrypt , new Algorithm(AlgorithmType.NeoScrypt, "neoscrypt")
                    { ExtraLaunchParameters = DefaultParam + "--nfactor 10 --xintensity    2 --thread-concurrency 8192 --worksize  64 --gpu-threads 4" + AmdGpuDevice.TemperatureParam } },
                { AlgorithmType.WhirlpoolX , new Algorithm(AlgorithmType.WhirlpoolX, "whirlpoolx")
                    { ExtraLaunchParameters = DefaultParam + "--nfactor 10 --xintensity   64 --thread-concurrency    0 --worksize 128 --gpu-threads 2" + AmdGpuDevice.TemperatureParam } },
                { AlgorithmType.Qubit , new Algorithm(AlgorithmType.Qubit,  "qubitcoin")
                    { ExtraLaunchParameters = DefaultParam + "--intensity 18 --worksize 64 --gpu-threads 2" + AmdGpuDevice.TemperatureParam } },
                { AlgorithmType.Quark , new Algorithm(AlgorithmType.Quark,  "quarkcoin")
                    { ExtraLaunchParameters = DefaultParam + "--nfactor 10 --xintensity 1024 --thread-concurrency    0 --worksize  64 --gpu-threads 1" + AmdGpuDevice.TemperatureParam } },
                { AlgorithmType.Lyra2REv2 , new Algorithm(AlgorithmType.Lyra2REv2,  "Lyra2REv2")
                    { ExtraLaunchParameters = DefaultParam + "--nfactor 10 --xintensity  160 --thread-concurrency    0 --worksize  64 --gpu-threads 1" + AmdGpuDevice.TemperatureParam } },
                { AlgorithmType.Blake256r8 , new Algorithm(AlgorithmType.Blake256r8, "blakecoin")
                    { ExtraLaunchParameters = DefaultParam + "--intensity  24 --worksize 128 --gpu-threads 2" + AmdGpuDevice.TemperatureParam } },
                { AlgorithmType.Blake256r14 , new Algorithm(AlgorithmType.Blake256r14, "blake")
                    { ExtraLaunchParameters = DefaultParam + "--intensity  24 --worksize 128 --gpu-threads 2" + AmdGpuDevice.TemperatureParam } },
                { AlgorithmType.Blake256r8vnl , new Algorithm(AlgorithmType.Blake256r8vnl, "vanilla")
                    { ExtraLaunchParameters = DefaultParam + "--intensity  24 --worksize 128 --gpu-threads 2" + AmdGpuDevice.TemperatureParam } },
                { AlgorithmType.DaggerHashimoto , new Algorithm(AlgorithmType.DaggerHashimoto, "daggerhashimoto") },
                { AlgorithmType.Decred , new Algorithm(AlgorithmType.Decred, "decred")
                    { ExtraLaunchParameters = "--gpu-threads 1 --remove-disabled --xintensity 256 --lookup-gap 2 --worksize 64" + AmdGpuDevice.TemperatureParam } },
                { AlgorithmType.Lbry, new Algorithm(AlgorithmType.Lbry, "lbry")
                    { ExtraLaunchParameters = DefaultParam + "--xintensity 512 --worksize 128 --gpu-threads 2" + AmdGpuDevice.TemperatureParam } },
                };
            }
            // NVIDIA
            if (DeviceGroupType.NVIDIA_2_1 == deviceGroupType || DeviceGroupType.NVIDIA_3_x == deviceGroupType || DeviceGroupType.NVIDIA_5_x == deviceGroupType || DeviceGroupType.NVIDIA_6_x == deviceGroupType) {
                var ret = new Dictionary<AlgorithmType, Algorithm> {
                { AlgorithmType.X13 , new Algorithm(AlgorithmType.X13, "x13") },
                { AlgorithmType.Keccak , new Algorithm(AlgorithmType.Keccak, "keccak") },
                { AlgorithmType.X15 , new Algorithm(AlgorithmType.X15, "x15") },
                { AlgorithmType.Nist5 , new Algorithm(AlgorithmType.Nist5, "nist5") },
                { AlgorithmType.NeoScrypt , new Algorithm(AlgorithmType.NeoScrypt, "neoscrypt") },
                { AlgorithmType.WhirlpoolX , new Algorithm(AlgorithmType.WhirlpoolX, "whirlpoolx") },
                { AlgorithmType.Qubit , new Algorithm(AlgorithmType.Qubit, "qubit") },
                { AlgorithmType.Quark , new Algorithm(AlgorithmType.Quark, "quark") },
                { AlgorithmType.Lyra2RE , new Algorithm(AlgorithmType.Lyra2RE, "lyra2") },
                { AlgorithmType.Lyra2REv2 , new Algorithm(AlgorithmType.Lyra2REv2, "lyra2v2") },
                { AlgorithmType.Blake256r8 , new Algorithm(AlgorithmType.Blake256r8, "blakecoin") },
                { AlgorithmType.Blake256r14 , new Algorithm(AlgorithmType.Blake256r14, "blake") },
                { AlgorithmType.Blake256r8vnl , new Algorithm(AlgorithmType.Blake256r8vnl, "vanilla") },
                { AlgorithmType.DaggerHashimoto , new Algorithm(AlgorithmType.DaggerHashimoto, "daggerhashimoto") },
                { AlgorithmType.Decred , new Algorithm(AlgorithmType.Decred, "decred") },
                { AlgorithmType.CryptoNight, new Algorithm(AlgorithmType.CryptoNight, "cryptonight") },
                { AlgorithmType.Lbry, new Algorithm(AlgorithmType.Lbry, "lbry") },
                };
                if(DeviceGroupType.NVIDIA_2_1 == deviceGroupType) {
                    // minerName change => "whirlpoolx" => "whirlpool"
                    ret[AlgorithmType.WhirlpoolX] = new Algorithm(AlgorithmType.WhirlpoolX, "whirlpool");     // Needed for new tpruvot's ccminer
                    // disable/remove neoscrypt, daggerhashimoto
                    ret.Remove(AlgorithmType.NeoScrypt);
                    ret.Remove(AlgorithmType.DaggerHashimoto);

                    ret.Remove(AlgorithmType.Lyra2RE);
                    ret.Remove(AlgorithmType.Lyra2REv2);
                    //ret.Remove(AlgorithmType.CryptoNight);
                }
                if (DeviceGroupType.NVIDIA_3_x == deviceGroupType) {
                    // minerName change => "whirlpoolx" => "whirlpool"
                    ret[AlgorithmType.WhirlpoolX] = new Algorithm(AlgorithmType.WhirlpoolX, "whirlpool");     // Needed for new tpruvot's ccminer
                    // disable/remove neoscrypt
                    ret.Remove(AlgorithmType.NeoScrypt);
                    ret.Remove(AlgorithmType.Lyra2RE);
                    ret.Remove(AlgorithmType.Lyra2REv2);
                    //ret.Remove(AlgorithmType.CryptoNight);
                }
                return ret;
            }

            return null;
        }
Example #40
0
 // GPU AMD
 public ComputeDevice(AmdGpuDevice amdDevice, int GPUCount, bool isDetectionFallback)
 {
     ID = amdDevice.DeviceID;
     DeviceGroupType = DeviceGroupType.AMD_OpenCL;
     Name = amdDevice.DeviceName;
     Enabled = true;
     IsEtherumCapale = amdDevice.IsEtherumCapable();
     DeviceType = DeviceType.AMD;
     NameCount = String.Format(International.GetText("ComputeDevice_Short_Name_AMD_GPU"), GPUCount);
     if (isDetectionFallback) {
         UUID = GetUUID(ID, GroupNames.GetGroupName(DeviceGroupType, ID), Name, DeviceGroupType);
     } else {
         UUID = amdDevice.UUID;
     }
     // sgminer extra
     IsOptimizedVersion = amdDevice.UseOptimizedVersion;
     Codename = amdDevice.Codename;
     InfSection = amdDevice.InfSection;
     AlgorithmSettings = GroupAlgorithms.CreateForDevice(this);
 }
Example #41
0
 // static methods
 private static string GetUUID(int id, string group, string name, DeviceGroupType deviceGroupType)
 {
     var SHA256 = new SHA256Managed();
     var hash = new StringBuilder();
     string mixedAttr = id.ToString() + group + name + ((int)deviceGroupType).ToString();
     byte[] hashedBytes = SHA256.ComputeHash(Encoding.UTF8.GetBytes(mixedAttr), 0, Encoding.UTF8.GetByteCount(mixedAttr));
     foreach (var b in hashedBytes) {
         hash.Append(b.ToString("x2"));
     }
     // GEN indicates the UUID has been generated and cannot be presumed to be immutable
     return "GEN-" + hash.ToString();
 }
Example #42
0
 public static bool IsAlgorithmSupportedForGroup(AlgorithmType algorithmType, DeviceGroupType deviceGroupType)
 {
     // lazy init
     if (_IsAlgosInGroupInit == false) {
         InitAlgosInGroup();
     }
     if (_algosInGroup.ContainsKey(deviceGroupType)) {
         return _algosInGroup[deviceGroupType].Contains(algorithmType);
     }
     return false;
 }
Example #43
0
 // GPU NVIDIA
 public ComputeDevice(CudaDevice cudaDevice, DeviceGroupType group, int GPUCount)
 {
     ID = (int)cudaDevice.DeviceID;
     Name = cudaDevice.GetName();
     Enabled = true;
     DeviceGroupType = group;
     IsEtherumCapale = cudaDevice.IsEtherumCapable();
     DeviceType = DeviceType.NVIDIA;
     NameCount = String.Format(International.GetText("ComputeDevice_Short_Name_NVIDIA_GPU"), GPUCount);
     UUID = cudaDevice.UUID;
     AlgorithmSettings = GroupAlgorithms.CreateForDevice(this);
 }
 public static List<AlgorithmType> GetAlgorithmKeysForGroup(DeviceGroupType deviceGroupType)
 {
     var ret = CreateDefaultsForGroup(deviceGroupType);
     if (ret != null) {
         return new List <AlgorithmType>(ret.Keys);
     }
     return null;
 }