diff --git a/NiceHashMiner.sln b/NiceHashMiner.sln
index 6db0cc88d..c0975765f 100644
--- a/NiceHashMiner.sln
+++ b/NiceHashMiner.sln
@@ -14,8 +14,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Miners", "Miners", "{F40126
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{BB931C9A-EE48-42A6-B5F3-3A193B1A051A}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.NBMiner", "src\Miners\NBMiner\MP.NBMiner.csproj", "{A4B0CDCB-D1D7-4563-9888-D58E0B36D0F8}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MinerProcessCounter", "src\Tools\MinerProcessCounter\MinerProcessCounter.csproj", "{69B58028-8F30-4D3F-8E51-DEF85C08E4CC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CreateLogReport", "src\Tools\CreateLogReport\CreateLogReport.csproj", "{663285C0-8F68-4638-BEB2-4BB042868445}"
@@ -34,8 +32,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "runnhmasadmin", "src\Tools\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NiceHashMiner", "src\NiceHashMiner\NiceHashMiner.csproj", "{56653651-3BF1-4A89-A20C-3178C06A29A3}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.XMRig", "src\Miners\XMRig\MP.XMRig.csproj", "{850CBE9E-AB73-4C24-AFBD-2FA4911E07B5}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHMCore", "src\NHMCore\NHMCore.csproj", "{43DCAF38-D0C4-4335-983D-650F78461EB2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NiceHashMinerLauncher", "src\NiceHashMinerLauncher\NiceHashMinerLauncher.csproj", "{674DECD6-9BC3-4BA7-B0AE-4C2EA7D74C51}"
@@ -80,7 +76,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CrowdinTranslationsConverte
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyInfoVersionManager", "src\Tools\AssemblyInfoVersionManager\AssemblyInfoVersionManager.csproj", "{A1481D50-D481-409C-BF07-C44F9AF1DD51}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MP.GMiner", "src\Miners\GMiner\MP.GMiner.csproj", "{72746BBD-6A91-4441-87AA-8EFE4B2DA7BB}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.GMiner", "src\Miners\GMiner\MP.GMiner.csproj", "{72746BBD-6A91-4441-87AA-8EFE4B2DA7BB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -98,14 +94,6 @@ Global
{279A5B29-3799-43FA-9734-E462E046BA81}.Release|Any CPU.Build.0 = Release|Any CPU
{279A5B29-3799-43FA-9734-E462E046BA81}.Release|x64.ActiveCfg = Release|Any CPU
{279A5B29-3799-43FA-9734-E462E046BA81}.Release|x64.Build.0 = Release|Any CPU
- {A4B0CDCB-D1D7-4563-9888-D58E0B36D0F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A4B0CDCB-D1D7-4563-9888-D58E0B36D0F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A4B0CDCB-D1D7-4563-9888-D58E0B36D0F8}.Debug|x64.ActiveCfg = Debug|Any CPU
- {A4B0CDCB-D1D7-4563-9888-D58E0B36D0F8}.Debug|x64.Build.0 = Debug|Any CPU
- {A4B0CDCB-D1D7-4563-9888-D58E0B36D0F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A4B0CDCB-D1D7-4563-9888-D58E0B36D0F8}.Release|Any CPU.Build.0 = Release|Any CPU
- {A4B0CDCB-D1D7-4563-9888-D58E0B36D0F8}.Release|x64.ActiveCfg = Release|Any CPU
- {A4B0CDCB-D1D7-4563-9888-D58E0B36D0F8}.Release|x64.Build.0 = Release|Any CPU
{69B58028-8F30-4D3F-8E51-DEF85C08E4CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69B58028-8F30-4D3F-8E51-DEF85C08E4CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69B58028-8F30-4D3F-8E51-DEF85C08E4CC}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -178,14 +166,6 @@ Global
{56653651-3BF1-4A89-A20C-3178C06A29A3}.Release|Any CPU.Build.0 = Release|Any CPU
{56653651-3BF1-4A89-A20C-3178C06A29A3}.Release|x64.ActiveCfg = Release|Any CPU
{56653651-3BF1-4A89-A20C-3178C06A29A3}.Release|x64.Build.0 = Release|Any CPU
- {850CBE9E-AB73-4C24-AFBD-2FA4911E07B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {850CBE9E-AB73-4C24-AFBD-2FA4911E07B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {850CBE9E-AB73-4C24-AFBD-2FA4911E07B5}.Debug|x64.ActiveCfg = Debug|Any CPU
- {850CBE9E-AB73-4C24-AFBD-2FA4911E07B5}.Debug|x64.Build.0 = Debug|Any CPU
- {850CBE9E-AB73-4C24-AFBD-2FA4911E07B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {850CBE9E-AB73-4C24-AFBD-2FA4911E07B5}.Release|Any CPU.Build.0 = Release|Any CPU
- {850CBE9E-AB73-4C24-AFBD-2FA4911E07B5}.Release|x64.ActiveCfg = Release|Any CPU
- {850CBE9E-AB73-4C24-AFBD-2FA4911E07B5}.Release|x64.Build.0 = Release|Any CPU
{43DCAF38-D0C4-4335-983D-650F78461EB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43DCAF38-D0C4-4335-983D-650F78461EB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43DCAF38-D0C4-4335-983D-650F78461EB2}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -367,12 +347,10 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
- {A4B0CDCB-D1D7-4563-9888-D58E0B36D0F8} = {F40126B4-5B3B-4085-B47D-A5EF4B51570C}
{69B58028-8F30-4D3F-8E51-DEF85C08E4CC} = {BB931C9A-EE48-42A6-B5F3-3A193B1A051A}
{663285C0-8F68-4638-BEB2-4BB042868445} = {BB931C9A-EE48-42A6-B5F3-3A193B1A051A}
{1B657592-641E-42EC-BC44-ABCAE62EF1FD} = {F40126B4-5B3B-4085-B47D-A5EF4B51570C}
{3712894A-0836-4CE3-A4A9-C21A32AACBEC} = {BB931C9A-EE48-42A6-B5F3-3A193B1A051A}
- {850CBE9E-AB73-4C24-AFBD-2FA4911E07B5} = {F40126B4-5B3B-4085-B47D-A5EF4B51570C}
{ED4101C4-C44E-4C6C-8F93-73A950388823} = {BB931C9A-EE48-42A6-B5F3-3A193B1A051A}
{FBB69B33-8A14-4087-909C-F33791384D35} = {F40126B4-5B3B-4085-B47D-A5EF4B51570C}
{E9A55CE7-37B9-462F-92E8-AE929C5ADCCA} = {F40126B4-5B3B-4085-B47D-A5EF4B51570C}
diff --git a/doc/UserPlugins/09.png b/doc/UserPlugins/09.png
new file mode 100644
index 000000000..f7be1b0a0
Binary files /dev/null and b/doc/UserPlugins/09.png differ
diff --git a/doc/UserPlugins/10.png b/doc/UserPlugins/10.png
new file mode 100644
index 000000000..38abe3081
Binary files /dev/null and b/doc/UserPlugins/10.png differ
diff --git a/doc/UserPlugins/README.md b/doc/UserPlugins/README.md
index dd84d9545..94fa4fd07 100644
--- a/doc/UserPlugins/README.md
+++ b/doc/UserPlugins/README.md
@@ -7,21 +7,21 @@ NiceHash Miner from version 3.0.7.0 supports generic plugins for experimental pu
## #1 Generating generic plugin files
-### 1 First, navigate to the **NiceHash Miner root directory > internals > UserMinerPlugins.json**
+### 1. First, navigate to the **NiceHash Miner root directory > internals > UserMinerPlugins.json**
-### 2 Add a plugin name here, we will use **ExamplePlugin**.
+### 2. Add a plugin name here, we will use **ExamplePlugin**.
-### 3 Start NiceHash Miner for the files to be created automatically. Close NiceHash Miner after it initializes.
+### 3. Start NiceHash Miner for the files to be created automatically. Close NiceHash Miner after it initializes.
-### 4 New files will be generated in the **..\miner_plugins\ExamplePlugin** directory.
+### 4. New files will be generated in the **..\miner_plugins\ExamplePlugin** directory.
## #2 Moving the miner files to plugin bins directory
-### 1 Download the preferred miner from the official source.
+### 1. Download the preferred miner from the official source.
-### 2 Create a new folder named **bins** in the **NiceHash Miner\miner_plugins\ExamplePlugin** directory and move the miner file (all files included in the miner folder, not just the executable) to the **bins** directory.
+### 2. Create a new folder named **bins** in the **NiceHash Miner\miner_plugins\ExamplePlugin** directory and move the miner file (all files included in the miner folder, not just the executable) to the **bins** directory.
@@ -29,20 +29,33 @@ NiceHash Miner from version 3.0.7.0 supports generic plugins for experimental pu
## #3 Editing the plugin settings
-### 1 Open **NiceHash Miner\miner_plugins\ExamplePlugin\Devices.json** and mark each compatible device as compatible with the plugin by changing **`"compatible": false`** to **`"compatible": true`**.

If the miner uses custom device IDs (has different GPU detection technique), make sure to manually change the device ID ("miner_device_id") also.
+### 1. Open **NiceHash Miner\miner_plugins\ExamplePlugin\Devices.json** and mark each compatible device as compatible with the plugin by changing **`"compatible": false`** to **`"compatible": true`**.

If the miner uses custom device IDs (has different GPU detection technique), make sure to manually change the device ID ("miner_device_id") also.
-### 2 Open NiceHash Miner\miner_plugins\ExamplePlugin\MinerSettings.json and change the algorithm_command_line to a compatible command for the selected miner.
You can use all the placeholders from the top default_command_line. Example of a algorithm_command_line: `-a {ALGORITHM} -o nicehash+tcp://{POOL_URL}:{POOL_PORT} -u {USERNAME} -api 127.0.0.1:{API_PORT} -log -d {DEVICES} {EXTRA_LAUNCH_PARAMETERS}`
Optionally, change the "device_seperator" for the miner.
+### 2. Open NiceHash Miner\miner_plugins\ExamplePlugin\MinerSettings.json and change the algorithm_command_line to a compatible command for the selected miner.
You can use all the placeholders from the top default_command_line. Example of a algorithm_command_line: `-a {ALGORITHM} -o nicehash+tcp://{POOL_URL}:{POOL_PORT} -u {USERNAME} -api 127.0.0.1:{API_PORT} -log -d {DEVICES} {EXTRA_LAUNCH_PARAMETERS}`
Optionally, change the "device_seperator" for the miner.
-### 3 Navigate to ExamplePlugin\Internals and open MinersBinsUrlsSettings.json
+### 3. Navigate to ExamplePlugin\Internals and open MinersBinsUrlsSettings.json
Change the `"bin_path"` to the miner executable name. Do not use any specific path, NHM will automatically look for the miner in NiceHash Miner\miner_plugins\ExamplePlugin\bins.
+### 4. Navigate to NiceHash Miner\configs\AcceptedPlugins.json
+
+Add the name of the plugin you added in the `"UserMinerPlugins.json"` to the last line.
+
+
+
+### 5. Navigate to NiceHash Miner\miner_plugins\ExamplePlugin\PluginSupportedAlgorithmsSettings.json
+
+Add the target algorithms to target device groups, default is DaggerHashimoto and RandomXmonero (for example we configured to add DaggerHashimoto algo in the MinersSettings.json earlier):
+
+
+
+
# Additional information
Navigate to `NiceHash Miner\miner_plugins\ExamplePlugin\internals` and check the included files. There are other customizations possible through these files. Including adding extra launch parameters and supported algorithms. All of the settings are self-explanatory to advanced users.
diff --git a/pre_compiled_libs/device_detection_x64/device_detection.exe b/pre_compiled_libs/device_detection_x64/device_detection.exe
index 6e84cf7a6..7e4430543 100644
Binary files a/pre_compiled_libs/device_detection_x64/device_detection.exe and b/pre_compiled_libs/device_detection_x64/device_detection.exe differ
diff --git a/pre_compiled_libs/device_detection_x64/device_detection_igcl.dll b/pre_compiled_libs/device_detection_x64/device_detection_igcl.dll
new file mode 100644
index 000000000..873ce624e
Binary files /dev/null and b/pre_compiled_libs/device_detection_x64/device_detection_igcl.dll differ
diff --git a/pre_compiled_libs/device_detection_x64/device_detection_opencl_adl.dll b/pre_compiled_libs/device_detection_x64/device_detection_opencl_adl.dll
index b3cd7e1a9..c676ffb13 100644
Binary files a/pre_compiled_libs/device_detection_x64/device_detection_opencl_adl.dll and b/pre_compiled_libs/device_detection_x64/device_detection_opencl_adl.dll differ
diff --git a/pre_compiled_libs/device_monitoring_x64/device_monitoring_amd.dll b/pre_compiled_libs/device_monitoring_x64/device_monitoring_amd.dll
index f373c32a7..d948aa238 100644
Binary files a/pre_compiled_libs/device_monitoring_x64/device_monitoring_amd.dll and b/pre_compiled_libs/device_monitoring_x64/device_monitoring_amd.dll differ
diff --git a/pre_compiled_libs/device_monitoring_x64/device_monitoring_intel.dll b/pre_compiled_libs/device_monitoring_x64/device_monitoring_intel.dll
new file mode 100644
index 000000000..99302a740
Binary files /dev/null and b/pre_compiled_libs/device_monitoring_x64/device_monitoring_intel.dll differ
diff --git a/pre_compiled_libs/device_monitoring_x64/device_monitoring_nvidia.dll b/pre_compiled_libs/device_monitoring_x64/device_monitoring_nvidia.dll
index 9edfe1881..733aa893c 100644
Binary files a/pre_compiled_libs/device_monitoring_x64/device_monitoring_nvidia.dll and b/pre_compiled_libs/device_monitoring_x64/device_monitoring_nvidia.dll differ
diff --git a/pre_compiled_libs/device_monitoring_x64/pid_controller.dll b/pre_compiled_libs/device_monitoring_x64/pid_controller.dll
new file mode 100644
index 000000000..e012d300a
Binary files /dev/null and b/pre_compiled_libs/device_monitoring_x64/pid_controller.dll differ
diff --git a/src/Miners/Excavator/CmdConfig.cs b/src/Miners/Excavator/CmdConfig.cs
index 4a4d3478b..47a59fa8f 100644
--- a/src/Miners/Excavator/CmdConfig.cs
+++ b/src/Miners/Excavator/CmdConfig.cs
@@ -46,9 +46,10 @@ public static string CreateTemplate(IEnumerable gpuUuids, string algorithmN
return CreateDefaultTemplateAndCreateCMD("__SUBSCRIBE_PARAM_LOCATION__", "__SUBSCRIBE_PARAM_USERNAME__", gpuUuids, algorithmName);
}
- public static string CommandFileTemplatePath(string pluginUUID)
+ public static string CommandFileTemplatePath(string pluginUUID, string binPath, string fileName)
{
- return Paths.MinerPluginsPath(pluginUUID, "internals", "CommandLineTemplate.json");
+ var path = Paths.MinerPluginsPath(pluginUUID, binPath, fileName);
+ return path;
}
private static List CreateInitialCommands(string subscribeLocation, string subscribeUsername, IEnumerable excavatorIds, string algorithmName)
@@ -58,9 +59,24 @@ private static List CreateInitialCommands(string subscribeLocation, str
new Command { Id = 1, Method = "subscribe", Params = new List{ subscribeLocation, subscribeUsername } },
new Command { Id = 2, Method = "algorithm.add", Params = new List{ algorithmName.ToLower() } },
};
+ return initialCommands;
+ }
+ private static List CreateExtraCommands(IEnumerable excavatorIds, string algorithmName, List mandatoryCMDS = null)
+ {
+ var initialCommands = new List();
if (algorithmName == "randomx")
{
initialCommands.AddRange(excavatorIds.Select((dev, index) => new Command { Id = index + 3, Method = "worker.add", Params = new List { algorithmName, dev.ToString(), "NTHREADS=0", "HIGHPRIORITY=0", "USELARGEPAGE=1", "USEMSR=1" } }));
+ if (mandatoryCMDS != null)
+ {
+ foreach (var c in initialCommands)
+ {
+ var crossRef = mandatoryCMDS.FirstOrDefault(m => m.Id == c.Id);
+ if (crossRef == null) continue;
+ c.Params = crossRef.Params;
+ }
+ }
+
}
else initialCommands.AddRange(excavatorIds.Select((dev, index) => new Command { Id = index + 3, Method = "worker.add", Params = new List { algorithmName.ToLower(), dev.ToString() } }));
return initialCommands;
@@ -78,6 +94,11 @@ private static string CreateDefaultTemplateAndCreateCMD(string subscribeLocation
Commands = CreateInitialCommands(subscribeLocation, subscribeUsername, excavatorIds, algorithmName),
},
new CommandList
+ {
+ Time = 1,
+ Commands = CreateExtraCommands(excavatorIds, algorithmName),
+ },
+ new CommandList
{
Event = "on_quit",
Commands = new List{ },
@@ -91,9 +112,10 @@ private static string CreateDefaultTemplateAndCreateCMD(string subscribeLocation
return null;
}
}
- private static string[] _invalidTemplateMethods = new string[] { "subscribe", "algorithm.add", "worker.add" };
+ private static string[] _invalidTemplateMethods = new string[] { "subscribe", "algorithm.add" };
private static string ParseTemplateFileAndCreateCMD(string templateFilePath, IEnumerable excavatorIds, string subscribeLocation, string subscribeUsername, string algorithmName)
{
+
if (!File.Exists(templateFilePath)) return null;
try
{
@@ -103,9 +125,26 @@ private static string ParseTemplateFileAndCreateCMD(string templateFilePath, IEn
.Select(cmd => (cmd, commands: cmd.Commands.ToList()))
.Where(p => p.commands.Any())
.ToArray();
+
+ var otherCmds = template
+ .Where(cmd => cmd.Commands.All(c => _invalidTemplateMethods.Contains(c.Method)))
+ .Select(cmd => (cmd, commands: cmd.Commands.ToList()))
+ .Where(p => p.commands.Any())
+ .ToArray();
+
foreach (var (cmd, commands) in validCmds)
{
cmd.Commands = commands;
+ foreach(var c in cmd.Commands)
+ {
+ if(c.Method == "worker.add")
+ {
+ if (c.Params.Count >= 2 && c.Params[0].ToLower() != "randomx")
+ {
+ c.Params = new List { algorithmName.ToLower(), c.Params[1] };
+ }
+ }
+ }
}
var commandListTemplate = new List
{
@@ -115,7 +154,10 @@ private static string ParseTemplateFileAndCreateCMD(string templateFilePath, IEn
Commands = CreateInitialCommands(subscribeLocation, subscribeUsername, excavatorIds, algorithmName),
},
};
- if (validCmds.Any()) commandListTemplate.AddRange(validCmds.Select(p => p.cmd));
+ if (validCmds.Any())
+ {
+ commandListTemplate.AddRange(validCmds.Select(p => p.cmd));
+ }
return JsonConvert.SerializeObject(commandListTemplate, Formatting.Indented, _jsonSettings);
}
catch (Exception e)
@@ -136,16 +178,16 @@ private static string CreateCommandWithTemplate(string subscribeLocation, string
return template;
}
private static string GetServiceLocation(string miningLocation)
- {
+ {
if (BuildOptions.BUILD_TAG == BuildTag.TESTNET) return $"nhmp-test.auto.nicehash.com:443";
if (BuildOptions.BUILD_TAG == BuildTag.TESTNETDEV) return $"nhmp-dev.auto.nicehash.com:443";
//BuildTag.PRODUCTION
return $"nhmp.auto.nicehash.com:443";
}
- public static string CmdJSONString(string pluginUUID, string _miningLocation, string username, string algorithmName, params int[] excavatorIds) {
+ public static string CmdJSONString(string pluginUUID, string _miningLocation, string username, string algorithmName, string fileName, string binPath, params int[] excavatorIds) {
var miningLocation = GetMiningLocation(_miningLocation);
- var templatePath = CommandFileTemplatePath(pluginUUID);
+ var templatePath = CommandFileTemplatePath(pluginUUID, binPath, fileName);
var miningServiceLocation = GetServiceLocation(miningLocation);
var command = CreateCommandWithTemplate(miningServiceLocation, username, excavatorIds, templatePath, algorithmName);
if (command == null) Logger.Error("Excavator.CmdConfig", "command is NULL");
diff --git a/src/Miners/Excavator/Excavator.cs b/src/Miners/Excavator/Excavator.cs
index 10d6aa47c..400b79958 100644
--- a/src/Miners/Excavator/Excavator.cs
+++ b/src/Miners/Excavator/Excavator.cs
@@ -31,6 +31,7 @@ public Excavator(string uuid, Dictionary mappedIDs) : base(uuid)
private HttpClient _httpClient;
private string _authToken = Guid.NewGuid().ToString();
new protected int _apiPort;
+ private readonly int SpeedAnomalySeconds = 50;
private ApiData LastApiData
{
@@ -154,7 +155,8 @@ protected override string MiningCreateCommandLine()
var (excavatorIds, ids) = GetUUIDsAndIDs(_miningPairs);
var (_, cwd) = GetBinAndCwdPaths();
var fileName = $"cmd_{string.Join("_", excavatorIds)}.json";
- var cmdStr = CmdConfig.CmdJSONString(_uuid, _miningLocation, _username, AlgorithmName(_algorithmType), excavatorIds.ToArray());
+ var binPath = GetBinAndCwdPaths();
+ var cmdStr = CmdConfig.CmdJSONString(_uuid, _miningLocation, _username, AlgorithmName(_algorithmType), fileName, binPath.cwdPath, excavatorIds.ToArray());
File.WriteAllText(Path.Combine(cwd, fileName), cmdStr);
var commandLine = $"-wp {_apiPort} -wa \"{_authToken}\" -c {fileName} -m -qx {_extraLaunchParameters}";
return commandLine;
@@ -183,16 +185,28 @@ private void _miningProcess_Exited(object sender, EventArgs e)
private static bool IsSpeedOk(ApiData ad)
{
- const double PER_GPU_ANOMALY = 200 * 1000 * 1000; // 200MH/s
- const double SUM_GPU_ANOMALY = 2 * 1000 * 1000 * 1000; // 2GH/s
- if (ad == null) return false; // no speeds
- if (ad.AlgorithmSpeedsPerDevice == null) return false; // no speeds
- var speedsPerDevice = ad.AlgorithmSpeedsPerDevice.Values.Select(speeds => speeds.Select(pair => pair.speed).FirstOrDefault()).ToArray();
- var isPerGPUAnomaly = speedsPerDevice.Any(deviceSpeed => deviceSpeed >= PER_GPU_ANOMALY);
- var isPerGPUZeroSpeed = speedsPerDevice.Any(deviceSpeed => Math.Abs(deviceSpeed) < Double.Epsilon);
- var isSumGPUAnomaly = speedsPerDevice.Sum() >= SUM_GPU_ANOMALY;
- if (isPerGPUAnomaly || isPerGPUZeroSpeed || isSumGPUAnomaly) return false; // speeds anomally
+ //THIS METHOD WAS ONLY CAUSING PROBLEMS
+ //const double PER_GPU_ANOMALY = 200000000 * 2; // 400MH/s
+ //const double SUM_GPU_ANOMALY = 2000000000d * 2; // 4GH/s
+ //const double PER_GPU_ANOMALY_LARGE = PER_GPU_ANOMALY * 10 * 2;
+ //const double SUM_GPU_ANOMALY_LARGE = SUM_GPU_ANOMALY * 10 * 2;
+ //if (ad == null) return false; // no speeds
+ //if (ad.AlgorithmSpeedsPerDevice == null) return false; // no speeds
+ ////var speedsPerDevice = ad.AlgorithmSpeedsPerDevice.Values.Select(speeds => speeds.Select(pair => pair.speed).FirstOrDefault()).ToArray();
+ //var speedsPerDevice = ad.AlgorithmSpeedsPerDevice.Values.SelectMany(i => i).ToArray();
+
+ ////var isPerGPUAnomaly = speedsPerDevice.Any(deviceSpeed => deviceSpeed >= PER_GPU_ANOMALY);
+ //var isPerGPUAnomaly = speedsPerDevice.Any(deviceSpeed => deviceSpeed.type == AlgorithmType.KHeavyHash ? deviceSpeed.speed >= PER_GPU_ANOMALY_LARGE : deviceSpeed.speed >= PER_GPU_ANOMALY);
+ ////var isPerGPUZeroSpeed = speedsPerDevice.Any(deviceSpeed => Math.Abs(deviceSpeed) < Double.Epsilon);
+ //var isPerGPUZeroSpeed = speedsPerDevice.Any(deviceSpeed => Math.Abs(deviceSpeed.speed) < Double.Epsilon);
+ ////var isSumGPUAnomaly = speedsPerDevice.Sum() >= SUM_GPU_ANOMALY;
+ //var sumGPUAnomalyNormal = speedsPerDevice.Where(s => s.type != AlgorithmType.KHeavyHash)?.Select(s => s.speed)?.Sum();
+ //var sumGPUAnomalyLarge = speedsPerDevice.Where(s => s.type == AlgorithmType.KHeavyHash)?.Select(s => s.speed)?.Sum();
+ //if (sumGPUAnomalyNormal is double sn && sn >= SUM_GPU_ANOMALY) return false;
+ //if (sumGPUAnomalyLarge is double sl && sl >= SUM_GPU_ANOMALY_LARGE) return false;
+ ////if (isPerGPUAnomaly || isPerGPUZeroSpeed || isSumGPUAnomaly) return false; // speeds anomally
+ //if (isPerGPUAnomaly || isPerGPUZeroSpeed) return false; // speeds anomally
return true;
}
@@ -215,7 +229,7 @@ private async Task MinerSpeedsLoop(CancellationTokenSource ct)
while (isActive())
{
var elapsed = DateTime.UtcNow - lastSuccessfulSpeeds;
- if (elapsed >= TimeSpan.FromSeconds(50))
+ if (elapsed >= TimeSpan.FromSeconds(SpeedAnomalySeconds))
{
Logger.Info("EXCAVATOR-MinerSpeedsLoop", $"Restaring excavator due to speed anomaly");
//_ = await ExecuteCommand(@"{""id"":1,""method"":""quit"",""params"":[]}");
diff --git a/src/Miners/Excavator/ExcavatorPlugin.PluginSupportedAlgorithms.cs b/src/Miners/Excavator/ExcavatorPlugin.PluginSupportedAlgorithms.cs
index 0aec4d54b..1decb038a 100644
--- a/src/Miners/Excavator/ExcavatorPlugin.PluginSupportedAlgorithms.cs
+++ b/src/Miners/Excavator/ExcavatorPlugin.PluginSupportedAlgorithms.cs
@@ -16,22 +16,28 @@ public partial class ExcavatorPlugin
DeviceType.NVIDIA,
new List
{
- new SAS(AlgorithmType.DaggerHashimoto),
- new SAS(AlgorithmType.EtcHash),
- new SAS(AlgorithmType.Autolykos) { Enabled = false },
- new SAS(AlgorithmType.KAWPOW) { Enabled = false },
- new SAS(AlgorithmType.NeoScrypt),
+ new SAS(AlgorithmType.DaggerHashimoto) { Enabled = true},
+ new SAS(AlgorithmType.EtcHash) { Enabled = true},
+ new SAS(AlgorithmType.Autolykos) { Enabled = true},
+ new SAS(AlgorithmType.KAWPOW) { Enabled = true, NonDefaultRAMLimit = (4UL << 30) },
+ new SAS(AlgorithmType.NeoScrypt) { Enabled = true},
+ new SAS(AlgorithmType.ZelHash) { Enabled = true},
+ new SAS(AlgorithmType.FishHash) { Enabled = true},
+ new SAS(AlgorithmType.XelisHashV2) { Enabled = true}
}
},
{
DeviceType.AMD,
new List
{
- new SAS(AlgorithmType.DaggerHashimoto),
- new SAS(AlgorithmType.EtcHash),
- new SAS(AlgorithmType.Autolykos) { Enabled = false },
- new SAS(AlgorithmType.KAWPOW) { Enabled = false },
- new SAS(AlgorithmType.NeoScrypt),
+ new SAS(AlgorithmType.DaggerHashimoto) { Enabled = true },
+ new SAS(AlgorithmType.EtcHash) { Enabled = true },
+ new SAS(AlgorithmType.Autolykos) { Enabled = true },
+ new SAS(AlgorithmType.KAWPOW) { Enabled = true, NonDefaultRAMLimit = (4UL << 30) },
+ new SAS(AlgorithmType.NeoScrypt) { Enabled = true },
+ new SAS(AlgorithmType.ZelHash) { Enabled = true },
+ new SAS(AlgorithmType.FishHash) { Enabled = true },
+ new SAS(AlgorithmType.XelisHashV2) { Enabled = true }
}
},
{
@@ -49,7 +55,10 @@ public partial class ExcavatorPlugin
{ AlgorithmType.Autolykos, "autolykos" },
{ AlgorithmType.KAWPOW, "kawpow" },
{ AlgorithmType.NeoScrypt, "neoscrypt" },
- { AlgorithmType.RandomXmonero, "randomx" }
+ { AlgorithmType.RandomXmonero, "randomx" },
+ { AlgorithmType.ZelHash, "zelhash" },
+ { AlgorithmType.FishHash, "fishhash" },
+ { AlgorithmType.XelisHashV2, "xelishash" }
}
};
}
diff --git a/src/Miners/Excavator/ExcavatorPlugin.cs b/src/Miners/Excavator/ExcavatorPlugin.cs
index 3e68527f4..75abc2cb1 100644
--- a/src/Miners/Excavator/ExcavatorPlugin.cs
+++ b/src/Miners/Excavator/ExcavatorPlugin.cs
@@ -10,10 +10,6 @@
using System.Linq;
using NHM.MinerPluginToolkitV1.Interfaces;
using System.Threading.Tasks;
-using System.Net.Http;
-using System.Threading;
-using Newtonsoft.Json;
-using System.Diagnostics;
namespace Excavator
{
@@ -31,11 +27,11 @@ public ExcavatorPlugin()
MinersBinsUrlsSettings = new MinersBinsUrlsSettings
{
- BinVersion = "v1.8.3.0",
- ExePath = new List { "NHQM_v0.6.3.0_RC", "excavator.exe" },
+ BinVersion = "v1.9.1.0",
+ ExePath = new List { "NHQM_v0.6.13.0", "excavator.exe" },
Urls = new List
{
- "https://github.com/nicehash/NiceHashQuickMiner/releases/download/v0.6.3.0_RC/NHQM_v0.6.3.0_RC.zip"
+ "https://github.com/nicehash/NiceHashQuickMiner/releases/download/v0.6.13.0/NHQM_v0.6.13.0.zip"
}
};
PluginMetaInfo = new PluginMetaInfo
@@ -45,7 +41,7 @@ public ExcavatorPlugin()
};
}
- public override Version Version => new Version(19, 4);
+ public override Version Version => new Version(25, 1);
public override string PluginUUID => "27315fe0-3b03-11eb-b105-8d43d5bd63be";
public override string Name => "Excavator";
@@ -75,7 +71,7 @@ public override Dictionary> GetSupportedAlg
return supported;
}
- private static Version NVIDIA_Min_Version = new Version(411, 0);
+ private static Version NVIDIA_Min_Version = new Version(527, 41);
private Dictionary> GetSupportedDevicesAndAlgorithms(IEnumerable devices)
{
bool isNVIDIADriverGreaterThanMinVersion() => CUDADevice.INSTALLED_NVIDIA_DRIVERS >= NVIDIA_Min_Version;
@@ -94,22 +90,22 @@ bool isSupportedGPU(BaseDevice gpu) =>
.ToDictionary(p => p.gpu, p => p.algos);
}
- private void CreateExcavatorCommandTemplate(IEnumerable uuids, string algorithmName)
- {
- try
- {
- var templatePath = CmdConfig.CommandFileTemplatePath(PluginUUID);
- var template = CmdConfig.CreateTemplate(uuids, algorithmName);
- if (!File.Exists(templatePath) && template != null)
- {
- File.WriteAllText(templatePath, template);
- }
- }
- catch (Exception e)
- {
- Logger.Error("ExcavatorPlugin", $"CreateExcavatorCommandTemplate {e}");
- }
- }
+ //private void CreateExcavatorCommandTemplate(IEnumerable uuids, string algorithmName, string filename)
+ //{
+ // try
+ // {
+ // var templatePath = CmdConfig.CommandFileTemplatePath(PluginUUID, filename);
+ // var template = CmdConfig.CreateTemplate(uuids, algorithmName);
+ // if (!File.Exists(templatePath) && template != null)
+ // {
+ // File.WriteAllText(templatePath, template);
+ // }
+ // }
+ // catch (Exception e)
+ // {
+ // Logger.Error("ExcavatorPlugin", $"CreateExcavatorCommandTemplate {e}");
+ // }
+ //}
protected override MinerBase CreateMinerBase()
{
@@ -143,6 +139,7 @@ void deleteDirectoryInfo(DirectoryInfo dirInfo)
foreach (var file in dirInfo.GetFiles())
{
try {
+ if (file.Name.Contains("cmd_")) continue;
if (!filesToLeave.Any(leaveFile => file.Name.Contains(leaveFile))) file.Delete();
}
catch (Exception e)
@@ -191,12 +188,12 @@ public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Versi
public (DriverVersionCheckType ret, Version minRequired) IsDriverMinimumRecommended(BaseDevice device)
{
- return DriverVersionChecker.CompareCUDADriverVersions(device, CUDADevice.INSTALLED_NVIDIA_DRIVERS, new Version(461, 33));
+ return DriverVersionChecker.CompareCUDADriverVersions(device, CUDADevice.INSTALLED_NVIDIA_DRIVERS, new Version(527, 41));
}
public (DriverVersionCheckType ret, Version minRequired) IsDriverMinimumRequired(BaseDevice device)
{
- return DriverVersionChecker.CompareCUDADriverVersions(device, CUDADevice.INSTALLED_NVIDIA_DRIVERS, new Version(411, 31));
+ return DriverVersionChecker.CompareCUDADriverVersions(device, CUDADevice.INSTALLED_NVIDIA_DRIVERS, new Version(527, 41));
}
public async Task DevicesCrossReference(IEnumerable devices)
diff --git a/src/Miners/GMiner/GMinerPlugin.PluginSupportedAlgorithms.cs b/src/Miners/GMiner/GMinerPlugin.PluginSupportedAlgorithms.cs
index 8358897ea..128568c1a 100644
--- a/src/Miners/GMiner/GMinerPlugin.PluginSupportedAlgorithms.cs
+++ b/src/Miners/GMiner/GMinerPlugin.PluginSupportedAlgorithms.cs
@@ -11,7 +11,6 @@ namespace MP.GMiner
{
public partial class GMinerPlugin
{
- const ulong KAWPOW_RamLimit = (2UL << 30) + (2UL << 29) + (2UL << 28);
protected override PluginSupportedAlgorithmsSettings DefaultPluginSupportedAlgorithmsSettings => new PluginSupportedAlgorithmsSettings
{
// TODO fees are not just 2%
@@ -27,30 +26,28 @@ public partial class GMinerPlugin
DeviceType.NVIDIA,
new List
{
- new SAS(AlgorithmType.DaggerHashimoto),
- new SAS(AlgorithmType.EtcHash) {NonDefaultRAMLimit = (4UL << 29) + (5UL << 28) + (1UL << 26) },
- new SAS(AlgorithmType.KAWPOW) { NonDefaultRAMLimit = KAWPOW_RamLimit },
+ new SAS(AlgorithmType.DaggerHashimoto){Enabled = false},
+ new SAS(AlgorithmType.EtcHash) {NonDefaultRAMLimit = (4UL << 29) + (5UL << 28) + (1UL << 26), Enabled = false },
+ new SAS(AlgorithmType.KAWPOW) { NonDefaultRAMLimit = (4UL << 30) },
new SAS(AlgorithmType.Autolykos),
- new SAS(AlgorithmType.KHeavyHash) { NonDefaultRAMLimit = (2UL << 29) },
- new SAS(AlgorithmType.CuckooCycle),
- new SAS(AlgorithmType.ZelHash),
- new SAS(AlgorithmType.GrinCuckatoo32),
- new SAS(AlgorithmType.ZHash)
+ new SAS(AlgorithmType.CuckooCycle){Enabled = false},
+ new SAS(AlgorithmType.ZelHash){Enabled = false},
+ new SAS(AlgorithmType.ZHash){Enabled = false},
+ new SAS(AlgorithmType.Octopus) {NonDefaultRAMLimit = (5UL << 30) + (4UL << 29)},
}
},
{
DeviceType.AMD,
new List
{
- new SAS(AlgorithmType.DaggerHashimoto),
- new SAS(AlgorithmType.EtcHash) {NonDefaultRAMLimit = (4UL << 29) + (5UL << 28) + (1UL << 26) },
- new SAS(AlgorithmType.KAWPOW) { NonDefaultRAMLimit = KAWPOW_RamLimit },
- //new SAS(AlgorithmType.Autolykos),
- //new SAS(AlgorithmType.KHeavyHash),
- new SAS(AlgorithmType.CuckooCycle),
- new SAS(AlgorithmType.ZelHash),
- new SAS(AlgorithmType.GrinCuckatoo32),
- new SAS(AlgorithmType.ZHash)
+ new SAS(AlgorithmType.DaggerHashimoto){Enabled = false},
+ new SAS(AlgorithmType.EtcHash) {NonDefaultRAMLimit = (4UL << 29) + (5UL << 28) + (1UL << 26), Enabled = false },
+ new SAS(AlgorithmType.KAWPOW) { NonDefaultRAMLimit = (4UL << 30) },
+ new SAS(AlgorithmType.Autolykos),
+ new SAS(AlgorithmType.CuckooCycle){Enabled = false},
+ new SAS(AlgorithmType.ZelHash){Enabled = false},
+ new SAS(AlgorithmType.ZHash){Enabled = false},
+ new SAS(AlgorithmType.Octopus) {NonDefaultRAMLimit = (5UL << 30) + (4UL << 29)},
}
}
}
diff --git a/src/Miners/GMiner/GMinerPlugin.cs b/src/Miners/GMiner/GMinerPlugin.cs
index 1b91f3bba..8f80b913c 100644
--- a/src/Miners/GMiner/GMinerPlugin.cs
+++ b/src/Miners/GMiner/GMinerPlugin.cs
@@ -27,11 +27,11 @@ public GMinerPlugin()
MinerBenchmarkTimeSettings = PluginInternalSettings.BenchmarkTimeSettings;
MinersBinsUrlsSettings = new MinersBinsUrlsSettings
{
- BinVersion = "v3.12",
+ BinVersion = "v3.44",
ExePath = new List { "", "miner.exe" },
Urls = new List
{
- "https://github.com/develsoftware/GMinerRelease/releases/download/3.12/gminer_3_12_windows64.zip" // original
+ "https://github.com/develsoftware/GMinerRelease/releases/download/3.44/gminer_3_44_windows64.zip" // original
}
};
PluginMetaInfo = new PluginMetaInfo
@@ -45,7 +45,7 @@ public GMinerPlugin()
public override string Name => "GMiner";
- public override Version Version => new Version(19, 1);
+ public override Version Version => new Version(24, 0);
public override string Author => "info@nicehash.com";
@@ -82,7 +82,6 @@ public override Dictionary> GetSupportedAlg
{
_mappedIDs[gpu.UUID] = minerDeviceId;
var algorithms = GetSupportedAlgorithmsForDevice(gpu);
- if (gpu is CUDADevice cuda && cuda.SM_major >= 8) algorithms = algorithms.Where(a => a.FirstAlgorithmType != AlgorithmType.GrinCuckatoo32).ToList();
if (algorithms.Count > 0) supported.Add(gpu, algorithms);
}
@@ -111,7 +110,7 @@ public async Task DevicesCrossReference(IEnumerable devices)
{
if (_mappedIDs.Count == 0) return;
var (minerBinPath, minerCwdPath) = GetBinAndCwdPaths();
- var output = await DevicesCrossReferenceHelpers.MinerOutput(minerBinPath, "--list_devices --watchdog 0"); // AMD + NVIDIA
+ var output = await DevicesCrossReferenceHelpers.MinerOutput(minerBinPath, "--list_devices"); // AMD + NVIDIA
var dumpFile = $"d{DateTime.UtcNow.Ticks}.txt";
try
{
diff --git a/src/Miners/GMiner/PluginInternalSettings.cs b/src/Miners/GMiner/PluginInternalSettings.cs
index cd514cb9a..533fc5db8 100644
--- a/src/Miners/GMiner/PluginInternalSettings.cs
+++ b/src/Miners/GMiner/PluginInternalSettings.cs
@@ -35,11 +35,7 @@ internal static class PluginInternalSettings
},
{
$"{AlgorithmType.Autolykos}",
- $"-a ergo -s stratum+tcp://{_urlPort} -u {_username} --api 127.0.0.1:{_apiPort} -d {_devices} --watchdog 0 {_extraLaunchParameters}"
- },
- {
- $"{AlgorithmType.KHeavyHash}",
- $"-a kheavyhash -s stratum+tcp://{_urlPort} -u {_username} --api 127.0.0.1:{_apiPort} -d {_devices} --watchdog 0 {_extraLaunchParameters}"
+ $"-a autolykos2 -s stratum+tcp://{_urlPort} -u {_username} --api 127.0.0.1:{_apiPort} -d {_devices} --watchdog 0 {_extraLaunchParameters}"
},
{
$"{AlgorithmType.BeamV3}",
@@ -53,14 +49,14 @@ internal static class PluginInternalSettings
$"{AlgorithmType.ZelHash}",
$"-a equihash125_4 -s stratum+tcp://{_urlPort} -u {_username} --api 127.0.0.1:{_apiPort} -d {_devices} --watchdog 0 {_extraLaunchParameters}"
},
- {
- $"{AlgorithmType.GrinCuckatoo32}",
- $"-a cuckatoo32 -s stratum+tcp://{_urlPort} -u {_username} --api 127.0.0.1:{_apiPort} -d {_devices} --watchdog 0 {_extraLaunchParameters}"
- },
{
$"{AlgorithmType.ZHash}",
$"-a equihash144_5 --pers auto -s stratum+tcp://{_urlPort} -u {_username} --api 127.0.0.1:{_apiPort} -d {_devices} --watchdog 0 {_extraLaunchParameters}"
- }
+ },
+ {
+ $"{AlgorithmType.Octopus}",
+ $"-a octopus -s stratum+tcp://{_urlPort} -u {_username} --api 127.0.0.1:{_apiPort} -d {_devices} --watchdog 0 {_extraLaunchParameters}"
+ },
},
AlgorithmCommandLineSSL = new Dictionary
{
@@ -78,11 +74,7 @@ internal static class PluginInternalSettings
},
{
$"{AlgorithmType.Autolykos}",
- $"-a ergo -s stratum+ssl://{_url}:443 -u {_username} --api 127.0.0.1:{_apiPort} -d {_devices} --watchdog 0 {_extraLaunchParameters}"
- },
- {
- $"{AlgorithmType.KHeavyHash}",
- $"-a kheavyhash -s stratum+ssl://{_url}:443 -u {_username} --api 127.0.0.1:{_apiPort} -d {_devices} --watchdog 0 {_extraLaunchParameters}"
+ $"-a autolykos2 -s stratum+ssl://{_url}:443 -u {_username} --api 127.0.0.1:{_apiPort} -d {_devices} --watchdog 0 {_extraLaunchParameters}"
},
{
$"{AlgorithmType.BeamV3}",
@@ -96,15 +88,14 @@ internal static class PluginInternalSettings
$"{AlgorithmType.ZelHash}",
$"-a equihash125_4 -s stratum+ssl://{_url}:443 -u {_username} --api 127.0.0.1:{_apiPort} -d {_devices} --watchdog 0 {_extraLaunchParameters}"
},
- {
- $"{AlgorithmType.GrinCuckatoo32}",
- $"-a cuckatoo32 -s stratum+ssl://{_url}:443 -u {_username} --api 127.0.0.1:{_apiPort} -d {_devices} --watchdog 0 {_extraLaunchParameters}"
- },
{
$"{AlgorithmType.ZHash}",
$"-a equihash144_5 --pers auto -s stratum+ssl://{_url}:443 -u {_username} --api 127.0.0.1:{_apiPort} -d {_devices} --watchdog 0 {_extraLaunchParameters}"
- }
-
+ },
+ {
+ $"{AlgorithmType.Octopus}",
+ $"-a octopus -s stratum+ssl://{_url}:443 -u {_username} --api 127.0.0.1:{_apiPort} -d {_devices} --watchdog 0 {_extraLaunchParameters}"
+ },
}
};
diff --git a/src/Miners/LolMiner/LolMinerPlugin.PluginSupportedAlgorithms.cs b/src/Miners/LolMiner/LolMinerPlugin.PluginSupportedAlgorithms.cs
index da0cbcd2c..a5716f3b5 100644
--- a/src/Miners/LolMiner/LolMinerPlugin.PluginSupportedAlgorithms.cs
+++ b/src/Miners/LolMiner/LolMinerPlugin.PluginSupportedAlgorithms.cs
@@ -11,29 +11,6 @@ public partial class LolMinerPlugin
const ulong AMD_6GBMemory = 5UL << 30; // 5GB but really 6GB
const ulong AMD_3GBMemory = 3UL << 30; // 3GB but really 4GB
// NVIDIA OpenCL backend is not really that stable
- internal static List SupportedNVIDIAOpenCLAlgos(bool enabled = false)
- {
- return new List
- {
- new SAS(AlgorithmType.GrinCuckatoo31) {Enabled = enabled }
- };
- }
- internal static List SupportedAMDAlgos()
- {
- return new List
- {
- new SAS(AlgorithmType.GrinCuckatoo31) { NonDefaultRAMLimit = AMD_8GBMemory},
- new SAS(AlgorithmType.GrinCuckatoo32),
- new SAS(AlgorithmType.CuckooCycle),
- new SAS(AlgorithmType.ZHash),
- new SAS(AlgorithmType.BeamV3) { NonDefaultRAMLimit = AMD_3GBMemory },
- new SAS(AlgorithmType.DaggerHashimoto) { Enabled = false },
- new SAS(AlgorithmType.EtcHash) {NonDefaultRAMLimit = (4UL << 29) + (5UL << 28) + (1UL << 26), Enabled = false },
- new SAS(AlgorithmType.ZelHash),
- new SAS(AlgorithmType.KHeavyHash),
- new SAS(AlgorithmType.Autolykos) { Enabled = false },
- };
- }
protected override PluginSupportedAlgorithmsSettings DefaultPluginSupportedAlgorithmsSettings => new PluginSupportedAlgorithmsSettings
{
// fixed fee
@@ -54,22 +31,43 @@ internal static List SupportedAMDAlgos()
DeviceType.NVIDIA,
new List
{
- new SAS(AlgorithmType.GrinCuckatoo31),
- new SAS(AlgorithmType.GrinCuckatoo32),
new SAS(AlgorithmType.CuckooCycle),
new SAS(AlgorithmType.ZHash),
new SAS(AlgorithmType.BeamV3),
new SAS(AlgorithmType.DaggerHashimoto) { Enabled = false },
new SAS(AlgorithmType.EtcHash){NonDefaultRAMLimit = (4UL << 29) + (5UL << 28) + (1UL << 26), Enabled = false },
new SAS(AlgorithmType.ZelHash),
- new SAS(AlgorithmType.KHeavyHash),
new SAS(AlgorithmType.Autolykos) { Enabled = false },
-
+ new SAS(AlgorithmType.NexaPow),
+ new SAS(AlgorithmType.FishHash) { Enabled = true },
+ new SAS(AlgorithmType.Octopus) { Enabled = false },
}
},
{
DeviceType.AMD,
- SupportedAMDAlgos()
+ new List
+ {
+ new SAS(AlgorithmType.CuckooCycle),
+ new SAS(AlgorithmType.ZHash),
+ new SAS(AlgorithmType.BeamV3) { NonDefaultRAMLimit = AMD_3GBMemory },
+ new SAS(AlgorithmType.DaggerHashimoto) { Enabled = false },
+ new SAS(AlgorithmType.EtcHash) {NonDefaultRAMLimit = (4UL << 29) + (5UL << 28) + (1UL << 26), Enabled = false },
+ new SAS(AlgorithmType.ZelHash),
+ new SAS(AlgorithmType.Autolykos) { Enabled = false },
+ new SAS(AlgorithmType.NexaPow),
+ new SAS(AlgorithmType.FishHash) { Enabled = true },
+ new SAS(AlgorithmType.Octopus) { Enabled = false },
+ }
+ },
+ {
+ DeviceType.INTEL,
+ new List
+ {
+ new SAS(AlgorithmType.BeamV3),
+ new SAS(AlgorithmType.Autolykos),
+ new SAS(AlgorithmType.ZelHash),
+ new SAS(AlgorithmType.ZHash)
+ }
}
}
};
diff --git a/src/Miners/LolMiner/LolMinerPlugin.cs b/src/Miners/LolMiner/LolMinerPlugin.cs
index b31c4c885..7c1c3df50 100644
--- a/src/Miners/LolMiner/LolMinerPlugin.cs
+++ b/src/Miners/LolMiner/LolMinerPlugin.cs
@@ -25,11 +25,11 @@ public LolMinerPlugin()
// https://github.com/Lolliedieb/lolMiner-releases/releases | https://bitcointalk.org/index.php?topic=4724735.0
MinersBinsUrlsSettings = new MinersBinsUrlsSettings
{
- BinVersion = "1.65",
- ExePath = new List { "1.65", "lolMiner.exe" },
+ BinVersion = "1.95a",
+ ExePath = new List { "1.95a", "lolMiner.exe" },
Urls = new List
{
- "https://github.com/Lolliedieb/lolMiner-releases/releases/download/1.65/lolMiner_v1.65_Win64.zip" // original
+ "https://github.com/Lolliedieb/lolMiner-releases/releases/download/1.95a/lolMiner_v1.95a_Win64.zip" // original
}
};
PluginMetaInfo = new PluginMetaInfo
@@ -39,7 +39,7 @@ public LolMinerPlugin()
};
}
- public override Version Version => new Version(19, 7);
+ public override Version Version => new Version(24, 5);
public override string Author => "info@nicehash.com";
@@ -62,7 +62,7 @@ public override Dictionary> GetSupportedAlg
}
var gpus = devices
- .Where(dev => IsSupportedAMDDevice(dev) || IsSupportedNVIDIADevice(dev, isDriverSupported))
+ .Where(dev => IsSupportedAMDDevice(dev) || IsSupportedNVIDIADevice(dev, isDriverSupported) || IsSupportedINTELDevice(dev))
.Where(dev => dev is IGpuDevice)
.Cast()
.OrderBy(gpu => gpu.PCIeBusID)
@@ -88,6 +88,12 @@ private static bool IsSupportedAMDDevice(BaseDevice dev)
return isSupported;
}
+ private static bool IsSupportedINTELDevice(BaseDevice dev)
+ {
+ var idSupported = dev is IntelDevice;
+ return idSupported;
+ }
+
private static bool IsSupportedNVIDIADevice(BaseDevice dev, bool isDriverSupported)
{
var isSupported = dev is CUDADevice gpu && gpu.SM_major >= 5;
diff --git a/src/Miners/LolMiner/PluginInternalSettings.cs b/src/Miners/LolMiner/PluginInternalSettings.cs
index ac88a0502..7ec6cc9b2 100644
--- a/src/Miners/LolMiner/PluginInternalSettings.cs
+++ b/src/Miners/LolMiner/PluginInternalSettings.cs
@@ -23,14 +23,6 @@ internal static class PluginInternalSettings
$"{AlgorithmType.ZHash}",
$"--coin AUTO144_5 --pool {_urlPort} --user {_username} --tls 0 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
},
- {
- $"{AlgorithmType.GrinCuckatoo31}",
- $"--algo C31 --pool {_urlPort} --user {_username} --tls 0 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
- },
- {
- $"{AlgorithmType.GrinCuckatoo32}",
- $"--algo C32 --pool {_urlPort} --user {_username} --tls 0 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
- },
{
$"{AlgorithmType.BeamV3}",
$"--algo BEAM-III --pool {_urlPort} --user {_username} --tls 0 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
@@ -51,15 +43,22 @@ internal static class PluginInternalSettings
$"{AlgorithmType.EtcHash}",
$"--algo ETCHASH --pool {_urlPort} --user {_username} --tls 0 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters} --ethstratum ETHV1"
},
- {
- $"{AlgorithmType.KHeavyHash}",
- $"--algo KASPA --pool {_urlPort} --user {_username} --tls 0 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
- },
{
$"{AlgorithmType.CuckooCycle}",
$"--algo C29AE --pool {_urlPort} --user {_username} --tls 0 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
},
-
+ {
+ $"{AlgorithmType.NexaPow}",
+ $"--algo NEXA --pool {_urlPort} --user {_username} --tls 0 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
+ },
+ {
+ $"{AlgorithmType.FishHash}",
+ $"--algo FISHHASH --pool {_urlPort} --user {_username} --tls 0 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
+ },
+ {
+ $"{AlgorithmType.Octopus}",
+ $"--algo OCTOPUS --pool {_urlPort} --user {_username} --tls 0 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
+ }
},
AlgorithmCommandLineSSL = new Dictionary
{
@@ -67,14 +66,6 @@ internal static class PluginInternalSettings
$"{AlgorithmType.ZHash}",
$"--coin AUTO144_5 --pool {_url}:443 --user {_username} --tls 1 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
},
- {
- $"{AlgorithmType.GrinCuckatoo31}",
- $"--algo C31 --pool {_url}:443 --user {_username} --tls 1 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
- },
- {
- $"{AlgorithmType.GrinCuckatoo32}",
- $"--algo C32 --pool {_url}:443 --user {_username} --tls 1 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
- },
{
$"{AlgorithmType.BeamV3}",
$"--algo BEAM-III --pool {_url}:443 --user {_username} --tls 1 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
@@ -95,14 +86,22 @@ internal static class PluginInternalSettings
$"{AlgorithmType.EtcHash}",
$"--algo ETCHASH --pool {_url}:443 --user {_username} --tls 1 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters} --ethstratum ETHV1"
},
- {
- $"{AlgorithmType.KHeavyHash}",
- $"--algo KASPA --pool {_url}:443 --user {_username} --tls 1 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
- },
{
$"{AlgorithmType.CuckooCycle}",
$"--algo C29AE --pool {_url}:443 --user {_username} --tls 1 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
},
+ {
+ $"{AlgorithmType.NexaPow}",
+ $"--algo NEXA --pool {_url}:443 --user {_username} --tls 1 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
+ },
+ {
+ $"{AlgorithmType.FishHash}",
+ $"--algo FISHHASH --pool {_url}:443 --user {_username} --tls 1 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
+ },
+ {
+ $"{AlgorithmType.Octopus}",
+ $"--algo OCTOPUS --pool {_url}:443 --user {_username} --tls 1 --apiport {_apiPort} --disablewatchdog 1 --devices {_devices} {_extraLaunchParameters}"
+ }
}
};
diff --git a/src/Miners/NBMiner/NBMinerPlugin.PluginSupportedAlgorithms.cs b/src/Miners/NBMiner/NBMinerPlugin.PluginSupportedAlgorithms.cs
index cf497fcf9..df6fba16c 100644
--- a/src/Miners/NBMiner/NBMinerPlugin.PluginSupportedAlgorithms.cs
+++ b/src/Miners/NBMiner/NBMinerPlugin.PluginSupportedAlgorithms.cs
@@ -7,7 +7,6 @@ namespace NBMiner
{
public partial class NBMinerPlugin
{
- const ulong KAWPOW_RamLimit = (2UL << 30) + (2UL << 29) + (2UL << 28);
protected override PluginSupportedAlgorithmsSettings DefaultPluginSupportedAlgorithmsSettings => new PluginSupportedAlgorithmsSettings
{
// TODO fees are not just 2%
@@ -25,10 +24,10 @@ public partial class NBMinerPlugin
new List
{
new SAS(AlgorithmType.DaggerHashimoto) { Enabled = false },
- new SAS(AlgorithmType.KAWPOW) { NonDefaultRAMLimit = KAWPOW_RamLimit },
+ new SAS(AlgorithmType.KAWPOW) { NonDefaultRAMLimit = (4UL << 30), Enabled = false },
new SAS(AlgorithmType.BeamV3) { Enabled = false },
- new SAS(AlgorithmType.Octopus) {NonDefaultRAMLimit = 5UL << 30},
- new SAS(AlgorithmType.Autolykos),
+ new SAS(AlgorithmType.Octopus) {NonDefaultRAMLimit = (5UL << 30) + (4UL << 29), Enabled = false},
+ new SAS(AlgorithmType.Autolykos) { Enabled = false },
new SAS(AlgorithmType.EtcHash) {NonDefaultRAMLimit = (4UL << 29) + (5UL << 28) + (1UL << 26) , Enabled = false },
new SAS(AlgorithmType.CuckooCycle) {Enabled = false},
@@ -38,11 +37,11 @@ public partial class NBMinerPlugin
DeviceType.AMD,
new List
{
- new SAS(AlgorithmType.KAWPOW) {NonDefaultRAMLimit = KAWPOW_RamLimit },
+ new SAS(AlgorithmType.KAWPOW) {NonDefaultRAMLimit = (4UL << 30), Enabled = false },
new SAS(AlgorithmType.DaggerHashimoto) { Enabled = false },
- new SAS(AlgorithmType.Autolykos),
+ new SAS(AlgorithmType.Autolykos) { Enabled = false },
new SAS(AlgorithmType.EtcHash) {NonDefaultRAMLimit = (4UL << 29) + (5UL << 28) + (1UL << 26) , Enabled = false },
- new SAS(AlgorithmType.Octopus) {NonDefaultRAMLimit = 5UL << 30},
+ new SAS(AlgorithmType.Octopus) {NonDefaultRAMLimit = (5UL << 30) + (4UL << 29), Enabled = false},
}
}
}
diff --git a/src/Miners/NBMiner/NBMinerPlugin.cs b/src/Miners/NBMiner/NBMinerPlugin.cs
index 316222956..4e3cf6fea 100644
--- a/src/Miners/NBMiner/NBMinerPlugin.cs
+++ b/src/Miners/NBMiner/NBMinerPlugin.cs
@@ -46,8 +46,8 @@ public NBMinerPlugin()
public override string Name => "NBMiner";
- public override Version Version => new Version(19, 4);
-
+ public override Version Version => new Version(23, 1);
+
public override string Author => "info@nicehash.com";
@@ -83,7 +83,6 @@ public override Dictionary> GetSupportedAlg
{
_mappedIDs[gpu.UUID] = minerDeviceId;
var algorithms = GetSupportedAlgorithmsForDevice(gpu);
- if (gpu is CUDADevice cuda && cuda.SM_major >= 8) algorithms = algorithms.Where(a => a.FirstAlgorithmType != AlgorithmType.GrinCuckatoo32).ToList();
if (algorithms.Count > 0) supported.Add(gpu, algorithms);
}
@@ -168,7 +167,7 @@ public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Versi
return DriverVersionChecker.CompareCUDADriverVersions(device, CUDADevice.INSTALLED_NVIDIA_DRIVERS, new Version(411, 31));
}
- public (DriverVersionCheckType ret, Version minRequired) IsDriverMinimumRecommended(BaseDevice device)
+ public (DriverVersionCheckType ret, Version minRequired) IsDriverMinimumRecommended(BaseDevice device)
{
return DriverVersionChecker.CompareAMDDriverVersions(device, new Version(21, 5, 2));
}
diff --git a/src/Miners/NanoMiner/NanoMinerPlugin.PluginSupportedAlgorithms.cs b/src/Miners/NanoMiner/NanoMinerPlugin.PluginSupportedAlgorithms.cs
index a47f6ee82..69ec67a00 100644
--- a/src/Miners/NanoMiner/NanoMinerPlugin.PluginSupportedAlgorithms.cs
+++ b/src/Miners/NanoMiner/NanoMinerPlugin.PluginSupportedAlgorithms.cs
@@ -16,7 +16,7 @@ public partial class NanoMinerPlugin
DeviceType.AMD,
new List
{
- new SAS(AlgorithmType.KAWPOW){NonDefaultRAMLimit = 4UL << 30, Enabled = false },
+ new SAS(AlgorithmType.KAWPOW){NonDefaultRAMLimit = (4UL << 30) , Enabled = false },
new SAS(AlgorithmType.DaggerHashimoto) { Enabled = false},
new SAS(AlgorithmType.Autolykos) { Enabled = false},
new SAS(AlgorithmType.EtcHash) {NonDefaultRAMLimit = (4UL << 29) + (5UL << 28) + (1UL << 26), Enabled = false }
@@ -26,8 +26,8 @@ public partial class NanoMinerPlugin
DeviceType.NVIDIA,
new List
{
- new SAS(AlgorithmType.KAWPOW){ NonDefaultRAMLimit = (2UL << 30) + (2UL << 29) + (2UL << 28), Enabled = false },
- new SAS(AlgorithmType.Octopus) { Enabled = false},
+ new SAS(AlgorithmType.KAWPOW){ NonDefaultRAMLimit = (4UL << 30) , Enabled = false },
+ new SAS(AlgorithmType.Octopus) { Enabled = false, NonDefaultRAMLimit = (5UL << 30) + (4UL << 29)},
new SAS(AlgorithmType.DaggerHashimoto) { Enabled = false},
new SAS(AlgorithmType.Autolykos) { Enabled = false},
new SAS(AlgorithmType.EtcHash) {NonDefaultRAMLimit = (4UL << 29) + (5UL << 28) + (1UL << 26), Enabled = false }
diff --git a/src/Miners/NanoMiner/NanoMinerPlugin.cs b/src/Miners/NanoMiner/NanoMinerPlugin.cs
index 37208ab5d..bc93b3b54 100644
--- a/src/Miners/NanoMiner/NanoMinerPlugin.cs
+++ b/src/Miners/NanoMiner/NanoMinerPlugin.cs
@@ -24,11 +24,11 @@ public NanoMinerPlugin()
// https://github.com/nanopool/nanominer/releases
MinersBinsUrlsSettings = new MinersBinsUrlsSettings
{
- BinVersion = "v3.7.5",
- ExePath = new List { "nanominer-windows-3.7.5-cuda11", "nanominer.exe" },
+ BinVersion = "v3.10.0",
+ ExePath = new List { "nanominer-windows-3.10.0", "nanominer.exe" },
Urls = new List
{
- "https://github.com/nanopool/nanominer/releases/download/v3.7.5/nanominer-windows-3.7.5-cuda11.zip", // original
+ "https://github.com/nanopool/nanominer/releases/download/v3.10.0/nanominer-windows-3.10.0.zip", // original
}
};
PluginMetaInfo = new PluginMetaInfo
@@ -43,7 +43,7 @@ public NanoMinerPlugin()
public override string Name => "NanoMiner";
- public override Version Version => new Version(19, 3);
+ public override Version Version => new Version(24, 1);
public override string Author => "info@nicehash.com";
@@ -77,7 +77,7 @@ public override Dictionary> GetSupportedAlg
.Select(gpu => (gpu, algorithms: GetSupportedAlgorithmsForDevice(gpu)))
.Where(p => p.algorithms.Any())
.ToDictionary(p => p.gpu, p => p.algorithms);
-
+
foreach (var cpu in cpus)
{
supported.Add(cpu, GetSupportedAlgorithmsForDevice(cpu));
diff --git a/src/Miners/XMRig/BenchmarkHelpers.cs b/src/Miners/XMRig/BenchmarkHelpers.cs
deleted file mode 100644
index dd5ef370d..000000000
--- a/src/Miners/XMRig/BenchmarkHelpers.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-
-namespace XMRig
-{
- public static class BenchmarkHelpers
- {
- public static Tuple TryGetHashrateAfter(this string s, string contains)
- {
- if (!s.Contains(contains))
- {
- return Tuple.Create(0d, false); ;
- }
- s = s.Substring(s.IndexOf(contains));
- var splittedString = s.Split(' ');
-
- var afterString = splittedString[2].ToLower();
- var numString = new string(afterString
- .ToCharArray()
- .SkipWhile(c => !char.IsDigit(c))
- .TakeWhile(c => char.IsDigit(c) || c == '.')
- .ToArray());
-
- if (!double.TryParse(numString, NumberStyles.Float, CultureInfo.InvariantCulture, out var hash))
- {
- return Tuple.Create(0d, false);
- }
-
- var postfixString = splittedString[5];
- for (var i = 0; i < postfixString.Length - 1; ++i)
- {
- var c = postfixString[i];
- if (!Char.IsLetter(c)) continue;
- var c2 = postfixString[i + 1];
-
- foreach (var kvp in _postfixes)
- {
- var postfix = Char.ToLower(kvp.Key);
- var mult = kvp.Value;
- if (postfix == c && 'h' == c2)
- {
- var hashrate = hash * mult;
- return Tuple.Create(hashrate, true);
- }
- }
- }
- return Tuple.Create(hash, true);
- }
-
- private static int pow10(int power) => (int)Math.Pow(10, power);
- private static readonly Dictionary _postfixes = new Dictionary
- {
- {'k', pow10(3)},
- {'M', pow10(6)},
- {'G', pow10(9)},
- {'T', pow10(12)},
- {'P', pow10(15)},
- {'E', pow10(15)},
- {'Z', pow10(21)},
- {'Y', pow10(24)},
- };
- }
-}
diff --git a/src/Miners/XMRig/JsonApiResponse.cs b/src/Miners/XMRig/JsonApiResponse.cs
deleted file mode 100644
index 718174721..000000000
--- a/src/Miners/XMRig/JsonApiResponse.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace XMRig
-{
- [Serializable]
- public class Hashrate
- {
- public List total { get; set; }
- }
-
- [Serializable]
- public class JsonApiResponse
- {
- public string version { get; set; }
- public Hashrate hashrate { get; set; }
- }
-}
diff --git a/src/Miners/XMRig/MP.XMRig.csproj b/src/Miners/XMRig/MP.XMRig.csproj
deleted file mode 100644
index 10e838095..000000000
--- a/src/Miners/XMRig/MP.XMRig.csproj
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- net6.0
- x64
- true
- true
-
-
-
-
-
-
-
diff --git a/src/Miners/XMRig/PluginInternalSettings.cs b/src/Miners/XMRig/PluginInternalSettings.cs
deleted file mode 100644
index b84873eee..000000000
--- a/src/Miners/XMRig/PluginInternalSettings.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using NHM.Common.Enums;
-using NHM.MinerPluginToolkitV1.Configs;
-using System.Collections.Generic;
-
-namespace XMRig
-{
- internal static class PluginInternalSettings
- {
- static string _urlPort => $"{MinerCommandLineSettings.POOL_URL_TEMPLATE}:{MinerCommandLineSettings.POOL_PORT_TEMPLATE}";
- static string _url=> MinerCommandLineSettings.POOL_URL_TEMPLATE;
- static string _username => MinerCommandLineSettings.USERNAME_TEMPLATE;
- static string _apiPort => MinerCommandLineSettings.API_PORT_TEMPLATE;
- static string _extraLaunchParameters => MinerCommandLineSettings.EXTRA_LAUNCH_PARAMETERS_TEMPLATE;
-
- internal static MinerCommandLineSettings MinerCommandLineSettings = new MinerCommandLineSettings
- {
- DevicesSeparator = ",",
- AlgorithmCommandLine = new Dictionary
- {
- {
- $"{AlgorithmType.RandomXmonero}",
- $"-a rx/0 -o {_urlPort} -u {_username} --http-enabled --http-port={_apiPort} --nicehash --donate-level=1 {_extraLaunchParameters}"
- }
- },
- AlgorithmCommandLineSSL = new Dictionary
- {
- {
- $"{AlgorithmType.RandomXmonero}",
- $"-a rx/0 -o {_url}:443 -u {_username} --http-enabled --http-port={_apiPort} --nicehash --tls --donate-level=1 {_extraLaunchParameters}"
- }
- }
- };
-
-
- }
-}
diff --git a/src/Miners/XMRig/XMRig.cs b/src/Miners/XMRig/XMRig.cs
deleted file mode 100644
index f6f00ecfe..000000000
--- a/src/Miners/XMRig/XMRig.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-using Newtonsoft.Json;
-using NHM.Common;
-using NHM.Common.Enums;
-using NHM.MinerPlugin;
-using NHM.MinerPluginToolkitV1;
-using NHM.MinerPluginToolkitV1.Interfaces;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Net.Http;
-using System.Threading.Tasks;
-
-namespace XMRig
-{
- public class XMRig : MinerBase, IBeforeStartMining, IDisposable
- {
- protected readonly HttpClient _httpClient = new HttpClient();
-
- public XMRig(string uuid) : base(uuid) { }
-
- public async override Task GetMinerStatsDataAsync()
- {
- var api = new ApiData();
- try
- {
- var result = await _httpClient.GetStringAsync($"http://127.0.0.1:{_apiPort}/1/summary");
- api.ApiResponse = result;
- var summary = JsonConvert.DeserializeObject(result);
-
- var totalSpeed = 0d;
- var perDeviceSpeedInfo = new Dictionary>();
- var perDevicePowerInfo = new Dictionary();
- // init per device sums
- foreach (var pair in _miningPairs)
- {
- var uuid = pair.Device.UUID;
- var currentSpeed = summary.hashrate.total.FirstOrDefault() ?? 0d;
- totalSpeed += currentSpeed;
- perDeviceSpeedInfo.Add(uuid, new List<(AlgorithmType type, double speed)>() { (_algorithmType, currentSpeed * (1 - DevFee * 0.01)) });
- // no power usage info
- perDevicePowerInfo.Add(uuid, -1);
- }
-
- api.AlgorithmSpeedsPerDevice = perDeviceSpeedInfo;
- api.PowerUsagePerDevice = perDevicePowerInfo;
- api.PowerUsageTotal = -1;
- }
- catch (Exception e)
- {
- Logger.Error(_logGroup, $"Error occured while getting API stats: {e.Message}");
- }
-
- return api;
- }
-
- protected override void Init()
- {
- }
-
-
- private static HashSet _deleteConfigs = new HashSet { "config.json" };
- private static bool IsDeleteConfigFile(string file)
- {
- foreach (var conf in _deleteConfigs)
- {
- if (file.Contains(conf)) return true;
- }
- return false;
- }
- void IBeforeStartMining.BeforeStartMining()
- {
- var binCwd = GetBinAndCwdPaths().cwdPath;
- var txtFiles = Directory.GetFiles(binCwd, "*.json", SearchOption.AllDirectories)
- .Where(file => IsDeleteConfigFile(file))
- .ToArray();
- foreach (var deleteFile in txtFiles)
- {
- try
- {
- File.Delete(deleteFile);
- }
- catch (Exception e)
- {
- Logger.Error(_logGroup, $"BeforeStartMining error while deleting file '{deleteFile}': {e.Message}");
- }
- }
- }
- private bool _disposed = false;
- public virtual void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
- protected void Dispose(bool disposing)
- {
- if (_disposed) return;
- if (disposing)
- {
- try
- {
- _httpClient.Dispose();
- }
- catch (Exception) { }
- }
- _disposed = true;
- }
- ~XMRig()
- {
- Dispose(false);
- }
- }
-}
diff --git a/src/Miners/XMRig/XMRigPlugin.PluginSupportedAlgorithms.cs b/src/Miners/XMRig/XMRigPlugin.PluginSupportedAlgorithms.cs
deleted file mode 100644
index 1b92b17f6..000000000
--- a/src/Miners/XMRig/XMRigPlugin.PluginSupportedAlgorithms.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using NHM.Common.Enums;
-using NHM.MinerPluginToolkitV1.Configs;
-using System.Collections.Generic;
-using SAS = NHM.MinerPluginToolkitV1.Configs.PluginSupportedAlgorithmsSettings.SupportedAlgorithmSettings;
-
-namespace XMRig
-{
- public partial class XMRigPlugin
- {
- protected override PluginSupportedAlgorithmsSettings DefaultPluginSupportedAlgorithmsSettings => new PluginSupportedAlgorithmsSettings
- {
- // default is 5 but we set it to 1
- DefaultFee = 1.0,
- Algorithms = new Dictionary>
- {
- {
- DeviceType.CPU,
- new List
- {
- new SAS(AlgorithmType.RandomXmonero) { Enabled = false },
- }
- }
- }
- };
- }
-}
diff --git a/src/Miners/XMRig/XMRigPlugin.cs b/src/Miners/XMRig/XMRigPlugin.cs
deleted file mode 100644
index baf9f467e..000000000
--- a/src/Miners/XMRig/XMRigPlugin.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using NHM.Common.Algorithm;
-using NHM.Common.Device;
-using NHM.Common.Enums;
-using NHM.MinerPluginToolkitV1;
-using NHM.MinerPluginToolkitV1.Configs;
-using NHM.MinerPluginToolkitV1.Interfaces;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace XMRig
-{
- public partial class XMRigPlugin : PluginBase, IAdditionalELP
- {
- public XMRigPlugin()
- {
- // mandatory init
- InitInsideConstuctorPluginSupportedAlgorithmsSettings();
- MinerCommandLineSettings = PluginInternalSettings.MinerCommandLineSettings;
- // set default internal settings
- // https://github.com/xmrig/xmrig
- MinersBinsUrlsSettings = new MinersBinsUrlsSettings
- {
- BinVersion = "v6.8.1",
- ExePath = new List { "xmrig-6.8.1", "xmrig.exe" },
- Urls = new List
- {
- "https://github.com/xmrig/xmrig/releases/download/v6.8.1/xmrig-6.8.1-msvc-win64.zip" // original
- }
- };
- PluginMetaInfo = new PluginMetaInfo
- {
- PluginDescription = "CryptoNight and RandomX (Monero) CPU miner",
- SupportedDevicesAlgorithms = SupportedDevicesAlgorithmsDict()
- };
- }
-
- public override string PluginUUID => "0e0a7320-94ec-11ea-a64d-17be303ea466";
-
- public override Version Version => new Version(19, 1);
-
- public override string Name => "XMRig";
-
- public override string Author => "info@nicehash.com";
-
- private readonly List> AdditionalELPs = new List>()
- {
- new List()
- {
- "--cpu-priority",
- "0"
- }
- };
- public List> GetAdditionalELPs()
- {
- return AdditionalELPs;
- }
-
- protected override MinerBase CreateMinerBase()
- {
- return new XMRig(PluginUUID);
- }
- public override Dictionary> GetSupportedAlgorithms(IEnumerable devices)
- {
- var supported = new Dictionary>();
-
- var cpus = devices.Where(dev => dev is CPUDevice).Cast();
- foreach (var cpu in cpus)
- {
- supported.Add(cpu, GetSupportedAlgorithmsForDevice(cpu));
- }
-
- return supported;
- }
- public override IEnumerable CheckBinaryPackageMissingFiles()
- {
- var (_, pluginRootBinsPath) = GetBinAndCwdPaths();
- return BinaryPackageMissingFilesCheckerHelpers.ReturnMissingFiles(pluginRootBinsPath, new List { "xmrig.exe" });
- }
- public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids)
- {
- //try
- //{
-
- //}
- //catch (Exception e)
- //{
- // Logger.Error(PluginUUID, $"ShouldReBenchmarkAlgorithmOnDevice {e.Message}");
- //}
- return false;
- }
- }
-}
diff --git a/src/Miners/__DEV__ExamplePlugin/ExamplePlugin.cs b/src/Miners/__DEV__ExamplePlugin/ExamplePlugin.cs
index a4aed2fc9..81d9cc3fb 100644
--- a/src/Miners/__DEV__ExamplePlugin/ExamplePlugin.cs
+++ b/src/Miners/__DEV__ExamplePlugin/ExamplePlugin.cs
@@ -69,16 +69,6 @@ public Dictionary> GetSupportedAlgorithms(I
{
algorithms.Add(new Algorithm(PluginUUID, AlgorithmType.DaggerHashimoto));
}
- // only NVIDIA supports Lyra2REv3
- if (device.DeviceType == DeviceType.NVIDIA)
- {
- algorithms.Add(new Algorithm(PluginUUID, AlgorithmType.Lyra2REv3));
- }
- // only AMD supports
- if (device.DeviceType == DeviceType.AMD)
- {
- algorithms.Add(new Algorithm(PluginUUID, AlgorithmType.GrinCuckatoo32));
- }
supported.Add(device, algorithms);
}
diff --git a/src/Miners/__DEV__FakePlugin/FakePlugin.PluginSupportedAlgorithmsSettings.cs b/src/Miners/__DEV__FakePlugin/FakePlugin.PluginSupportedAlgorithmsSettings.cs
index 356f5c2e7..9ba9b146b 100644
--- a/src/Miners/__DEV__FakePlugin/FakePlugin.PluginSupportedAlgorithmsSettings.cs
+++ b/src/Miners/__DEV__FakePlugin/FakePlugin.PluginSupportedAlgorithmsSettings.cs
@@ -23,12 +23,10 @@ public partial class FakePlugin
new List
{
new SAS(AlgorithmType.ZHash),
- new SAS(AlgorithmType.GrinCuckatoo31),
new SAS(AlgorithmType.CuckooCycle) {Enabled = false },
new SAS(AlgorithmType.BeamV3),
new SAS(AlgorithmType.KAWPOW),
new SAS(AlgorithmType.DaggerHashimoto, AlgorithmType.ZHash),
- new SAS(AlgorithmType.GrinCuckatoo32),
}
},
{
@@ -45,7 +43,6 @@ public partial class FakePlugin
new List
{
new SAS(AlgorithmType.RandomXmonero),
- new SAS(AlgorithmType.Lyra2REv3),
new SAS(AlgorithmType.KAWPOW),
}
},
diff --git a/src/NHM.Common/DemoUser.cs b/src/NHM.Common/DemoUser.cs
index ec49953ec..6d77f7204 100644
--- a/src/NHM.Common/DemoUser.cs
+++ b/src/NHM.Common/DemoUser.cs
@@ -9,7 +9,7 @@ public static class DemoUser
{
BuildTag.TESTNET => "2N6ibfrTwUSSvzAz1esPe1gYULG82asTHiS",
BuildTag.TESTNETDEV => "2N2e2ET1jMY9r5is9KaTKnU3bkCFaYHEEEx",
- _ => "33hGFJZQAfbdzyHGqhJPvZwncDjUBdZqjW", // BuildTag.PRODUCTION
+ _ => "NHbQTA7iMnCUuPjhkVCa99zbNUDFAry1nLH4", // BuildTag.PRODUCTION
};
}
}
diff --git a/src/NHM.Common/Device/AMDDevice.cs b/src/NHM.Common/Device/AMDDevice.cs
index c0935b26d..32cc4eaf5 100644
--- a/src/NHM.Common/Device/AMDDevice.cs
+++ b/src/NHM.Common/Device/AMDDevice.cs
@@ -21,5 +21,6 @@ public class AMDDevice : BaseDevice, IGpuDevice
// AMD always true
public bool IsOpenCLBackendEnabled => true;
+ public bool IsIntegrated { get; set; } = false;
}
}
diff --git a/src/NHM.Common/Device/IntelDevice.cs b/src/NHM.Common/Device/IntelDevice.cs
new file mode 100644
index 000000000..fa4134101
--- /dev/null
+++ b/src/NHM.Common/Device/IntelDevice.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.Common.Device
+{
+ public class IntelDevice : BaseDevice, IGpuDevice
+ {
+ public static string RawDetectionOutput = string.Empty;
+
+ // TODO does it make sense to set here the actual installed NVIDIA drivers??
+ public Version DEVICE_INTEL_DRIVER = new Version(0, 0); // or use just null
+
+ public int PCIeBusID { get; init; }
+ public ulong GpuRam { get; init; }
+
+ // we assume disabled and we check it after OpenCL detection.
+ public bool IsOpenCLBackendEnabled { get; private set; } = false;
+ public string RawDeviceData { get; init; }
+ }
+}
diff --git a/src/NHM.Common/Enums/AlgorithmType.cs b/src/NHM.Common/Enums/AlgorithmType.cs
index 41d1ec604..8861e4cdc 100644
--- a/src/NHM.Common/Enums/AlgorithmType.cs
+++ b/src/NHM.Common/Enums/AlgorithmType.cs
@@ -90,9 +90,9 @@ public enum AlgorithmType
Beam = 37,
[Obsolete("UNUSED Algorithm", true)]
GrinCuckaroo29 = 38,
- //[Obsolete("UNUSED Algorithm")]
+ [Obsolete("UNUSED Algorithm")]
GrinCuckatoo31 = 39,
- //[Obsolete("UNUSED Algorithm")]
+ [Obsolete("UNUSED Algorithm")]
Lyra2REv3 = 40,
[Obsolete("NOT SUPPORTED. UNUSED Algorithm", true)]
MTP = 41,
@@ -112,7 +112,7 @@ public enum AlgorithmType
Eaglesong = 48,
[Obsolete("UNUSED Algorithm", true)]
Cuckaroom = 49,
- //[Obsolete("UNUSED Algorithm")]
+ [Obsolete("UNUSED Algorithm")]
GrinCuckatoo32 = 50,
[Obsolete("UNUSED Algorithm", true)]
Handshake = 51,
@@ -136,8 +136,23 @@ public enum AlgorithmType
EtcHash = 60,
//[Obsolete("UNUSED Algorithm")]
VerusHash = 61,
- //[Obsolete("UNUSED Algorithm")]
+ [Obsolete("UNUSED Algorithm")]
KHeavyHash = 62,
+ //[Obsolete("UNUSED Algorithm")]
+ NexaPow = 63,
+ [Obsolete("UNUSED Algorithm")]
+ IronFish = 64,
+ [Obsolete("UNUSED Algorithm")]
+ KarlsenHash = 65,
+ [Obsolete("UNUSED Algorithm")]
+ Alephium = 66, //24
+ //[Obsolete("UNUSED Algorithm")]
+ FishHash = 67,
+ [Obsolete("UNUSED Algorithm")]
+ PyrinHash = 68,
+ //[Obsolete("UNUSED Algorithm")]
+ XelisHashV2 = 69
+
#endregion // NiceHashAPI
}
diff --git a/src/NHM.Common/Enums/DeviceDynamicProperties.cs b/src/NHM.Common/Enums/DeviceDynamicProperties.cs
new file mode 100644
index 000000000..d0a090d47
--- /dev/null
+++ b/src/NHM.Common/Enums/DeviceDynamicProperties.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.Common.Enums
+{
+ public enum DeviceDynamicProperties
+ {
+ NONE,
+ Load,
+ MemoryControllerLoad,
+ Temperature,
+ FanSpeedPercentage,
+ PowerUsage,
+ VramTemp,
+ HotspotTemp,
+ CoreClock,
+ MemClock,
+ TDP,
+ TDPWatts,
+ CoreVoltage,
+ CoreClockDelta,
+ MemClockDelta,
+ FanSpeedRPM
+ }
+}
diff --git a/src/NHM.Common/Enums/DeviceState.cs b/src/NHM.Common/Enums/DeviceState.cs
index ec36a5447..f90978ca9 100644
--- a/src/NHM.Common/Enums/DeviceState.cs
+++ b/src/NHM.Common/Enums/DeviceState.cs
@@ -1,4 +1,5 @@
+using System;
namespace NHM.Common.Enums
{
public enum DeviceState
@@ -10,7 +11,9 @@ public enum DeviceState
Pending,
Disabled,
#if NHMWS4
+ [Obsolete("UNUSED status", true)]
Gaming,
+ Testing
#endif
// TODO Extra states, NotProfitable
}
diff --git a/src/NHM.Common/Enums/DeviceType.cs b/src/NHM.Common/Enums/DeviceType.cs
index 2a6a91cb2..7f6327cf2 100644
--- a/src/NHM.Common/Enums/DeviceType.cs
+++ b/src/NHM.Common/Enums/DeviceType.cs
@@ -4,6 +4,7 @@ public enum DeviceType
{
CPU = 0,
NVIDIA,
- AMD
+ AMD,
+ INTEL
}
}
diff --git a/src/NHM.Common/Enums/RigManagementReturn.cs b/src/NHM.Common/Enums/RigManagementReturn.cs
new file mode 100644
index 000000000..38213e998
--- /dev/null
+++ b/src/NHM.Common/Enums/RigManagementReturn.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.Common.Enums
+{
+ public enum RigManagementReturn
+ {
+ Success,
+ PartialSuccess,
+ Fail
+ }
+}
diff --git a/src/NHM.Common/Enums/RigStatus.cs b/src/NHM.Common/Enums/RigStatus.cs
index 8cf5ede7b..89503904a 100644
--- a/src/NHM.Common/Enums/RigStatus.cs
+++ b/src/NHM.Common/Enums/RigStatus.cs
@@ -1,4 +1,5 @@
+using System;
namespace NHM.Common.Enums
{
public enum RigStatus
@@ -10,6 +11,10 @@ public enum RigStatus
Error,
Pending,
Disabled,
+ [Obsolete("UNUSED status", true)]
Gaming,
+#if NHMWS4
+ Testing,
+#endif
}
}
diff --git a/src/NHM.Common/NHM.Common.csproj b/src/NHM.Common/NHM.Common.csproj
index 73d17b805..fb6051148 100644
--- a/src/NHM.Common/NHM.Common.csproj
+++ b/src/NHM.Common/NHM.Common.csproj
@@ -8,12 +8,12 @@
1701;1702;CA1416
- $(DefineConstants)TRACE
+ $(DefineConstants)TRACE;NHMWS4
1701;1702;CA1416
- $(DefineConstants)TRACE
+ $(DefineConstants)TRACE;NHMWS4
diff --git a/src/NHM.Common/PluginsListCacheManager.cs b/src/NHM.Common/PluginsListCacheManager.cs
new file mode 100644
index 000000000..7f05908c2
--- /dev/null
+++ b/src/NHM.Common/PluginsListCacheManager.cs
@@ -0,0 +1,129 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Json;
+using System.Security.Policy;
+using System.Text;
+using System.Text.Json;
+using System.Threading.Tasks;
+
+namespace NHM.Common
+{
+ public static class PluginsListCacheManager
+ {
+ //private static DateTime lastVersion = DateTime.MinValue;
+ readonly static string dateFilePath = Paths.AppRootPath("cachedplugindate");
+ readonly static string pluginFilePath = Paths.AppRootPath("cachedplugins");
+ private static readonly string format = "d MMM yyyy HH:mm 'GMT'";
+ private static readonly string _TAG = "PluginsListCacheManager";
+
+ private static DateTime GetLastVersion(string version)
+ {
+ return GetCachedDateTime(version);
+ }
+ private static void SetLastVersion(DateTime dt, string version)
+ {
+ WriteNewCachedDateTime(dt, version);
+ }
+
+ public static DateTime GetCachedDateTime(string version)
+ {
+ string filePath = $"{dateFilePath}_v{version}.json";
+ if (!File.Exists(filePath)) return DateTime.MinValue;
+ try
+ {
+ string fileContent = File.ReadAllText(filePath);
+ DateTime deserializedDateTime = JsonSerializer.Deserialize(fileContent);
+ return deserializedDateTime;
+ }
+ catch (Exception ex)
+ {
+ Logger.Error(_TAG, ex.Message);
+ return DateTime.MinValue;
+ }
+ }
+
+ public static void WriteNewCachedDateTime(DateTime newCachedDateTime, string version)
+ {
+ string filePath = $"{dateFilePath}_v{version}.json";
+ try
+ {
+ string jsonString = JsonSerializer.Serialize(newCachedDateTime);
+ File.WriteAllText(filePath, jsonString);
+ }
+ catch (Exception ex)
+ {
+ Logger.Error(_TAG, ex.Message);
+ }
+ }
+
+ public static async Task CheckIfShouldUpdateAndUpdateLatestDate(string url, int version)
+ {
+ try
+ {
+ using (HttpClient client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Add("User-Agent", "PluginsListCacheManager");
+ HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Head, $"{url}?v={version}");
+ HttpResponseMessage response = await client.SendAsync(request);
+ if (response.StatusCode != HttpStatusCode.OK) return true;
+ if (response.Content.Headers.NonValidated.Contains("Last-Modified"))
+ {
+ var lastModifiedStr = response.Content.Headers.NonValidated.GetValueOrDefault("Last-Modified");
+ if (DateTime.TryParseExact(lastModifiedStr.ToString(), format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out DateTime result))
+ {
+ var lastVer = GetLastVersion(version.ToString());
+ if (lastVer == result)
+ {
+ Logger.Debug("PluginsListCacheManager", $"Plugin update loop: versions {version} - no update needed - {result}");
+ return false;
+ }
+ Logger.Debug("PluginsListCacheManager", $"Plugin update loop: versions {version} - WILL UPDATE - {lastVer}/{result}");
+ SetLastVersion(result, version.ToString());
+ return true;
+ }
+ }
+ }
+ }
+ catch (HttpRequestException ex)
+ {
+ Logger.Error(_TAG, $"Error: {ex.Message}");
+ }
+ return true;
+ }
+
+ public static bool WritePluginCache(int version, string plugins)
+ {
+ string filePath = $"{pluginFilePath}_v{version}.json";
+ try
+ {
+ File.WriteAllText(filePath, plugins);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Logger.Error(_TAG, $"Error: {ex.Message}");
+ }
+ return false;
+ }
+
+ public static string ReadPluginCache(int version)
+ {
+ string filePath = $"{pluginFilePath}_v{version}.json";
+ try
+ {
+ if (!File.Exists(filePath)) return string.Empty;
+ return File.ReadAllText(filePath);
+ }
+ catch (Exception ex)
+ {
+ Logger.Error(_TAG, $"Error: {ex.Message}");
+ }
+ return string.Empty;
+ }
+ }
+}
diff --git a/src/NHM.CommonWin32/NHMRegistry.cs b/src/NHM.CommonWin32/NHMRegistry.cs
index edb979118..5b75042fc 100644
--- a/src/NHM.CommonWin32/NHMRegistry.cs
+++ b/src/NHM.CommonWin32/NHMRegistry.cs
@@ -1,12 +1,15 @@
using Microsoft.Win32;
using NHM.Common;
+using NHM.Common.Enums;
using System;
+using System.Reflection.Metadata.Ecma335;
namespace NHM.CommonWin32
{
public static class NHMRegistry
{
private static string NHM_SUBKEY => @"SOFTWARE\" + APP_GUID.GUID;
+ private static string QM_SUBKEY => @"SOFTWARE\NiceHash QuickMiner";
private static bool EnsureNHMSubKeyCalled = false;
private static void EnsureNHMSubKey()
{
@@ -95,8 +98,15 @@ public static void Set_QM_MiningaddressFromRegistry(string btc)
{
try
{
- using var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\NiceHash QuickMiner", true);
+ if (BuildOptions.BUILD_TAG != BuildTag.PRODUCTION) return;
+ var key = Registry.LocalMachine.OpenSubKey(QM_SUBKEY, true);
+ if (key == null)
+ {
+ Registry.LocalMachine.CreateSubKey(QM_SUBKEY);
+ key = Registry.LocalMachine.OpenSubKey(QM_SUBKEY, true);
+ }
key.SetValue("MiningAddress", btc);
+ key.Close();
}
catch (Exception ex)
{
diff --git a/src/NHM.CommonWin32/Properties/AssemblyInfo.cs b/src/NHM.CommonWin32/Properties/AssemblyInfo.cs
index 4828fbf45..84028bd6d 100644
--- a/src/NHM.CommonWin32/Properties/AssemblyInfo.cs
+++ b/src/NHM.CommonWin32/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.1.0.4")]
-[assembly: AssemblyFileVersion("3.1.0.4")]
+[assembly: AssemblyVersion("3.1.1.6")]
+[assembly: AssemblyFileVersion("3.1.1.6")]
diff --git a/src/NHM.CredentialValidators/WorkernameValidator.cs b/src/NHM.CredentialValidators/WorkernameValidator.cs
index 7cf94962e..1a5c9cad1 100644
--- a/src/NHM.CredentialValidators/WorkernameValidator.cs
+++ b/src/NHM.CredentialValidators/WorkernameValidator.cs
@@ -6,7 +6,7 @@ internal static class WorkernameValidator
{
private static Regex _IsAlphaNumeric = new Regex(@"^[a-zA-Z0-9\s,]*$");
private static bool IsAlphaNumeric(string strToCheck) => _IsAlphaNumeric.IsMatch(strToCheck);
- private const int MAX_WORKERNAME_LENGTH = 15;
+ private const int MAX_WORKERNAME_LENGTH = 24;
internal static bool ValidateWorkerName(string workername)
{
diff --git a/src/NHM.DeviceDetection/AMD/AMDBusIDVersionResult.cs b/src/NHM.DeviceDetection/AMD/AMDBusIDVersionResult.cs
index 8362ea0e7..1f26a380f 100644
--- a/src/NHM.DeviceDetection/AMD/AMDBusIDVersionResult.cs
+++ b/src/NHM.DeviceDetection/AMD/AMDBusIDVersionResult.cs
@@ -8,5 +8,6 @@ internal record AMDBusIDVersionResult
public int BUS_ID { get; set; } = -1;
public int ADLRetCode { get; set; } = -1;
public int FunctionCall { get; set; } = -1;
+ public bool IsIntegrated { get; set; } = false;
}
}
diff --git a/src/NHM.DeviceDetection/AMD/AMDDetector.cs b/src/NHM.DeviceDetection/AMD/AMDDetector.cs
index 1c5d4f677..bf8d7f781 100644
--- a/src/NHM.DeviceDetection/AMD/AMDDetector.cs
+++ b/src/NHM.DeviceDetection/AMD/AMDDetector.cs
@@ -46,7 +46,7 @@ private static string convertSize(double size)
return null;
}
}
- public static async Task> TryQueryAMDDevicesAsync(List availableVideoControllers)
+ public static async Task> TryQueryAMDDevicesAsync(List availableVideoControllers, bool detectIntegrated)
{
Logger.Info(Tag, "TryQueryAMDDevicesAsync START");
var (rawOutput, parsed) = await OpenCLDetector.TryQueryOpenCLDevicesAsync();
@@ -79,6 +79,7 @@ public static async Task> TryQueryAMDDevicesAsync(List p.dev).Where(d => !d.IsIntegrated).ToList();
return result.Select(p => p.dev).ToList();
}
@@ -128,10 +129,12 @@ public static async Task> TryQueryAMDDevicesAsync(List ver.BUS_ID == oclDev.BUS_ID);
if(thisDeviceExtraADLResult != null && thisDeviceExtraADLResult.BUS_ID == oclDev.BUS_ID)
{
+ amdDevice.IsIntegrated = thisDeviceExtraADLResult.IsIntegrated;
amdDevice.ADLFunctionCall = thisDeviceExtraADLResult.FunctionCall;
amdDevice.ADLReturnCode = thisDeviceExtraADLResult.ADLRetCode;
amdDevice.RawDriverVersion = thisDeviceExtraADLResult.AdrenalinVersion;
diff --git a/src/NHM.DeviceDetection/DeviceDetection.cs b/src/NHM.DeviceDetection/DeviceDetection.cs
index 0c58822cb..0fa0bacd1 100644
--- a/src/NHM.DeviceDetection/DeviceDetection.cs
+++ b/src/NHM.DeviceDetection/DeviceDetection.cs
@@ -3,6 +3,7 @@
using NHM.Common.Configs;
using NHM.Common.Device;
using NHM.Common.Enums;
+using NHM.DeviceDetection.IntelGPU;
using NHM.DeviceDetection.NVIDIA;
using System;
using System.Collections.Generic;
@@ -188,9 +189,9 @@ private static async Task DetectCUDADevices()
Logger.Info(Tag, stringBuilder.ToString());
}
- private static async Task DetectAMDDevices()
+ private static async Task DetectAMDDevices(bool detectIntegrated)
{
- var amdDevices = await AMD.AMDDetector.TryQueryAMDDevicesAsync(DetectionResult.AvailableVideoControllers.ToList());
+ var amdDevices = await AMD.AMDDetector.TryQueryAMDDevicesAsync(DetectionResult.AvailableVideoControllers.ToList(), detectIntegrated);
if (amdDevices == null || amdDevices.Count == 0)
{
Logger.Info(Tag, "DetectAMDDevices ZERO Found.");
@@ -210,18 +211,49 @@ private static async Task DetectAMDDevices()
stringBuilder.AppendLine($"\t\tNAME: {amdDev.Name}");
stringBuilder.AppendLine($"\t\tCodename: {amdDev.Codename}");
stringBuilder.AppendLine($"\t\tInfSection: {amdDev.InfSection}");
- stringBuilder.AppendLine($"\t\tMEMORY: {amdDev.GpuRam}");
+ stringBuilder.AppendLine($"\t\tMEMORY: {amdDev.GpuRam}");
stringBuilder.AppendLine($"\t\tOpenCLPlatformID: {amdDev.OpenCLPlatformID}");
+ stringBuilder.AppendLine($"\t\tIsIntegrated: {amdDev.IsIntegrated}");
}
Logger.Info(Tag, stringBuilder.ToString());
}
+ private static async Task DetectIntelGPUs(bool detectIntegrated)
+ {
+ var intelDevices = await IntelGpuDetector.TryQueryIGCLDevicesAsync();
+ var result = intelDevices.parsed;
+ if (result?.IgclDevices?.Count > 0)
+ {
+ // we got INTEL devices
+ List igclDevices = new List();
+ if (detectIntegrated)
+ {
+ igclDevices = result.IgclDevices
+ .Where(dev => !dev.IsIntegrated)
+ .Select(dev => IntelGpuDetector.Transform(dev)).ToList();
+ }
+ else igclDevices = result.IgclDevices.Select(dev => IntelGpuDetector.Transform(dev)).ToList();
+ // filter out no supported SM versions
+
+ DetectionResult.IntelDevices = igclDevices.OrderBy(igclDev => igclDev.PCIeBusID).ToList();
+ // INTEL drivers
+ var igclLoaded = result?.IgclLoaded ?? -1;
+ }
+
+ // log result
+ var stringBuilder = new StringBuilder();
+ stringBuilder.AppendLine("");
+ stringBuilder.AppendLine("DetectIntelGPUDevices:");
+ IntelGpuDetector.LogDevices(stringBuilder, DetectionResult.IntelDevices);
+ Logger.Info(Tag, stringBuilder.ToString());
+ }
+
private static void DetectFAKE_Devices()
{
DetectionResult.FAKEDevices = Settings.Devices;
}
- public static async Task DetectDevices(IProgress progress)
+ public static async Task DetectDevices(bool detectIntegrated, IProgress progress)
{
if (_initCalled) return;
_initCalled = true;
@@ -232,7 +264,9 @@ public static async Task DetectDevices(IProgress progress)
progress?.Report(DeviceDetectionStep.NVIDIA_CUDA);
if (!Settings.FakeDevices) await DetectCUDADevices();
progress?.Report(DeviceDetectionStep.AMD_OpenCL);
- if (!Settings.FakeDevices) await DetectAMDDevices();
+ if (!Settings.FakeDevices) await DetectAMDDevices(detectIntegrated);
+ progress?.Report(DeviceDetectionStep.INTEL_GPU);
+ if (!Settings.FakeDevices) await DetectIntelGPUs(detectIntegrated);
progress?.Report(DeviceDetectionStep.FAKE);
if (Settings.FakeDevices) DetectFAKE_Devices();
// after we detect AMD we will have platforms and now we can check if NVIDIA OpenCL backend works
@@ -270,6 +304,15 @@ public static IEnumerable GetDetectedDevices()
yield return amdDev;
}
}
+ // INTEL
+ if (DetectionResult.IntelDevices != null)
+ {
+ foreach (var intelDev in DetectionResult.IntelDevices)
+ {
+ yield return intelDev;
+ }
+ }
+ // FAKE
if (DetectionResult.FAKEDevices != null)
{
foreach (var fakeDev in DetectionResult.FAKEDevices)
@@ -282,13 +325,13 @@ public static IEnumerable GetDetectedDevices()
}
// We check only missing from inital detection. Case like device poping back is not covered (ultra rare case)
- public static async Task CheckIfMissingGPUs()
+ public static async Task<(bool isMissing, List uuids)> CheckIfMissingGPUs(bool detectIntegrated)
{
- async Task anyMissingCUDA_Devices()
+ async Task<(bool isMissing, List uuids)> anyMissingCUDA_Devices()
{
try
{
- if (!DetectionResult.HasCUDADevices) return false;
+ if (!DetectionResult.HasCUDADevices) return (false, new List());
var cudaQueryResult = await CUDADetector.TryQueryCUDADevicesAsync();
var supportedCudaDevices = cudaQueryResult.parsed.CudaDevices
.Select(CUDADetector.Transform)
@@ -299,21 +342,21 @@ async Task anyMissingCUDA_Devices()
if (missing.Any())
{
Logger.Error(Tag, $"CUDA missing devices:\n{string.Join("\n", missing.Select(dev => $"\t{dev.UUID}"))}");
- return true;
+ return (true, missing.Select(dev => dev.UUID).ToList());
}
}
catch (Exception e)
{
Logger.Error(Tag, $"CUDA CheckIfMissingDevices error: {e}");
}
- return false;
+ return (false, new List());
}
- async Task anyMissingAMD_Devices()
+ async Task<(bool isMissing, List uuids)> anyMissingAMD_Devices()
{
try
{
- if (!DetectionResult.HasAMDDevices) return false;
- var amdDevices = await AMD.AMDDetector.TryQueryAMDDevicesAsync(DetectionResult.AvailableVideoControllers.ToList());
+ if (!DetectionResult.HasAMDDevices) return (false, new List());
+ var amdDevices = await AMD.AMDDetector.TryQueryAMDDevicesAsync(DetectionResult.AvailableVideoControllers.ToList(), detectIntegrated);
var amdDevicesUUIDs = amdDevices
.Select(dev => dev.UUID)
.ToArray();
@@ -321,16 +364,46 @@ async Task anyMissingAMD_Devices()
if (missing.Any())
{
Logger.Error(Tag, $"AMD missing devices:\n{string.Join("\n", missing.Select(dev => $"\t{dev.UUID}"))}");
- return true;
+ return (true, missing.Select(dev => dev.UUID).ToList());
}
}
catch (Exception e)
{
Logger.Error(Tag, $"AMD CheckIfMissingDevices error: {e}");
}
- return false;
+ return (false, new List());
+ }
+ async Task<(bool isMissing, List uuids)> anyMissingIntel_Devices()
+ {
+ try
+ {
+ if (!DetectionResult.HasIntelDevices) return (false, new List());
+ var intelDevices = await IntelGpuDetector.TryQueryIGCLDevicesAsync();
+ var intelDevicesUUIDs = intelDevices.parsed.IgclDevices
+ .Select(IntelGpuDetector.Transform)
+ .Select(dev => dev.UUID)
+ .ToArray();
+ var missing = DetectionResult.IntelDevices.Where(detected => !intelDevicesUUIDs.Contains(detected.UUID));
+ if (missing.Any())
+ {
+ Logger.Error(Tag, $"IntelGPU missing devices:\n{string.Join("\n", missing.Select(dev => $"\t{dev.UUID}"))}");
+ return (true, missing.Select(dev => dev.UUID).ToList());
+ }
+ }
+ catch (Exception e)
+ {
+ Logger.Error(Tag, $"AMD CheckIfMissingDevices error: {e}");
+ }
+ return (false, new List());
+ }
+ var amdsMissing = await anyMissingAMD_Devices();
+ var nvsMissing = await anyMissingCUDA_Devices();
+ var intelMissing = await anyMissingIntel_Devices();
+ if(!amdsMissing.isMissing && !nvsMissing.isMissing && !intelMissing.isMissing)
+ {
+ return (false, new List());
}
- return await anyMissingCUDA_Devices() || await anyMissingAMD_Devices();
+ return (true, nvsMissing.uuids.Concat(amdsMissing.uuids).Concat(intelMissing.uuids).ToList());
}
}
}
diff --git a/src/NHM.DeviceDetection/DeviceDetectionResult.cs b/src/NHM.DeviceDetection/DeviceDetectionResult.cs
index e61434709..c1bf78174 100644
--- a/src/NHM.DeviceDetection/DeviceDetectionResult.cs
+++ b/src/NHM.DeviceDetection/DeviceDetectionResult.cs
@@ -31,7 +31,10 @@ public class DeviceDetectionResult
public Version AmdDriver { get; internal set; }
public bool AMDDriverObsolete { get; internal set; }
-
+ // INTEL
+ public IReadOnlyList IntelDevices { get; internal set; } = new List();
+ public bool HasIntelDevices => IntelDevices != null && IntelDevices.Count > 0;
+ public Version IntelDriver { get; internal set; }
// FAKE
public IReadOnlyList FAKEDevices { get; internal set; }
diff --git a/src/NHM.DeviceDetection/DeviceDetectionStep.cs b/src/NHM.DeviceDetection/DeviceDetectionStep.cs
index 20a8a0010..fdf6809e0 100644
--- a/src/NHM.DeviceDetection/DeviceDetectionStep.cs
+++ b/src/NHM.DeviceDetection/DeviceDetectionStep.cs
@@ -6,6 +6,7 @@ public enum DeviceDetectionStep
WMIVideoControllers,
NVIDIA_CUDA,
AMD_OpenCL,
+ INTEL_GPU,
FAKE
}
}
diff --git a/src/NHM.DeviceDetection/IntelGPU/IntelGpuDetector.cs b/src/NHM.DeviceDetection/IntelGPU/IntelGpuDetector.cs
new file mode 100644
index 000000000..c4c5c60c1
--- /dev/null
+++ b/src/NHM.DeviceDetection/IntelGPU/IntelGpuDetector.cs
@@ -0,0 +1,101 @@
+using Newtonsoft.Json;
+using NHM.Common;
+using NHM.Common.Device;
+using NHM.Common.Enums;
+using NHM.UUID;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceDetection.IntelGPU
+{
+ internal static class IntelGpuDetector
+ {
+ private const string Tag = "IntelGpuDetector";
+
+ public static async Task<(string rawOutput, IntelGpuDeviceDetectionResult parsed)> TryQueryIGCLDevicesAsync()
+ {
+ var execStr = "igcl -n";
+ Logger.Info(Tag, $"TryQueryIGCLDevicesAsync START {execStr}");
+ var result = await DeviceDetectionPrinter.GetDeviceDetectionResultAsync(execStr, 30 * 1000);
+ Logger.Info(Tag, $"TryQueryIGCLDevicesAsync END {execStr}");
+
+ return result;
+ }
+
+ private static string convertSize(double size)
+ {
+ try
+ {
+ string[] units = new string[] { "B", "KB", "MB", "GB", "TB", "PB" };
+ double mod = 1024.0;
+ int i = 0;
+
+ while (size >= mod)
+ {
+ size /= mod;
+ i++;
+ }
+ var GBResult = Math.Round(size, 0);
+ // if number is odd we can assume that free memory was presented and we can return the upper even...
+ if (GBResult > 5.0 && GBResult % 2 != 0)//1,3,5gb gpus exist
+ {
+ GBResult += 1;
+ }
+ return GBResult + units[i];
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+ public static IntelDevice Transform(IntelGpuDeviceDetectionResult.Device igclDevice)
+ {
+ var uuid = "";
+ // if no nvml loaded fallback ID
+ if (string.IsNullOrEmpty(uuid))
+ {
+ var infoToHashed = $"{igclDevice.PciDeviceId}--{DeviceType.INTEL}--{igclDevice.DeviceName}--{igclDevice.PciBusID}";
+ var uuidHEX = UUID.UUID.GetHexUUID(infoToHashed);
+ uuid = $"GPU-{uuidHEX}";
+ }
+ var intelDev = new IntelDevice
+ {
+ DeviceType = DeviceType.INTEL,
+ UUID = uuid,
+ Name = igclDevice.DeviceName,
+ ID = igclDevice.PciDeviceId,
+ PCIeBusID = igclDevice.PciBusID,
+ GpuRam = igclDevice.DeviceMemory,
+ RawDeviceData = JsonConvert.SerializeObject(igclDevice),
+ };
+ if (Version.TryParse(igclDevice.DriverVersion, out var parsedVer)) intelDev.DEVICE_INTEL_DRIVER = parsedVer;
+ return intelDev;
+ }
+
+ public static void LogDevices(StringBuilder stringBuilder, IEnumerable devs)
+ {
+ if (devs == null || devs.Count() == 0)
+ {
+ var emptyStr = "\tADDED DEVICES ZERO";
+ stringBuilder.AppendLine(emptyStr);
+ return;
+ }
+ var supportedStr = "ADDED";
+ stringBuilder.AppendLine($"\t{supportedStr} devices:");
+ foreach (var intelDev in devs)
+ {
+ stringBuilder.AppendLine($"\t\t--");
+ stringBuilder.AppendLine($"\t\tUUID: {intelDev.UUID}");
+ stringBuilder.AppendLine($"\t\tID: {intelDev.ID}");
+ stringBuilder.AppendLine($"\t\tBusID: {intelDev.PCIeBusID}");
+ stringBuilder.AppendLine($"\t\tNAME: {intelDev.Name}");
+ stringBuilder.AppendLine($"\t\tMEMORY: {intelDev.GpuRam}");
+ stringBuilder.AppendLine($"\t\tDRIVER: {intelDev.DEVICE_INTEL_DRIVER}");
+ }
+ }
+ }
+}
diff --git a/src/NHM.DeviceDetection/IntelGPU/IntelGpuDeviceDetectionResult.cs b/src/NHM.DeviceDetection/IntelGPU/IntelGpuDeviceDetectionResult.cs
new file mode 100644
index 000000000..f621729f3
--- /dev/null
+++ b/src/NHM.DeviceDetection/IntelGPU/IntelGpuDeviceDetectionResult.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceDetection.IntelGPU
+{
+ [Serializable]
+ internal class IntelGpuDeviceDetectionResult
+ {
+ internal record Device
+ {
+ public int VendorId { get; set; }
+ public int PciSubSystemId { get; set; }
+ public int PciDeviceId { get; set; }
+ public int PciBusID { get; set; }
+ public string DeviceName { get; set; }
+ public string DriverVersion { get; set; }
+ public ulong DeviceMemory { get; set; }
+ public bool IsIntegrated { get; set; }
+ }
+
+ public List IgclDevices { get; set; }
+ public string ErrorString { get; set; }
+ public int IgclLoaded { get; set; }
+ public int IgclInitialized { get; set; }
+ }
+}
diff --git a/src/NHM.DeviceDetection/Properties/AssemblyInfo.cs b/src/NHM.DeviceDetection/Properties/AssemblyInfo.cs
index 872290833..cae1f37fa 100644
--- a/src/NHM.DeviceDetection/Properties/AssemblyInfo.cs
+++ b/src/NHM.DeviceDetection/Properties/AssemblyInfo.cs
@@ -32,6 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.1.0.4")]
-[assembly: AssemblyFileVersion("3.1.0.4")]
+[assembly: AssemblyVersion("3.1.1.6")]
+[assembly: AssemblyFileVersion("3.1.1.6")]
[assembly: InternalsVisibleTo("NHM.DeviceDetectionTests")]
diff --git a/src/NHM.DeviceMonitoring/AMD/AMD_ODN.cs b/src/NHM.DeviceMonitoring/AMD/AMD_ODN.cs
index d598208d7..dbf01eccf 100644
--- a/src/NHM.DeviceMonitoring/AMD/AMD_ODN.cs
+++ b/src/NHM.DeviceMonitoring/AMD/AMD_ODN.cs
@@ -35,6 +35,8 @@ internal static class AMD_ODN
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_amd_device_set_fan_speed_percentage(int bus_number, int set_fan_speed_percentage);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_amd_device_reset_fan_speed_percentage(int bus_number);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_amd_device_get_tdp_min_max_default(int bus_number, ref int min, ref int max, ref int defaultV);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_amd_device_get_tdp(int bus_number, ref int get_tdp);
@@ -47,15 +49,27 @@ internal static class AMD_ODN
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_amd_device_set_core_clocks(int bus_number, int core_clocks);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_amd_device_reset_core_clocks(int bus_number);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_amd_device_get_memory_clocks_min_max_default(int bus_number, ref int min, ref int max, ref int defaultV);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_amd_device_get_memory_clocks(int bus_number, ref int memory_clocks);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_amd_device_set_memory_clocks(int bus_number, int memory_clocks);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_amd_device_reset_memory_clocks(int bus_number);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_amd_device_get_special_temperatures(int bus_number, ref int hotspot_temp, ref int vram_temp);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_amd_device_get_memory_controller_load(int bus_number, ref int mem_ctrl_load);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_amd_device_get_voltage_min_max_default(int bus_number, ref int min, ref int max, ref int default_v);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_amd_device_get_voltage(int bus_number, ref int voltage);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_amd_device_set_voltage(int bus_number, int voltage);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_amd_device_reset_voltage(int bus_number);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
diff --git a/src/NHM.DeviceMonitoring/Core_clock/ICoreClock.cs b/src/NHM.DeviceMonitoring/Core_clock/ICoreClock.cs
new file mode 100644
index 000000000..d0cde77ae
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/Core_clock/ICoreClock.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.Core_clock
+{
+ public interface ICoreClock
+ {
+ int CoreClock { get; }
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/Core_clock/ICoreClockDelta.cs b/src/NHM.DeviceMonitoring/Core_clock/ICoreClockDelta.cs
new file mode 100644
index 000000000..7a7fa5f6f
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/Core_clock/ICoreClockDelta.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.Core_clock
+{
+ public interface ICoreClockDelta
+ {
+ int CoreClockDelta { get; }
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/Core_clock/ICoreClockRange.cs b/src/NHM.DeviceMonitoring/Core_clock/ICoreClockRange.cs
new file mode 100644
index 000000000..b81e1872f
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/Core_clock/ICoreClockRange.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.Core_clock
+{
+ public interface ICoreClockRange
+ {
+ (bool ok, int min, int max, int def) CoreClockRange { get; }
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/Core_clock/ICoreClockRangeDelta.cs b/src/NHM.DeviceMonitoring/Core_clock/ICoreClockRangeDelta.cs
new file mode 100644
index 000000000..db02c0273
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/Core_clock/ICoreClockRangeDelta.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.Core_clock
+{
+ public interface ICoreClockRangeDelta
+ {
+ (bool ok, int min, int max, int def) CoreClockRangeDelta { get; }
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/Core_clock/ICoreClockSet.cs b/src/NHM.DeviceMonitoring/Core_clock/ICoreClockSet.cs
new file mode 100644
index 000000000..3ded2c1c2
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/Core_clock/ICoreClockSet.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.Core_clock
+{
+ public interface ICoreClockSet
+ {
+ bool SetCoreClock(int coreClock);
+ bool ResetCoreClock();
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/Core_clock/ICoreClockSetDelta.cs b/src/NHM.DeviceMonitoring/Core_clock/ICoreClockSetDelta.cs
new file mode 100644
index 000000000..ac8afe6ad
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/Core_clock/ICoreClockSetDelta.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.Core_clock
+{
+ public interface ICoreClockSetDelta
+ {
+ bool SetCoreClockDelta(int coreClock);
+ bool ResetCoreClockDelta();
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/Core_voltage/ICoreVoltage.cs b/src/NHM.DeviceMonitoring/Core_voltage/ICoreVoltage.cs
new file mode 100644
index 000000000..ac3a3c303
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/Core_voltage/ICoreVoltage.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.Core_voltage
+{
+ public interface ICoreVoltage
+ {
+ int CoreVoltage { get; }
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/Core_voltage/ICoreVoltageRange.cs b/src/NHM.DeviceMonitoring/Core_voltage/ICoreVoltageRange.cs
new file mode 100644
index 000000000..6e14c62b8
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/Core_voltage/ICoreVoltageRange.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.Core_voltage
+{
+ public interface ICoreVoltageRange
+ {
+ (bool ok, int min, int max, int def) CoreVoltageRange { get; }
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/Core_voltage/ICoreVoltageSet.cs b/src/NHM.DeviceMonitoring/Core_voltage/ICoreVoltageSet.cs
new file mode 100644
index 000000000..01231bb71
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/Core_voltage/ICoreVoltageSet.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.Core_voltage
+{
+ public interface ICoreVoltageSet
+ {
+ bool SetCoreVoltage(int coreVoltage);
+ bool ResetCoreVoltage();
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/DeviceMonitorAMD.cs b/src/NHM.DeviceMonitoring/DeviceMonitorAMD.cs
index 234cedfa3..1cc477180 100644
--- a/src/NHM.DeviceMonitoring/DeviceMonitorAMD.cs
+++ b/src/NHM.DeviceMonitoring/DeviceMonitorAMD.cs
@@ -1,13 +1,19 @@
using NHM.Common;
using NHM.DeviceMonitoring.AMD;
+using NHM.DeviceMonitoring.Core_clock;
+using NHM.DeviceMonitoring.Core_voltage;
+using NHM.DeviceMonitoring.Memory_clock;
+using NHM.DeviceMonitoring.NVIDIA;
using NHM.DeviceMonitoring.TDP;
using System;
namespace NHM.DeviceMonitoring
{
- internal class DeviceMonitorAMD : DeviceMonitor, IFanSpeedRPM, IGetFanSpeedPercentage, ILoad, IPowerUsage, ITemp, ITDP, IMemControllerLoad, ISpecialTemps
+ internal class DeviceMonitorAMD : DeviceMonitor, IFanSpeedRPM, IGetFanSpeedPercentage, ILoad, IPowerUsage, ITemp, ITDP, IMemControllerLoad, ISpecialTemps, ICoreClock, IMemoryClock, ICoreClockSet, IMemoryClockSet, IMemoryClockRange, ICoreClockRange, ISetFanSpeedPercentage, IResetFanSpeed, ICoreVoltageRange, ICoreVoltage, ICoreVoltageSet, ITDPLimits
{
public int BusID { get; private set; }
+ private const int RET_OK = 0;
+
private static readonly TimeSpan _delayedLogging = TimeSpan.FromMinutes(0.5);
@@ -50,7 +56,7 @@ internal DeviceMonitorAMD(string uuid, int busID)
{
int percentage = 0;
int ok = AMD_ODN.nhm_amd_device_get_fan_speed_percentage(BusID, ref percentage);
- if (ok != 0) Logger.InfoDelayed(LogTag, $"nhm_amd_device_get_fan_speed_rpm failed with error code {ok}", _delayedLogging);
+ if (ok != 0) Logger.InfoDelayed(LogTag, $"nhm_amd_device_get_fan_speed_percentage failed with error code {ok}", _delayedLogging);
return (ok, percentage);
}
@@ -112,7 +118,15 @@ private bool SetTdpADL(double percValue)
Logger.InfoDelayed(LogTag, $"nhm_amd_device_get_tdp_ranges failed with error code {ok}", _delayedLogging);
return false;
}
-
+#if NHMWS4
+ int ok2 = AMD_ODN.nhm_amd_device_set_tdp(BusID, (int)percValue);
+ if (ok2 != 0)
+ {
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_set_tdp failed with error code {ok}", _delayedLogging);
+ return false;
+ }
+ return true;
+#else
// We limit 100% to the default as max
var limit = 0.0d;
if (percValue > 1)
@@ -127,13 +141,14 @@ private bool SetTdpADL(double percValue)
int ok2 = AMD_ODN.nhm_amd_device_set_tdp(BusID, (int)limit);
if (ok2 != 0)
{
- Logger.InfoDelayed(LogTag, $"nhm_amd_device_set_tdp failed with error code {ok}", _delayedLogging);
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_set_tdp failed with error code {ok2}", _delayedLogging);
return false;
}
return true;
+#endif
}
- #region ITDP
+#region ITDP
public TDPSettingType SettingType { get; set; } = TDPSettingType.SIMPLE;
public double TDPPercentage
@@ -162,18 +177,13 @@ public double TDPPercentage
public TDPSimpleType TDPSimple { get; private set; } = TDPSimpleType.HIGH;
- public bool SetTDPPercentage(double percentage)
+ public bool SetTDP(double percentage)
{
- if (DeviceMonitorManager.DisableDevicePowerModeSettings)
- {
- Logger.InfoDelayed(LogTag, $"SetTDPPercentage Disabled DeviceMonitorManager.DisableDevicePowerModeSettings==true", TimeSpan.FromSeconds(30));
- return false;
- }
- if (percentage < 0.0d)
- {
- Logger.Error(LogTag, $"SetTDPPercentage {percentage} out of bounds. Setting to 0.0d");
- percentage = 0.0d;
- }
+ //if (percentage < 0.0d)
+ //{
+ // Logger.Error(LogTag, $"SetTDPPercentage {percentage} out of bounds. Setting to 0.0d");
+ // percentage = 0.0d;
+ //}
Logger.Info(LogTag, $"SetTDPPercentage setting to {percentage}.");
return SetTdpADL(percentage);
}
@@ -188,11 +198,6 @@ public bool SetTDPPercentage(double percentage)
public bool SetTDPSimple(TDPSimpleType level)
{
- if (DeviceMonitorManager.DisableDevicePowerModeSettings)
- {
- Logger.InfoDelayed(LogTag, $"SetTDPSimple Disabled DeviceMonitorManager.DisableDevicePowerModeSettings==true", TimeSpan.FromSeconds(30));
- return false;
- }
var percentage = PowerLevelToTDPPercentage(level);
if (!percentage.HasValue)
{
@@ -206,7 +211,7 @@ public bool SetTDPSimple(TDPSimpleType level)
Logger.Info(LogTag, $"SetTDPSimple {execRet}.");
return execRet;
}
- #endregion ITDP
+#endregion ITDP
private (int vramTemp, int hotspotTemp) GetSpecialTemperatures()
{
int vramT = 0;
@@ -217,6 +222,81 @@ public bool SetTDPSimple(TDPSimpleType level)
return (-1, -1);
}
+ public bool SetMemoryClock(int memoryClock)
+ {
+ var ok = AMD_ODN.nhm_amd_device_set_memory_clocks(BusID, memoryClock);
+ if (ok == RET_OK) return true;
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_set_memory_clocks failed with error code {ok}", _delayedLogging);
+ return false;
+ }
+
+ public bool SetCoreClock(int coreClock)
+ {
+ var ok = AMD_ODN.nhm_amd_device_set_core_clocks(BusID, coreClock);
+ if(ok == RET_OK) return true;
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_set_core_clocks failed with error code {ok}", _delayedLogging);
+ return false;
+ }
+
+ public bool SetCoreVoltage(int coreVoltage)
+ {
+ var ok = AMD_ODN.nhm_amd_device_set_voltage(BusID, coreVoltage);
+ if (ok == RET_OK) return true;
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_set_voltage failed with error code {ok}", _delayedLogging);
+ return false;
+ }
+
+ public bool SetFanSpeedPercentage(int percentage)
+ {
+ var ok = percentage <= 0 ? AMD_ODN.nhm_amd_device_reset_fan_speed_percentage(BusID) : AMD_ODN.nhm_amd_device_set_fan_speed_percentage(BusID, percentage);
+ if (ok == RET_OK) return true;
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_set_fan_speed_percentage failed with error code {ok}", _delayedLogging);
+ return false;
+ }
+
+ public bool ResetFanSpeedPercentage()
+ {
+ var ok = AMD_ODN.nhm_amd_device_reset_fan_speed_percentage(BusID);
+ if (ok == RET_OK) return true;
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_reset_fan_speed_percentage failed with error code {ok}", _delayedLogging);
+ return false;
+ }
+
+ public bool ResetCoreClock()
+ {
+ var ok = AMD_ODN.nhm_amd_device_reset_core_clocks(BusID);
+ if (ok == RET_OK) return true;
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_reset_core_clocks failed with error code {ok}", _delayedLogging);
+ return false;
+ }
+
+ public bool ResetMemoryClock()
+ {
+ var ok = AMD_ODN.nhm_amd_device_reset_memory_clocks(BusID);
+ if (ok == RET_OK) return true;
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_reset_memory_clocks failed with error code {ok}", _delayedLogging);
+ return false;
+ }
+
+ public bool ResetCoreVoltage()
+ {
+ var ok = AMD_ODN.nhm_amd_device_reset_voltage(BusID);
+ if (ok == RET_OK) return true;
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_reset_voltage failed with error code {ok}", _delayedLogging);
+ return false;
+ }
+
+ public (bool ok, int min, int max, int def) GetTDPLimits()
+ {
+ int min = -1;
+ int max = -1;
+ int def = -1;
+ var ok = AMD_ODN.nhm_amd_device_get_tdp_min_max_default(BusID, ref min, ref max, ref def);
+ if (ok == RET_OK) return (true, min, max, def);
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_get_tdp_min_max_default failed with error code {ok}", _delayedLogging);
+ return (false, -1, -1, -1);
+ }
+
public int HotspotTemp
{
get
@@ -242,5 +322,83 @@ public int MemoryControllerLoad
return -1;
}
}
+
+ public int MemoryClock
+ {
+ get
+ {
+ int memoryClock = 0;
+ int ok = AMD_ODN.nhm_amd_device_get_memory_clocks(BusID, ref memoryClock);
+ if (ok == RET_OK) return memoryClock;
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_get_memory_clocks failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+
+ public int CoreClock
+ {
+ get
+ {
+ int coreClock = 0;
+ int ok = AMD_ODN.nhm_amd_device_get_core_clocks(BusID, ref coreClock);
+ if (ok == RET_OK) return coreClock;
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_get_core_clocks failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+
+ public int CoreVoltage
+ {
+ get
+ {
+ int coreVoltage = 0;
+ int ok = AMD_ODN.nhm_amd_device_get_voltage(BusID, ref coreVoltage);
+ if (ok == RET_OK) return coreVoltage;
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_get_voltage failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+
+ public (bool ok, int min, int max, int def) MemoryClockRange
+ {
+ get
+ {
+ int min = 0;
+ int max = 0;
+ int def = 0;
+ int ok = AMD_ODN.nhm_amd_device_get_memory_clocks_min_max_default(BusID, ref min, ref max, ref def);
+ if (ok == RET_OK) return (true, min, max, def);
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_get_memory_clocks_min_max_default failed with error code {ok}", _delayedLogging);
+ return (false, -1, -1, -1);
+ }
+ }
+
+ public (bool ok, int min, int max, int def) CoreClockRange
+ {
+ get
+ {
+ int min = 0;
+ int max = 0;
+ int def = 0;
+ int ok = AMD_ODN.nhm_amd_device_get_core_clocks_min_max_default(BusID, ref min, ref max, ref def);
+ if (ok == RET_OK) return (true, min, max, def);
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_get_core_clocks_min_max_default failed with error code {ok}", _delayedLogging);
+ return (false, -1, -1, -1);
+ }
+ }
+
+ public (bool ok, int min, int max, int def) CoreVoltageRange
+ {
+ get
+ {
+ int min = 0;
+ int max = 0;
+ int def = 0;
+ int ok = AMD_ODN.nhm_amd_device_get_voltage_min_max_default(BusID, ref min, ref max, ref def);
+ if (ok == RET_OK) return (true, min, max, def);
+ Logger.InfoDelayed(LogTag, $"nhm_amd_device_get_voltage_min_max_default failed with error code {ok}", _delayedLogging);
+ return (false, -1, -1, -1);
+ }
+ }
}
}
diff --git a/src/NHM.DeviceMonitoring/DeviceMonitorINTEL.cs b/src/NHM.DeviceMonitoring/DeviceMonitorINTEL.cs
new file mode 100644
index 000000000..24ee57138
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/DeviceMonitorINTEL.cs
@@ -0,0 +1,299 @@
+using NHM.Common;
+using NHM.DeviceMonitoring.AMD;
+using NHM.DeviceMonitoring.Core_clock;
+using NHM.DeviceMonitoring.Core_voltage;
+using NHM.DeviceMonitoring.INTEL;
+using NHM.DeviceMonitoring.Memory_clock;
+using NHM.DeviceMonitoring.NVIDIA;
+using NHM.DeviceMonitoring.TDP;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring
+{
+ internal class DeviceMonitorINTEL : DeviceMonitor, IFanSpeedRPM, ILoad, IPowerUsage, ITemp, ISpecialTemps, ITDP, ITDPWatts, ICoreClock, IMemoryClock, ICoreClockSet, ICoreClockRange, ICoreVoltageRange, ICoreVoltage, ICoreVoltageSet, ITDPLimits
+ {
+ public int BusID { get; private set; }
+ private const int RET_OK = 0;
+
+ private static readonly TimeSpan _delayedLogging = TimeSpan.FromMinutes(0.5);
+
+ private string LogTag => $"DeviceMonitorINTEL-uuid({UUID})-busid({BusID})";
+
+ internal DeviceMonitorINTEL(string uuid, int busID)
+ {
+ UUID = uuid;
+ BusID = busID;
+ }
+
+ public int FanSpeedRPM
+ {
+ get
+ {
+ int rpm = 0;
+ int ok = INTEL_IGCL.nhm_intel_device_get_fan_speed_rpm(BusID, ref rpm);
+ if (ok == 0) return rpm;
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_get_fan_speed_rpm failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+
+ public float Temp
+ {
+ get
+ {
+ int temperature = 0;
+ int ok = INTEL_IGCL.nhm_intel_device_get_temperature(BusID, ref temperature);
+ if (ok == 0) return temperature;
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_get_temperature failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+
+ public float Load
+ {
+ get
+ {
+ int load_perc = 0;
+ int ok = INTEL_IGCL.nhm_intel_device_get_load_percentage(BusID, ref load_perc);
+ if (ok == 0) return load_perc;
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_get_load_percentage failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+
+ public double PowerUsage
+ {
+ get
+ {
+ int power_usage = 0;
+ int ok = INTEL_IGCL.nhm_intel_device_get_power_usage(BusID, ref power_usage);
+ if (ok == 0) return power_usage;
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_get_power_usage failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+
+ public int VramTemp
+ {
+ get
+ {
+ int vramT = 0;
+ int ok = INTEL_IGCL.nhm_intel_device_get_vram_temperature(BusID, ref vramT);
+ if (ok == 0) return vramT;
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_get_vram_temperature failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+
+ public int HotspotTemp
+ {
+ get
+ {
+ return -1;
+ }
+ }
+
+ public int CoreClock
+ {
+ get
+ {
+ int coreClock = 0;
+ int ok = INTEL_IGCL.nhm_intel_device_get_core_clocks(BusID, ref coreClock);
+ if (ok == 0) return coreClock;
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_get_core_clocks failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+
+ public int MemoryClock
+ {
+ get
+ {
+ int memClock = 0;
+ int ok = INTEL_IGCL.nhm_intel_device_get_memory_clocks(BusID, ref memClock);
+ if (ok == 0) return memClock;
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_get_memory_clocks failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+
+ public int CoreVoltage
+ {
+ get
+ {
+ int coreVoltage = 0;
+ int ok = INTEL_IGCL.nhm_intel_device_get_core_voltage(BusID, ref coreVoltage);
+ if (ok == RET_OK) return coreVoltage;
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_get_core_voltage failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+
+ public TDPSettingType SettingType { get; set; } = TDPSettingType.SIMPLE;
+
+ public int TDPWatts
+ {
+ get
+ {
+ int tdpRaw = 0;
+ int ok = INTEL_IGCL.nhm_intel_device_get_power_limit(BusID, ref tdpRaw);
+ if (ok != 0)
+ {
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_get_power_limit failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ return tdpRaw;
+ }
+ }
+
+ public double TDPPercentage
+ {
+ get
+ {
+ int tdpRaw = 0;
+ int ok = INTEL_IGCL.nhm_intel_device_get_power_limit(BusID, ref tdpRaw);
+ if (ok != 0)
+ {
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_get_power_limit failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ int min = 0, max = 0, defaultValue = 0;
+ int ok2 = INTEL_IGCL.nhm_intel_device_get_power_limit_min_max_default(BusID, ref min, ref max, ref defaultValue);
+ if (ok2 != 0)
+ {
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_get_power_limit_min_max_default failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ // We limit 100% to the default as max
+ var tdpPerc = RangeCalculator.CalculatePercentage(tdpRaw, min, max);
+ return tdpPerc; // 0.0d - 1.0d
+ }
+ }
+
+ public TDPSimpleType TDPSimple { get; private set; } = TDPSimpleType.HIGH;
+
+ public (bool ok, int min, int max, int def) CoreClockRange
+ {
+ get
+ {
+ int min = 0;
+ int max = 0;
+ int def = 0;
+ int ok = INTEL_IGCL.nhm_intel_device_get_core_clocks_min_max_default_delta(BusID, ref min, ref max, ref def);
+ if (ok == RET_OK) return (true, min, max, def);
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_get_core_clocks_min_max_default_delta failed with error code {ok}", _delayedLogging);
+ return (false, -1, -1, -1);
+ }
+ }
+
+ public (bool ok, int min, int max, int def) CoreVoltageRange
+ {
+ get
+ {
+ int min = 0;
+ int max = 0;
+ int def = 0;
+ int ok = INTEL_IGCL.nhm_intel_device_get_core_voltage_min_max_default_delta(BusID, ref min, ref max, ref def);
+ if (ok == RET_OK) return (true, min, max, def);
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_get_core_voltage_min_max_default_delta failed with error code {ok}", _delayedLogging);
+ return (false, -1, -1, -1);
+ }
+ }
+
+ public (bool ok, int min, int max, int def) GetTDPLimits()
+ {
+ int min = -1;
+ int max = -1;
+ int def = -1;
+ var ok = INTEL_IGCL.nhm_intel_device_get_power_limit_min_max_default(BusID, ref min, ref max, ref def);
+ if (ok == RET_OK) return (true, min, max, def);
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_get_power_limit_min_max_default failed with error code {ok}", _delayedLogging);
+ return (false, -1, -1, -1);
+ }
+
+ private static double? PowerLevelToTDPPercentage(TDPSimpleType level) =>
+ level switch
+ {
+ TDPSimpleType.LOW => 0.6d, // 60%
+ TDPSimpleType.MEDIUM => 0.8d,// 80%
+ TDPSimpleType.HIGH => 1.0d, // 100%
+ _ => null,
+ };
+
+ public bool SetCoreClock(int coreClock)
+ {
+ var ok = INTEL_IGCL.nhm_intel_device_set_core_clocks_delta(BusID, coreClock);
+ if (ok == RET_OK) return true;
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_set_core_clocks_delta failed with error code {ok}", _delayedLogging);
+ return false;
+ }
+
+ public bool SetCoreVoltage(int coreVoltage)
+ {
+ var ok = INTEL_IGCL.nhm_intel_device_set_core_voltage_delta(BusID, coreVoltage);
+ if (ok == RET_OK) return true;
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_set_core_voltage_delta failed with error code {ok}", _delayedLogging);
+ return false;
+ }
+
+ public bool SetTDP(double watts)
+ {
+ var value = watts;
+ if (value <= 1.0d)
+ {
+ int min = -1;
+ int max = -1;
+ int def = -1;
+ var ok = INTEL_IGCL.nhm_intel_device_get_power_limit_min_max_default(BusID, ref min, ref max, ref def);
+ value = watts * def;
+ }
+
+ Logger.Info(LogTag, $"SetTDP setting to {value}.");
+
+ var execRet = INTEL_IGCL.nhm_intel_device_set_power_limit(BusID, (int)value);
+ Logger.Info(LogTag, $"SetTDP returned {execRet}.");
+ return execRet == RET_OK;
+ }
+ public bool SetTDPSimple(TDPSimpleType level)
+ {
+ var percentage = PowerLevelToTDPPercentage(level);
+ if (!percentage.HasValue)
+ {
+ Logger.Error(LogTag, $"SetTDPSimple unkown PowerLevel {level}. Defaulting to {TDPSimpleType.HIGH}");
+ level = TDPSimpleType.HIGH;
+ percentage = PowerLevelToTDPPercentage(level);
+ }
+ Logger.Info(LogTag, $"SetTDPSimple setting PowerLevel to {level}.");
+ int min = -1;
+ int max = -1;
+ int def = -1;
+ var ok = INTEL_IGCL.nhm_intel_device_get_power_limit_min_max_default(BusID, ref min, ref max, ref def);
+ var watts = percentage * def;
+
+ var execRet = INTEL_IGCL.nhm_intel_device_set_power_limit(BusID, (int)watts);
+ if (execRet == RET_OK) TDPSimple = level;
+ Logger.Info(LogTag, $"SetTDPSimple {execRet}.");
+ return execRet == RET_OK;
+ }
+
+ public bool ResetCoreClock()
+ {
+ var ok = INTEL_IGCL.nhm_intel_device_reset_core_clocks_delta(BusID);
+ if (ok == RET_OK) return true;
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_reset_core_clocks_delta failed with error code {ok}", _delayedLogging);
+ return false;
+ }
+
+ public bool ResetCoreVoltage()
+ {
+ var ok = INTEL_IGCL.nhm_intel_device_reset_core_voltage_delta(BusID);
+ if (ok == RET_OK) return true;
+ Logger.InfoDelayed(LogTag, $"nhm_intel_device_reset_core_voltage_delta failed with error code {ok}", _delayedLogging);
+ return false;
+ }
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/DeviceMonitorManager.cs b/src/NHM.DeviceMonitoring/DeviceMonitorManager.cs
index 2ec39fe46..6c542bdd1 100644
--- a/src/NHM.DeviceMonitoring/DeviceMonitorManager.cs
+++ b/src/NHM.DeviceMonitoring/DeviceMonitorManager.cs
@@ -2,6 +2,7 @@
using NHM.Common;
using NHM.Common.Device;
using NHM.DeviceMonitoring.AMD;
+using NHM.DeviceMonitoring.INTEL;
using NHM.DeviceMonitoring.NVIDIA;
using System;
using System.Collections.Generic;
@@ -15,7 +16,6 @@ namespace NHM.DeviceMonitoring
public static class DeviceMonitorManager
{
public static bool DisableDeviceStatusMonitoring { get; set; } = false;
- public static bool DisableDevicePowerModeSettings { get; set; } = true;
internal static readonly bool IsElevated;
@@ -40,6 +40,7 @@ int customLogSettings(string fileName)
}
_amdDebugLogLevel = customLogSettings("AMD_ODN_LOG.txt");
_nvidiaDebugLogLevel = customLogSettings("NVIDIA_MON_LOG.txt");
+ _intelDebugLogLevel = customLogSettings("INTEL_IGCL_LOG.txt");
try
{
@@ -69,6 +70,13 @@ private static void LogNvidia_MON(string logStr)
Logger.InfoDelayed("NVIDIA_MON", logStr, TimeSpan.FromSeconds(10));
}
+ private static int _intelDebugLogLevel = 0;
+ private static readonly INTEL_IGCL.log_cb _intelLog= new INTEL_IGCL.log_cb(LogIntel_IGCL);
+ private static void LogIntel_IGCL(string logStr)
+ {
+ Logger.InfoDelayed("INTEL_IGCL", logStr, TimeSpan.FromSeconds(10));
+ }
+
private static T[] GetDeviceTypes(this IEnumerable devices) where T : BaseDevice
{
return devices.Where(dev => dev is T).Cast().ToArray();
@@ -124,7 +132,6 @@ void addNVIDIAs()
var initialNvmlRestartTimeWait = Math.Min(500 * nvidias.Length, 5000); // 500ms per GPU or initial MAX of 5seconds
var nvidiaUUIDAndBusIds = nvidias.ToDictionary(nvidia => nvidia.UUID, nvidia => nvidia.PCIeBusID);
var nvidiaInit = NVIDIA_MON.nhm_nvidia_init();
- NVIDIA_MON.nhm_nvidia_reg_log_cb(_nvidiaLog);
DeviceMonitorNVIDIA.Init();
if (nvidiaInit != 0)
@@ -138,9 +145,29 @@ void addNVIDIAs()
ret.Add(new DeviceMonitorNVIDIA(nvidia.UUID, nvidia.PCIeBusID));
}
}
+ void addINTELs()
+ {
+ var intels = devices.GetDeviceTypes();
+ if (!intels.Any()) return;
+
+ INTEL_IGCL.nhm_intel_set_debug_log_level(_intelDebugLogLevel);
+ INTEL_IGCL.nhm_intel_reg_log_cb(_intelLog);
+ var intelInit = INTEL_IGCL.nhm_intel_init();
+ if (0 != intelInit)
+ {
+ Logger.Info("DeviceMonitorManager", $"INTEL nhm_intel_init {intelInit}");
+ return;
+ }
+
+ foreach( var intel in intels)
+ {
+ ret.Add(new DeviceMonitorINTEL(intel.UUID, intel.PCIeBusID));
+ }
+ }
addCPUs();
addAMDs();
addNVIDIAs();
+ addINTELs();
return ret;
});
}
diff --git a/src/NHM.DeviceMonitoring/DeviceMonitorNVIDIA.cs b/src/NHM.DeviceMonitoring/DeviceMonitorNVIDIA.cs
index 2112af7ac..a11ace877 100644
--- a/src/NHM.DeviceMonitoring/DeviceMonitorNVIDIA.cs
+++ b/src/NHM.DeviceMonitoring/DeviceMonitorNVIDIA.cs
@@ -1,4 +1,7 @@
using NHM.Common;
+using NHM.DeviceMonitoring.Core_clock;
+using NHM.DeviceMonitoring.Core_voltage;
+using NHM.DeviceMonitoring.Memory_clock;
using NHM.DeviceMonitoring.NVIDIA;
using NHM.DeviceMonitoring.TDP;
using System;
@@ -6,7 +9,7 @@
namespace NHM.DeviceMonitoring
{
- internal class DeviceMonitorNVIDIA : DeviceMonitor, IFanSpeedRPM, IGetFanSpeedPercentage, ILoad, IPowerUsage, ITemp, ITDP, IMemoryTimings, IMemControllerLoad, ISpecialTemps
+ internal class DeviceMonitorNVIDIA : DeviceMonitor, IFanSpeedRPM, IGetFanSpeedPercentage, ILoad, IPowerUsage, ITemp, ITDP, ITDPWatts, IMemoryTimings, IMemControllerLoad, ISpecialTemps, ICoreClock, IMemoryClock, ICoreClockSet, IMemoryClockSet, IMemoryClockRange, ICoreClockRange, ISetFanSpeedPercentage, IResetFanSpeed, ITDPLimits, IMemoryClockDelta, ICoreClockDelta, ICoreClockRangeDelta, IMemoryClockRangeDelta, ICoreVoltage, ICoreVoltageRange, ICoreVoltageSet, ICoreClockSetDelta, IMemoryClockSetDelta
{
private const int RET_OK = 0;
public static object _lock = new object();
@@ -134,12 +137,38 @@ public bool SetFanSpeedPercentage(int percentage)
return true;
}
+ public bool ResetFanSpeedPercentage()
+ {
+ int ok = NVIDIA_MON.nhm_nvidia_device_reset_fan(BusID);
+ if(ok != RET_OK)
+ {
+ Logger.InfoDelayed(LogTag, $"nhm_nvidia_device_reset_fan failed with error code {ok}", _delayedLogging);
+ return false;
+ }
+ return true;
+ }
+
#region ITDP
public TDPSettingType SettingType { get; set; } = TDPSettingType.SIMPLE;
public TDPSimpleType TDPSimple { get; private set; } = TDPSimpleType.HIGH;
+ public int TDPWatts
+ {
+ get
+ {
+ int tdpRaw = 0;
+ int ok = NVIDIA_MON.nhm_nvidia_device_get_tdp_watt(BusID, ref tdpRaw);
+ if (ok != RET_OK)
+ {
+ Logger.InfoDelayed(LogTag, $"nhm_nvidia_device_get_tdp_watt failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ return tdpRaw;
+ }
+ }
+
public double TDPPercentage
{
get
@@ -167,11 +196,6 @@ public double TDPPercentage
public bool SetTDPSimple(TDPSimpleType level)
{
- if (DeviceMonitorManager.DisableDevicePowerModeSettings)
- {
- Logger.InfoDelayed(LogTag, $"SetTDPSimple Disabled DeviceMonitorManager.DisableDevicePowerModeSettings==true", TimeSpan.FromSeconds(30));
- return false;
- }
var percentage = PowerLevelToTDPPercentage(level);
if (!percentage.HasValue)
{
@@ -180,32 +204,46 @@ public bool SetTDPSimple(TDPSimpleType level)
percentage = PowerLevelToTDPPercentage(level);
}
Logger.Info(LogTag, $"SetTDPSimple setting PowerLevel to {level}.");
- var execRet = NVIDIA_MON.nhm_nvidia_device_set_tdp(BusID, (int)(percentage*100));
+ uint min = 0;
+ uint max = 0;
+ uint def = 0;
+ var ok = NVIDIA_MON.nhm_nvidia_device_get_tdp_min_max_default(BusID, ref min, ref max, ref def);
+
+ Logger.Info(LogTag, $"SetTDPSimple setting PowerLevel to {level}.");
+
+ var watts = percentage * def;
+
+ var execRet = NVIDIA_MON.nhm_nvidia_device_set_tdp(BusID, (int)(watts));
if (execRet == RET_OK) TDPSimple = level;
Logger.Info(LogTag, $"SetTDPSimple {execRet}.");
return execRet == RET_OK;
}
- public bool SetTDPPercentage(double percentage)
+ public bool SetTDP(double watts)
{
- if (DeviceMonitorManager.DisableDevicePowerModeSettings)
- {
- Logger.InfoDelayed(LogTag, $"SetTDPPercentage Disabled DeviceMonitorManager.DisableDevicePowerModeSettings==true", TimeSpan.FromSeconds(30));
- return false;
- }
- if (percentage < 0.0d)
+ var value = watts;
+ if (value <= 1.0d)
{
- Logger.Error(LogTag, $"SetTDPPercentage {percentage} out of bounds. Setting to 0.0d");
- percentage = 0.0d;
+ uint min = 0;
+ uint max = 0;
+ uint def = 0;
+ var ok = NVIDIA_MON.nhm_nvidia_device_get_tdp_min_max_default(BusID, ref min, ref max, ref def);
+ value = watts * def;
}
- Logger.Info(LogTag, $"SetTDPPercentage setting to {percentage}.");
+ Logger.Info(LogTag, $"SetTDP setting to {value}.");
+#if NHMWS4
+
+
+ var execRet = NVIDIA_MON.nhm_nvidia_device_set_tdp(BusID, (int)value);
+#else
var execRet = NVIDIA_MON.nhm_nvidia_device_set_tdp(BusID, (int)percentage*100);
- Logger.Info(LogTag, $"SetTDPPercentage {execRet}.");
+#endif
+ Logger.Info(LogTag, $"SetTDP returned {execRet}.");
return execRet == RET_OK;
}
- #endregion ITDP
+#endregion ITDP
public int SetMemoryTimings(string mt)
{
return NVIDIA_MON.nhm_nvidia_device_set_memory_timings(BusID, mt);
@@ -248,9 +286,195 @@ public int MemoryControllerLoad
return -1;
}
}
+
+ public int CoreClock
+ {
+ get
+ {
+ int coreClock = 0;
+ int ok = NVIDIA_MON.nhm_nvidia_device_get_core_clocks(BusID, ref coreClock);
+ if (ok == RET_OK) return coreClock;
+ Logger.InfoDelayed(LogTag, $"nhm_nvidia_device_get_core_clocks failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+
+ public int CoreClockDelta
+ {
+ get
+ {
+ int coreClockDelta = 0;
+ int ok = NVIDIA_MON.nhm_nvidia_device_get_core_clocks_delta(BusID, ref coreClockDelta);
+ if (ok == RET_OK) return coreClockDelta;
+ Logger.InfoDelayed(LogTag, $"nhm_nvidia_device_get_core_clocks_delta failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+
+ public int MemoryClock
+ {
+ get
+ {
+ int memoryClock = 0;
+ int ok = NVIDIA_MON.nhm_nvidia_device_get_memory_clocks(BusID, ref memoryClock);
+ if (ok == RET_OK) return memoryClock;
+ Logger.InfoDelayed(LogTag, $"nhm_nvidia_device_get_memory_clocks failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+
+ public int MemoryClockDelta
+ {
+ get
+ {
+ int memoryClockDelta = 0;
+ int ok = NVIDIA_MON.nhm_nvidia_device_get_memory_clocks_delta(BusID, ref memoryClockDelta);
+ if (ok == RET_OK) return memoryClockDelta;
+ Logger.InfoDelayed(LogTag, $"nhm_nvidia_device_get_memory_clocks_delta failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+ public int CoreVoltage
+ {
+ get
+ {
+ int coreVoltage = 0;
+ int ok = NVIDIA_MON.nhm_nvidia_device_get_core_voltage(BusID, ref coreVoltage);
+ if(ok == RET_OK) return coreVoltage;
+ Logger.InfoDelayed(LogTag, $"nhm_nvidia_device_get_core_voltage failed with error code {ok}", _delayedLogging);
+ return -1;
+ }
+ }
+
public void PrintMemoryTimings()
{
NVIDIA_MON.nhm_nvidia_device_print_memory_timings(BusID);
}
+
+ public bool SetCoreClock(int coreClock)
+ {
+ return NVIDIA_MON.nhm_nvidia_device_set_core_clocks(BusID, coreClock, true) == 0;
+ }
+ public bool SetMemoryClock(int memoryClock)
+ {
+ return NVIDIA_MON.nhm_nvidia_device_set_memory_clocks(BusID, memoryClock, true) == 0;
+ }
+ public bool SetCoreClockDelta(int coreClockDelta)
+ {
+ return NVIDIA_MON.nhm_nvidia_device_set_core_clocks(BusID, coreClockDelta, false) == 0;
+ }
+ public bool SetMemoryClockDelta(int memoryClockDelta)
+ {
+ return NVIDIA_MON.nhm_nvidia_device_set_memory_clocks(BusID, memoryClockDelta, false) == 0;
+ }
+ public (bool ok, int min, int max, int def) GetTDPLimits()
+ {
+ uint min = 0;
+ uint max = 0;
+ uint def = 0;
+ var ok = NVIDIA_MON.nhm_nvidia_device_get_tdp_min_max_default(BusID, ref min, ref max, ref def);
+ if (ok == RET_OK) return (true, (int)min, (int)max, (int)def);
+ Logger.InfoDelayed(LogTag, $"nhm_nvidia_device_get_tdp_min_max_default failed with error code {ok}", _delayedLogging);
+ return (false, 0, 0, 0);
+ }
+
+ public bool SetCoreVoltage(int coreVoltage)
+ {
+ return NVIDIA_MON.nhm_nvidia_device_set_core_voltage(BusID, coreVoltage) == 0;
+ }
+
+ public bool ResetCoreVoltage()
+ {
+ return NVIDIA_MON.nhm_nvidia_device_reset_core_voltage(BusID) == 0;
+ }
+
+ public bool ResetMemoryClock()
+ {
+ return NVIDIA_MON.nhm_nvidia_device_reset_memory_clocks(BusID, true) == 0;
+ }
+
+ public bool ResetCoreClock()
+ {
+ return NVIDIA_MON.nhm_nvidia_device_reset_core_clocks(BusID, true) == 0;
+ }
+
+ public bool ResetMemoryClockDelta()
+ {
+ return NVIDIA_MON.nhm_nvidia_device_reset_memory_clocks(BusID, false) == 0;
+ }
+
+ public bool ResetCoreClockDelta()
+ {
+ return NVIDIA_MON.nhm_nvidia_device_reset_core_clocks(BusID, false) == 0;
+ }
+ public (bool ok, int min, int max, int def) CoreClockRange
+ {
+ get
+ {
+ int min = 0;
+ int max = 0;
+ int def = 0;
+ var ok = NVIDIA_MON.nhm_nvidia_device_get_core_clocks_min_max_default_absolute(BusID, ref min, ref max, ref def);
+ if (ok == RET_OK) return (true, min, max, def);
+ Logger.InfoDelayed(LogTag, $"nhm_nvidia_device_get_core_clocks_min_max_default_absolute failed with error code {ok}", _delayedLogging);
+ return (false, 0, 0, 0);
+
+ }
+ }
+ public (bool ok, int min, int max, int def) MemoryClockRange
+ {
+ get
+ {
+ int min = 0;
+ int max = 0;
+ int def = 0;
+ var ok = NVIDIA_MON.nhm_nvidia_device_get_memory_clocks_min_max_default_absolute(BusID, ref min, ref max, ref def);
+ if (ok == RET_OK) return (true, min, max, def);
+ Logger.InfoDelayed(LogTag, $"nhm_nvidia_device_get_memory_clocks_min_max_default_absolute failed with error code {ok}", _delayedLogging);
+ return (false, 0, 0, 0);
+ }
+ }
+
+ public (bool ok, int min, int max, int def) MemoryClockRangeDelta
+ {
+ get
+ {
+ int min = 0;
+ int max = 0;
+ int def = 0;
+ var ok = NVIDIA_MON.nhm_nvidia_device_get_memory_clocks_min_max_default_delta(BusID, ref min, ref max, ref def); //problem here not found
+ if (ok == RET_OK) return (true, min, max, def);
+ Logger.InfoDelayed(LogTag, $"nhm_nvidia_device_get_memory_clocks_min_max_default_delta failed with error code {ok}", _delayedLogging);
+ return (false, 0, 0, 0);
+ }
+ }
+
+ public (bool ok, int min, int max, int def) CoreClockRangeDelta
+ {
+ get
+ {
+ int min = 0;
+ int max = 0;
+ int def = 0;
+ var ok = NVIDIA_MON.nhm_nvidia_device_get_core_clocks_min_max_default_delta(BusID, ref min, ref max, ref def);//problem here not found
+ if(ok == RET_OK) return (true, min, max, def);
+ Logger.InfoDelayed(LogTag, $"nhm_nvidia_device_get_core_clocks_min_max_default_delta failed with error code {ok}", _delayedLogging);
+ return (false, 0, 0, 0);
+ }
+ }
+
+ public (bool ok, int min, int max, int def) CoreVoltageRange
+ {
+ get
+ {
+ int min = 0;
+ int max = 0;
+ int def = 0;
+ var ok = NVIDIA_MON.nhm_nvidia_device_get_core_voltage_min_max_default(BusID, ref min, ref max, ref def);
+ if(ok == RET_OK) return (true, min, max, def);
+ Logger.InfoDelayed(LogTag, $"nhm_nvidia_device_get_core_voltage_min_max_default failed with error code {ok}", _delayedLogging);
+ return (false, 0, 0, 0);
+ }
+ }
}
}
diff --git a/src/NHM.DeviceMonitoring/INTEL/INTEL_IGCL.cs b/src/NHM.DeviceMonitoring/INTEL/INTEL_IGCL.cs
new file mode 100644
index 000000000..b26719697
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/INTEL/INTEL_IGCL.cs
@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.INTEL
+{
+ internal static class INTEL_IGCL
+ {
+ const string dll = "device_monitoring_intel.dll";
+ public delegate void log_cb(string error);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
+ public static extern int nhm_intel_reg_log_cb(log_cb cb);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
+ public static extern int nhm_intel_set_debug_log_level(int level);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_init();
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_deinit();
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_load_percentage(int bus_number, ref int get_load_percentage);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_temperature(int bus_number, ref int get_temperature);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_vram_temperature(int bus_number, ref int get_vram_temperature);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_fan_speed_rpm(int bus_number, ref int get_fan_speed_rpm);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_set_fan_speed_rpm(int bus_number, int set_fan_speed_rpm);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_reset_fan_speed_rpm(int bus_number);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_core_clocks_min_max_default_delta(int bus_number, ref int min, ref int max, ref int def);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_core_clocks(int bus_number, ref int get_core_clock);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_core_clocks_delta(int bus_number, ref int get_core_clock_delta);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_set_core_clocks_delta(int bus_number, int set_core_clock_delta_delta);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_set_locked_core_clocks(int bus_number, int set_locked_core_clock, int set_voltage);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_reset_locked_core_clocks(int bus_number);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_reset_core_clocks_delta(int bus_number);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_memory_clocks_min_max_default_delta(int bus_number, ref int min, ref int max, ref int def);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_memory_clocks(int bus_number, ref int get_memory_clock);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_memory_clocks_delta(int bus_number, ref int get_memory_clock_delta);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_set_memory_clocks_delta(int bus_number, int set_memory_clock_delta);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_reset_memory_clocks_delta(int bus_number);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_core_voltage_min_max_default_delta(int bus_number, ref int min, ref int max, ref int def);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_core_voltage(int bus_number, ref int get_core_voltage);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_core_voltage_delta(int bus_number, ref int get_core_voltage_delta);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_set_core_voltage_delta(int bus_number, int set_core_voltage);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_reset_core_voltage_delta(int bus_number);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_power_limit_min_max_default(int bus_number, ref int min, ref int max, ref int def);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_power_usage(int bus_number, ref int get_power_usage);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_get_power_limit(int bus_number, ref int get_power_limit);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_set_power_limit(int bus_number, int set_power_limit);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_intel_device_reset_power_limit(int bus_number);
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/IResetFanSpeed.cs b/src/NHM.DeviceMonitoring/IResetFanSpeed.cs
new file mode 100644
index 000000000..550338f10
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/IResetFanSpeed.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring
+{
+ public interface IResetFanSpeed
+ {
+ bool ResetFanSpeedPercentage();
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/ISetFanSpeedPercentage.cs b/src/NHM.DeviceMonitoring/ISetFanSpeedPercentage.cs
new file mode 100644
index 000000000..805a2310b
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/ISetFanSpeedPercentage.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring
+{
+ public interface ISetFanSpeedPercentage
+ {
+ bool SetFanSpeedPercentage(int percentage);
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClock.cs b/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClock.cs
new file mode 100644
index 000000000..78e300835
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClock.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.Memory_clock
+{
+ public interface IMemoryClock
+ {
+ int MemoryClock { get; }
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClockDelta.cs b/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClockDelta.cs
new file mode 100644
index 000000000..da7fd1f2e
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClockDelta.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.Memory_clock
+{
+ public interface IMemoryClockDelta
+ {
+ int MemoryClockDelta { get; }
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClockRange.cs b/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClockRange.cs
new file mode 100644
index 000000000..1cb7a3dc1
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClockRange.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.Memory_clock
+{
+ public interface IMemoryClockRange
+ {
+ (bool ok, int min, int max, int def) MemoryClockRange { get; }
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClockRangeDelta.cs b/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClockRangeDelta.cs
new file mode 100644
index 000000000..84c70b4be
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClockRangeDelta.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.Memory_clock
+{
+ public interface IMemoryClockRangeDelta
+ {
+ (bool ok, int min, int max, int def) MemoryClockRangeDelta { get; }
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClockSet.cs b/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClockSet.cs
new file mode 100644
index 000000000..0ab542009
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClockSet.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.Memory_clock
+{
+ public interface IMemoryClockSet
+ {
+ bool SetMemoryClock(int memoryClock);
+ bool ResetMemoryClock();
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClockSetDelta.cs b/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClockSetDelta.cs
new file mode 100644
index 000000000..7b8eca745
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/Memory_clock/IMemoryClockSetDelta.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.Memory_clock
+{
+ public interface IMemoryClockSetDelta
+ {
+ bool SetMemoryClockDelta(int memoryClock);
+ bool ResetMemoryClockDelta();
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/NHM.DeviceMonitoring.csproj b/src/NHM.DeviceMonitoring/NHM.DeviceMonitoring.csproj
index 16afebc5e..2293fcf37 100644
--- a/src/NHM.DeviceMonitoring/NHM.DeviceMonitoring.csproj
+++ b/src/NHM.DeviceMonitoring/NHM.DeviceMonitoring.csproj
@@ -8,9 +8,11 @@
1701;1702;CA1416
+ $(DefineConstants)TRACE;NHMWS4
1701;1702;CA1416
+ $(DefineConstants)TRACE;NHMWS4
diff --git a/src/NHM.DeviceMonitoring/NVIDIA/NVIDIA_MON.cs b/src/NHM.DeviceMonitoring/NVIDIA/NVIDIA_MON.cs
index 09242a3dc..6389c34cb 100644
--- a/src/NHM.DeviceMonitoring/NVIDIA/NVIDIA_MON.cs
+++ b/src/NHM.DeviceMonitoring/NVIDIA/NVIDIA_MON.cs
@@ -30,35 +30,37 @@ internal static class NVIDIA_MON
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_nvidia_device_get_fan_speed_rpm(int bus_number, ref int get_fan_speed_rpm);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
- public static extern int nhm_nvidia_device_get_fan_speed_rpm_v2(int bus_number, ref int get_fan_speed_rpm);
- [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_nvidia_device_get_fan_speed_percentage(int bus_number, ref int get_fan_speed_percentage);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_nvidia_device_set_fan_speed_percentage(int bus_number, int set_fan_speed_percentage);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_nvidia_device_reset_fan(int bus_number);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_nvidia_device_get_tdp_min_max_default(int bus_number, ref uint min, ref uint max, ref uint defaultV);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_nvidia_device_get_tdp_min_max_default_perc(int bus_number, ref uint min, ref uint max, ref uint def);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_nvidia_device_get_tdp(int bus_number, ref int get_tdp);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_nvidia_device_get_tdp_watt(int bus_number, ref int get_tdp);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_nvidia_device_set_tdp(int bus_number, int set_tdp);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_nvidia_device_get_core_clocks(int bus_number, ref int core_clocks);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
- public static extern int nhm_nvidia_device_set_core_clocks(int bus_number, int core_clocks);
+ public static extern int nhm_nvidia_device_get_core_clocks_delta(int bus_number, ref int core_clocks_delta);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
- public static extern int nhm_nvidia_device_set_core_clocks_delta(int bus_number, int core_clocks_delta);
+ public static extern int nhm_nvidia_device_set_core_clocks(int bus_number, int core_clocks, bool is_absolute);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
- public static extern int nhm_nvidia_device_get_memory_clocks(int bus_number, ref int memory_clocks);
- [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
- public static extern int nhm_nvidia_device_set_memory_clocks_delta(int bus_number, int memory_clocks_delta);
+ public static extern int nhm_nvidia_device_reset_core_clocks(int bus_number, bool is_absolute);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
- public static extern int nhm_nvidia_device_get_memory_info(int bus_number, ref ulong free, ref ulong total, ref ulong used);
+ public static extern int nhm_nvidia_device_get_memory_clocks(int bus_number, ref int memory_clocks);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
- public static extern int nhm_nvidia_device_restore_fan_speed(int bus_number);
+ public static extern int nhm_nvidia_device_get_memory_clocks_delta(int bus_number, ref int memory_clocks);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
- public static extern int nhm_nvidia_device_get_clocks_delta(int bus_number, ref int core_clock, ref int mem_clock);
+ public static extern int nhm_nvidia_device_set_memory_clocks(int bus_number, int memory_clocks, bool is_absolute);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
- public static extern int nhm_nvidia_device_get_oc_limits_delta(int bus_number, ref int delta_core_min, ref int delta_core_max, ref int delta_mem_min, ref int delta_mem_max);
+ public static extern int nhm_nvidia_device_reset_memory_clocks(int bus_number, bool is_absolute);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_nvidia_device_set_memory_timings(int bus_number, string memory_timings);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
@@ -68,15 +70,23 @@ internal static class NVIDIA_MON
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
public static extern int nhm_nvidia_device_get_memory_controller_load(int bus_number, ref int mem_ctrl_load);
[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
- public static extern int nhm_nvidia_device_print_memory_timings(int bus_number);
-
- //Excavator no longer has these functions (or they have been moved)
- //[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
- //public static extern int nhm_amd_device_set_memory_clocks(int bus_number, int memory_clocks);
- //[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
- //public static extern int nhm_amd_device_get_core_clocks_min_max_default(int bus_number, ref int min, ref int max, ref int defaultV);
- //[DllImport(dll, CallingConvention = CallingConvention.StdCall)]
- //public static extern int nhm_amd_device_get_memory_clocks_min_max_default(int bus_number, ref int min, ref int max, ref int defaultV);
+ public static extern void nhm_nvidia_device_print_memory_timings(int bus_number);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_nvidia_device_get_core_clocks_min_max_default_absolute(int bus_number, ref int min, ref int max, ref int def);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_nvidia_device_get_core_clocks_min_max_default_delta(int bus_number, ref int min, ref int max, ref int def);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_nvidia_device_get_memory_clocks_min_max_default_absolute(int bus_number, ref int min, ref int max, ref int def);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_nvidia_device_get_memory_clocks_min_max_default_delta(int bus_number, ref int min, ref int max, ref int def);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_nvidia_device_get_core_voltage(int bus_number, ref int core_voltage);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_nvidia_device_get_core_voltage_min_max_default(int bus_number, ref int min, ref int max, ref int def);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_nvidia_device_reset_core_voltage(int bus_number);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_nvidia_device_set_core_voltage(int bus_number, int core_voltage);
}
}
diff --git a/src/NHM.DeviceMonitoring/PID/PID_CONTROLLER.cs b/src/NHM.DeviceMonitoring/PID/PID_CONTROLLER.cs
new file mode 100644
index 000000000..797da6672
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/PID/PID_CONTROLLER.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.PID
+{
+ internal class PID_CONTROLLER
+ {
+ const string dll = "pid_controller.dll";
+
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_pid_init();
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern int nhm_pid_deinit();
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern double nhm_pid_get_output(double actual_temp, double setpoint);
+
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern void nhm_set_output_limit(double fan_speed_limit);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern void nhm_set_output_limits(double min_speed, double max_speed);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern void nhm_set_pid(double p, double i, double d);
+ [DllImport(dll, CallingConvention = CallingConvention.StdCall)]
+ public static extern void nhm_set_reversed(bool reversed);
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/PidController.cs b/src/NHM.DeviceMonitoring/PidController.cs
new file mode 100644
index 000000000..bada0d1a3
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/PidController.cs
@@ -0,0 +1,39 @@
+using NHM.DeviceMonitoring.PID;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring
+{
+ public class PidController
+ {
+
+ public double GetOutput(double temp, double setpoint)
+ {
+ var fan_speed = 0.0;
+ fan_speed = PID_CONTROLLER.nhm_pid_get_output(temp, setpoint);
+ return fan_speed;
+ }
+
+ public void SetOutputLimit(double max_fan_speed)
+ {
+ PID_CONTROLLER.nhm_set_output_limit(max_fan_speed);
+ }
+
+ public void SetOutputLimits(double min_speed, double max_speed)
+ {
+ PID_CONTROLLER.nhm_set_output_limits(min_speed, max_speed);
+ }
+
+ public void SetPid(double p, double i, double d)
+ {
+ PID_CONTROLLER.nhm_set_pid(p, i, d);
+ }
+ public void SetReversed(bool reversed)
+ {
+ PID_CONTROLLER.nhm_set_reversed(reversed);
+ }
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/Properties/AssemblyInfo.cs b/src/NHM.DeviceMonitoring/Properties/AssemblyInfo.cs
index 1f8c5c2a6..98460167c 100644
--- a/src/NHM.DeviceMonitoring/Properties/AssemblyInfo.cs
+++ b/src/NHM.DeviceMonitoring/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.1.0.4")]
-[assembly: AssemblyFileVersion("3.1.0.4")]
+[assembly: AssemblyVersion("3.1.1.6")]
+[assembly: AssemblyFileVersion("3.1.1.6")]
diff --git a/src/NHM.DeviceMonitoring/TDP/ITDP.cs b/src/NHM.DeviceMonitoring/TDP/ITDP.cs
index 65aea56dc..0142c3a58 100644
--- a/src/NHM.DeviceMonitoring/TDP/ITDP.cs
+++ b/src/NHM.DeviceMonitoring/TDP/ITDP.cs
@@ -6,8 +6,7 @@ public interface ITDP
TDPSettingType SettingType { get; set; }
double TDPPercentage { get; }
- bool SetTDPPercentage(double percentage);
-
+ bool SetTDP(double percentage);
TDPSimpleType TDPSimple { get; }
bool SetTDPSimple(TDPSimpleType level);
}
diff --git a/src/NHM.DeviceMonitoring/TDP/ITDPLimits.cs b/src/NHM.DeviceMonitoring/TDP/ITDPLimits.cs
new file mode 100644
index 000000000..e0e8ab284
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/TDP/ITDPLimits.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.TDP
+{
+ public interface ITDPLimits
+ {
+ (bool ok, int min, int max, int def) GetTDPLimits();
+ }
+}
diff --git a/src/NHM.DeviceMonitoring/TDP/ITDPWatts.cs b/src/NHM.DeviceMonitoring/TDP/ITDPWatts.cs
new file mode 100644
index 000000000..e65415751
--- /dev/null
+++ b/src/NHM.DeviceMonitoring/TDP/ITDPWatts.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHM.DeviceMonitoring.TDP
+{
+ public interface ITDPWatts
+ {
+ int TDPWatts { get; }
+ }
+}
diff --git a/src/NHM.MinerPluginToolkitV1/Checkers.cs b/src/NHM.MinerPluginToolkitV1/Checkers.cs
index 072906454..5d1d77443 100644
--- a/src/NHM.MinerPluginToolkitV1/Checkers.cs
+++ b/src/NHM.MinerPluginToolkitV1/Checkers.cs
@@ -36,7 +36,7 @@ public static bool IsGcn2(AMDDevice dev)
return false;
}
- private static int[] _supportedMajorVersions = new int[] { 19 };
+ private static int[] _supportedMajorVersions = new int[] { 24, 25 };
public static int GetLatestSupportedVersion => _supportedMajorVersions.Max();
public static IEnumerable SupportedMajorVersions => _supportedMajorVersions;
public static bool IsMajorVersionSupported(int major) => _supportedMajorVersions.Contains(major);
@@ -62,6 +62,15 @@ public static bool IsGcn2(AMDDevice dev)
"3d4e56b0-7238-11e9-b20c-f9f12eb6d835",
"4aec5ec0-10f8-11ea-bad3-8dea21141bbb",
"5532d300-7238-11e9-b20c-f9f12eb6d835",
+ "eda6abd0-94eb-11ea-a64d-17be303ea466",
+ "03f80500-94ec-11ea-a64d-17be303ea466",
+ "074d4a80-94ec-11ea-a64d-17be303ea466",
+ "0a07d6a0-94ec-11ea-a64d-17be303ea466",
+ "1484c660-94ec-11ea-a64d-17be303ea466",
+ "01177a50-94ec-11ea-a64d-17be303ea466",
+ "fa369d10-94eb-11ea-a64d-17be303ea466",
+ "e7a58030-94eb-11ea-a64d-17be303ea466",
+ "fd45fff0-94eb-11ea-a64d-17be303ea466",
};
}
}
diff --git a/src/NHM.MinerPluginToolkitV1/Configs/PluginSupportedAlgorithmsSettings.cs b/src/NHM.MinerPluginToolkitV1/Configs/PluginSupportedAlgorithmsSettings.cs
index 55bbc1869..3fa6a7dfe 100644
--- a/src/NHM.MinerPluginToolkitV1/Configs/PluginSupportedAlgorithmsSettings.cs
+++ b/src/NHM.MinerPluginToolkitV1/Configs/PluginSupportedAlgorithmsSettings.cs
@@ -28,7 +28,7 @@ public class PluginSupportedAlgorithmsSettings : IInternalSetting
public Dictionary> Algorithms { get; set; } = null;
// for single algos
- [Obsolete("UNUSED", false)]
+ //[Obsolete("UNUSED", false)]
[JsonProperty("plugin_algorithm_name")]
public Dictionary AlgorithmNames { get; set; } = null;
diff --git a/src/NHM.MinerPluginToolkitV1/PluginBase.cs b/src/NHM.MinerPluginToolkitV1/PluginBase.cs
index b3f5e64c9..a1f6331b8 100644
--- a/src/NHM.MinerPluginToolkitV1/PluginBase.cs
+++ b/src/NHM.MinerPluginToolkitV1/PluginBase.cs
@@ -167,7 +167,7 @@ public virtual bool UnsafeLimits()
public virtual Dictionary> SupportedDevicesAlgorithmsDict()
{
- DeviceType[] deviceTypes = new DeviceType[] { DeviceType.CPU, DeviceType.AMD, DeviceType.NVIDIA };
+ DeviceType[] deviceTypes = new DeviceType[] { DeviceType.CPU, DeviceType.AMD, DeviceType.NVIDIA, DeviceType.INTEL };
var ret = new Dictionary> { };
foreach (var deviceType in deviceTypes)
{
diff --git a/src/NHM.MinersDownloader/Properties/AssemblyInfo.cs b/src/NHM.MinersDownloader/Properties/AssemblyInfo.cs
index 797030524..abc880d0b 100644
--- a/src/NHM.MinersDownloader/Properties/AssemblyInfo.cs
+++ b/src/NHM.MinersDownloader/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.1.0.4")]
-[assembly: AssemblyFileVersion("3.1.0.4")]
+[assembly: AssemblyVersion("3.1.1.6")]
+[assembly: AssemblyFileVersion("3.1.1.6")]
diff --git a/src/NHM.UUID/Properties/AssemblyInfo.cs b/src/NHM.UUID/Properties/AssemblyInfo.cs
index 1a909502d..8958b7352 100644
--- a/src/NHM.UUID/Properties/AssemblyInfo.cs
+++ b/src/NHM.UUID/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.1.0.4")]
-[assembly: AssemblyFileVersion("3.1.0.4")]
+[assembly: AssemblyVersion("3.1.1.6")]
+[assembly: AssemblyFileVersion("3.1.1.6")]
diff --git a/src/NHMCore/ApplicationState/BenchmarkManagerState.cs b/src/NHMCore/ApplicationState/BenchmarkManagerState.cs
index 53c22d990..0426b039e 100644
--- a/src/NHMCore/ApplicationState/BenchmarkManagerState.cs
+++ b/src/NHMCore/ApplicationState/BenchmarkManagerState.cs
@@ -56,6 +56,7 @@ private void SetStatus(AlgorithmContainer algorithmContainer)
var anyToBench = _algorithmsBenchmarksStates.Where(benchStatus => benchStatus.Key.Contains(algorithmContainer.ComputeDevice.Uuid)).Where(pair => pair.Value).Count();
_deviceCanStartBenchmarkingStates[algorithmContainer.ComputeDevice.Uuid] = algorithmContainer.ComputeDevice.State == DeviceState.Stopped && anyToBench > 0;
OnPropertyChanged(nameof(CanStartBenchmarking));
+ OnPropertyChanged(nameof(StartEnabled));
}
}
@@ -134,6 +135,19 @@ public bool CanStart
lock (_lock) return _canStartCount > 0;
}
}
+ private bool _startEnabled = true;
+ public bool StartEnabled
+ {
+ get
+ {
+ lock (_lock) return _startEnabled;
+ }
+ set
+ {
+ lock(_lock) _startEnabled = value;
+ OnPropertyChanged(nameof(StartEnabled));
+ }
+ }
public bool CanStartBenchmarking
{
@@ -171,6 +185,7 @@ internal void RemoveAlgorithmContainer(AlgorithmContainer algorithmContainer)
var anyToBench = _algorithmsBenchmarksStates.Where(benchStatus => benchStatus.Key.Contains(algorithmContainer.ComputeDevice.Uuid)).Where(pair => pair.Value).Count();
_deviceCanStartBenchmarkingStates[algorithmContainer.ComputeDevice.Uuid] = algorithmContainer.ComputeDevice.State == DeviceState.Stopped && anyToBench > 0;
OnPropertyChanged(nameof(CanStartBenchmarking));
+ OnPropertyChanged(nameof(StartEnabled));
}
}
diff --git a/src/NHMCore/ApplicationState/MiningState.cs b/src/NHMCore/ApplicationState/MiningState.cs
index 74d9ab7e0..74944ef29 100644
--- a/src/NHMCore/ApplicationState/MiningState.cs
+++ b/src/NHMCore/ApplicationState/MiningState.cs
@@ -17,6 +17,11 @@ private MiningState()
_intProps = new NotifyPropertyChangedHelper(OnPropertyChanged);
IsDemoMining = false;
IsCurrentlyMining = false;
+ IsCurrentlyMiningOrELPFromRigManager = IsCurrentlyMining ||
+ AvailableDevices.Devices
+ .SelectMany(d => d.AlgorithmSettings)
+ .Any(a => a.ActiveELPProfile != null || a.ActiveELPTestProfile != null);
+ IsNotRunningOrELP = !IsCurrentlyMiningOrELPFromRigManager;
}
// auto properties don't trigger NotifyPropertyChanged so add this shitty boilerplate
@@ -65,7 +70,19 @@ public bool IsCurrentlyMining
get => _boolProps.Get(nameof(IsCurrentlyMining));
private set => _boolProps.Set(nameof(IsCurrentlyMining), value);
}
+#if NHMWS4
+ public bool IsCurrentlyMiningOrELPFromRigManager
+ {
+ get => _boolProps.Get(nameof(IsCurrentlyMiningOrELPFromRigManager));
+ private set => _boolProps.Set(nameof(IsCurrentlyMiningOrELPFromRigManager), value);
+ }
+ public bool IsNotRunningOrELP
+ {
+ get => _boolProps.Get(nameof(IsNotRunningOrELP));
+ private set => _boolProps.Set(nameof(IsNotRunningOrELP), value);
+ }
+#endif
#region DeviceState Counts
public int StoppedDeviceStateCount
{
@@ -108,7 +125,7 @@ public void CalculateDevicesStateChange()
// DeviceState Counts
StoppedDeviceStateCount = AvailableDevices.Devices.Count(dev => dev.State == DeviceState.Stopped);
#if NHMWS4
- MiningDeviceStateCount = AvailableDevices.Devices.Count(dev => dev.State == DeviceState.Mining || dev.State == DeviceState.Gaming);
+ MiningDeviceStateCount = AvailableDevices.Devices.Count(dev => dev.State == DeviceState.Mining || dev.State == DeviceState.Testing);
#else
MiningDeviceStateCount = AvailableDevices.Devices.Count(dev => dev.State == DeviceState.Mining);
#endif
@@ -121,12 +138,19 @@ public void CalculateDevicesStateChange()
AnyDeviceEnabled = AvailableDevices.Devices.Any(dev => dev.Enabled);
AnyDeviceStopped = AvailableDevices.Devices.Any(dev => dev.State == DeviceState.Stopped && (dev.State != DeviceState.Disabled));
#if NHMWS4
- AnyDeviceRunning = AvailableDevices.Devices.Any(dev => dev.State == DeviceState.Mining || dev.State == DeviceState.Benchmarking || dev.State == DeviceState.Gaming);
+ AnyDeviceRunning = AvailableDevices.Devices.Any(dev => dev.State == DeviceState.Mining || dev.State == DeviceState.Benchmarking || dev.State == DeviceState.Testing);
#else
AnyDeviceRunning = AvailableDevices.Devices.Any(dev => dev.State == DeviceState.Mining || dev.State == DeviceState.Benchmarking);
#endif
IsNotBenchmarkingOrMining = !AnyDeviceRunning;
IsCurrentlyMining = AnyDeviceRunning;
+#if NHMWS4
+ IsCurrentlyMiningOrELPFromRigManager = IsCurrentlyMining ||
+ AvailableDevices.Devices
+ .SelectMany(d => d.AlgorithmSettings)
+ .Any(a => a.ActiveELPProfile != null || a.ActiveELPTestProfile != null);
+ IsNotRunningOrELP = !IsCurrentlyMiningOrELPFromRigManager;
+#endif
IsDemoMining = !CredentialsSettings.Instance.IsBitcoinAddressValid && IsCurrentlyMining;
if (IsNotBenchmarkingOrMining) MiningManuallyStarted = false;
}
diff --git a/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Devices.cs b/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Devices.cs
index 86a66e290..7be705417 100644
--- a/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Devices.cs
+++ b/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Devices.cs
@@ -26,38 +26,40 @@ public static async Task SetDeviceEnabledState(object sender, (string uuid, bool
// TODO log sender
var isAllDevices = "*" == uuid;
var devicesToSet = isAllDevices ? AvailableDevices.Devices : new ComputeDevice[] { AvailableDevices.GetDeviceWithUuidOrB64Uuid(uuid) };
-
+ bool startMiningViaToggleCondition = false;
var tasks = devicesToSet
.Where(dev => dev != null)
.Distinct()
.Select(dev => SetDeviceEnabledState(dev, enabled))
.ToArray();
-
- var thisDevice = AvailableDevices.GetDeviceWithUuidOrB64Uuid(uuid);
- var isAnyOtherDeviceMining = AvailableDevices.Devices?.Where(d => d.Enabled)?
- .SelectMany(d => d.AlgorithmSettings)?
- .Where(a => a.ComputeDevice.B64Uuid != thisDevice.B64Uuid)?
- .Any(a => a.IsCurrentlyMining);
- var isThisDeviceMining = thisDevice.AlgorithmSettings?.Any(a => a.IsCurrentlyMining);
- if (isAnyOtherDeviceMining != null && isThisDeviceMining != null) //when mining and stop by toggle, this device mining is false...
+ foreach(var devUuid in devicesToSet.Select(d => d.Uuid))
{
- if (enabled)
+ var thisDevice = AvailableDevices.GetDeviceWithUuidOrB64Uuid(devUuid);
+ var isAnyOtherDeviceMining = AvailableDevices.Devices?.Where(d => d.Enabled)?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .Where(a => a.ComputeDevice.B64Uuid != thisDevice.B64Uuid)?
+ .Any(a => a.IsCurrentlyMining);
+ var isThisDeviceMining = thisDevice.AlgorithmSettings?.Any(a => a.IsCurrentlyMining);
+ if (isAnyOtherDeviceMining != null && isThisDeviceMining != null) //when mining and stop by toggle, this device mining is false...
{
- if ((bool)!isThisDeviceMining && !(bool)isAnyOtherDeviceMining && MiningState.Instance.MiningStoppedByToggle)
+ if (enabled)
{
- MiningState.Instance.MiningStoppedByToggle = false;
- _ = StartAllAvailableDevicesTask();
+ if ((bool)!isThisDeviceMining && !(bool)isAnyOtherDeviceMining && MiningState.Instance.MiningStoppedByToggle)
+ {
+ MiningState.Instance.MiningStoppedByToggle = false;
+ startMiningViaToggleCondition = true;
+ }
}
- }
- else
- {
- if ((bool)isThisDeviceMining && !(bool)isAnyOtherDeviceMining) //todo check if this device not mining by now
+ else
{
- MiningState.Instance.MiningStoppedByToggle = true;
+ if ((bool)isThisDeviceMining && !(bool)isAnyOtherDeviceMining) //todo check if this device not mining by now
+ {
+ MiningState.Instance.MiningStoppedByToggle = true;
+ }
}
}
}
-
+ if(startMiningViaToggleCondition) _ = StartAllAvailableDevicesTask();
// await tasks
await Task.WhenAll(tasks);
}
diff --git a/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Init.cs b/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Init.cs
index c88c3863d..7c4f1b8e5 100644
--- a/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Init.cs
+++ b/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Init.cs
@@ -6,6 +6,7 @@
using NHM.DeviceMonitoring;
using NHMCore.ApplicationState;
using NHMCore.Configs;
+using NHMCore.Configs.Managers;
using NHMCore.Mining;
using NHMCore.Mining.Plugins;
using NHMCore.Nhmws;
@@ -13,6 +14,7 @@
using NHMCore.Schedules;
using NHMCore.Utils;
using System;
+using System.IO;
using System.Linq;
using System.Threading.Tasks;
using static NHMCore.Translations;
@@ -21,7 +23,7 @@ namespace NHMCore
{
static partial class ApplicationStateManager
{
- private static bool isInitFinished = false;
+ public static bool isInitFinished = false;
private class LoaderConverter : IStartupLoader
{
@@ -54,6 +56,9 @@ int nextProgPerc()
if (perc > 100) return 100;
return perc;
};
+#if NHMWS4
+ EventManager.Instance.Init();
+#endif
NotificationsManager.Instance.ReadLoggedNotifications();
// STEP
// Checking System Memory
@@ -72,6 +77,7 @@ string detectionStepMessage(DeviceDetectionStep step)
DeviceDetectionStep.CPU => Tr("Checking CPU Info"),
DeviceDetectionStep.NVIDIA_CUDA => Tr("Querying CUDA devices"),
DeviceDetectionStep.AMD_OpenCL => Tr("Checking AMD OpenCL GPUs"),
+ DeviceDetectionStep.INTEL_GPU => Tr("Checking Intel GPUs"),
_ => Tr("Checking Windows Video Controllers"), //DeviceDetectionStep.WMIWMIVideoControllers
};
};
@@ -80,7 +86,7 @@ string detectionStepMessage(DeviceDetectionStep step)
var msg = detectionStepMessage(step);
loader.PrimaryProgress?.Report((msg, nextProgPerc()));
});
- await DeviceDetection.DetectDevices(devDetectionProgress);
+ await DeviceDetection.DetectDevices(MiscSettings.Instance.DetectIntegratedDevices, devDetectionProgress);
if(DeviceDetection.DetectionResult.CUDADevices.Any(dev => dev.IsLHR) && !Helpers.IsElevated && CUDADevice.INSTALLED_NVIDIA_DRIVERS < new Version(522, 25))
{
AvailableNotifications.CreateLHRPresentAdminRunRequired();
@@ -97,6 +103,7 @@ string getDeviceNameCount(DeviceType deviceType, int index) =>
DeviceType.CPU => $"CPU#{index}",
DeviceType.AMD => $"AMD#{index}",
DeviceType.NVIDIA => $"GPU#{index}",
+ DeviceType.INTEL => $"INTEL#{index}",
_ => $"UNKNOWN#{index}",
};
@@ -109,7 +116,7 @@ string getDeviceNameCount(DeviceType deviceType, int index) =>
AvailableDevices.UncheckCpuIfGpu();
- var ramCheckOK = SystemSpecs.CheckRam(AvailableDevices.AvailGpus, AvailableDevices.AvailNvidiaGpuRam, AvailableDevices.AvailAmdGpuRam);
+ var ramCheckOK = SystemSpecs.CheckRam(AvailableDevices.AvailGpus, AvailableDevices.AvailNvidiaGpuRam, AvailableDevices.AvailAmdGpuRam, AvailableDevices.AvailIntelGpuRam);
if (!ramCheckOK)
{
AvailableNotifications.CreateIncreaseVirtualMemoryInfo();
@@ -148,7 +155,7 @@ string getDeviceNameCount(DeviceType deviceType, int index) =>
// now init device settings
ConfigManager.InitDeviceSettings();
- if (!Helpers.IsElevated && !GlobalDeviceSettings.Instance.DisableDevicePowerModeSettings && AvailableDevices.HasNvidia)
+ if (!Helpers.IsElevated && AvailableDevices.HasNvidia)
{
AvailableNotifications.CreateDeviceMonitoringNvidiaElevateInfo();
}
@@ -177,7 +184,7 @@ string getDeviceNameCount(DeviceType deviceType, int index) =>
/////////////////////////////////////////////
/////// from here on we have our devices and Miners initialized
MiningState.Instance.CalculateDevicesStateChange();
-
+ SchedulesManager.Instance.Init();
// STEP
// connect to nhmws
loader.PrimaryProgress?.Report((Tr("Connecting to nhmws..."), nextProgPerc()));
@@ -235,20 +242,20 @@ string getDeviceNameCount(DeviceType deviceType, int index) =>
// Detected devices cross reference with miner indexes
await MinerPluginsManager.DevicesCrossReferenceIDsWithMinerIndexes(loader);
if (btc != NHMRegistry.Get_QM_MiningaddressFromRegistry() && Helpers.IsElevated && CredentialValidators.ValidateBitcoinAddress(btc)) NHMRegistry.Set_QM_MiningaddressFromRegistry(btc);
- if (AvailableDevices.HasGpuToPause)
- {
- var deviceToPauseUuid = AvailableDevices.Devices.FirstOrDefault(dev => dev.PauseMiningWhenGamingMode && dev.DeviceType != DeviceType.CPU).Uuid;
- MiningSettings.Instance.DeviceIndex = AvailableDevices.GetDeviceIndexFromUuid(deviceToPauseUuid);
- }
- else if (MiningSettings.Instance.DeviceToPauseUuid != "")
- {
- MiningSettings.Instance.DeviceIndex = AvailableDevices.GetDeviceIndexFromUuid(MiningSettings.Instance.DeviceToPauseUuid);
- AvailableDevices.GPUs.FirstOrDefault(dev => dev.Uuid == MiningSettings.Instance.DeviceToPauseUuid).PauseMiningWhenGamingMode = true;
- }
+ //if (AvailableDevices.HasGpuToPause)
+ //{
+ // var deviceToPauseUuid = AvailableDevices.Devices.FirstOrDefault(dev => dev.PauseMiningWhenGamingMode && dev.DeviceType != DeviceType.CPU).Uuid;
+ // MiningSettings.Instance.DeviceIndex = AvailableDevices.GetDeviceIndexFromUuid(deviceToPauseUuid);
+ //}
+ //else if (MiningSettings.Instance.DeviceToPauseUuid != "")
+ //{
+ // MiningSettings.Instance.DeviceIndex = AvailableDevices.GetDeviceIndexFromUuid(MiningSettings.Instance.DeviceToPauseUuid);
+ // AvailableDevices.GPUs.FirstOrDefault(dev => dev.Uuid == MiningSettings.Instance.DeviceToPauseUuid).PauseMiningWhenGamingMode = true;
+ //}
else if (AvailableDevices.HasGpu)
{
MiningSettings.Instance.DeviceIndex = 0;
- AvailableDevices.GPUs.FirstOrDefault().PauseMiningWhenGamingMode = true;
+ //AvailableDevices.GPUs.FirstOrDefault().PauseMiningWhenGamingMode = true;
}
GPUProfileManager.Instance.Init();
if (GPUProfileManager.Instance.SystemContainsSupportedDevicesNotSystemElevated)
@@ -256,12 +263,24 @@ string getDeviceNameCount(DeviceType deviceType, int index) =>
if (MiscSettings.Instance.UseOptimizationProfiles) AvailableNotifications.CreateOptimizationProfileElevateInfo();
else AvailableNotifications.CreateOptimizationProfileNotEnabledInfo();
}
-
- SchedulesManager.Instance.Init();
+#if NHMWS4
+ if (!Helpers.IsElevated)
+ {
+ AvailableNotifications.CreateNotAdminForRigManagement();
+ }
+#endif
+ var backupPath = Paths.ConfigsPath(".runOnStartup.txt");
+ if (File.Exists(backupPath))
+ {
+ var value = Helpers.GetRunOnStartupBackupValue();
+ MiscSettings.Instance.RunAtStartup = value;
+ File.Delete(backupPath);
+ }
+ //SchedulesManager.Instance.Init();
}
catch (Exception e)
{
- Logger.Error("ApplicationStateManager.Init", $"Exception: {e.Message}");
+ Logger.Error("ApplicationStateManager.Init", $"Exception: {e.Message} \n TRACE:{e.StackTrace}");
}
finally
{
diff --git a/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Mining.cs b/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Mining.cs
index ace358fe5..728f4db58 100644
--- a/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Mining.cs
+++ b/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Mining.cs
@@ -2,7 +2,11 @@
using NHM.Common.Configs;
using NHM.Common.Enums;
using NHMCore.ApplicationState;
+using NHMCore.Configs;
using NHMCore.Mining;
+using NHMCore.Nhmws;
+using NHMCore.Notifications;
+using NHMCore.Utils;
using System;
using System.Collections.Generic;
using System.IO;
@@ -18,6 +22,7 @@ static partial class ApplicationStateManager
// TODO add check for any enabled algorithms
public static async Task<(bool started, string failReason)> StartAllAvailableDevicesTask()
{
+ EventManager.Instance.AddEventRigStarted(true);
MiningState.Instance.MiningStoppedByToggle = false;
// TODO consider trying to start the error state devices as well
var devicesToStart = AvailableDevices.Devices.Where(dev => dev.State == DeviceState.Stopped);
@@ -69,12 +74,16 @@ static partial class ApplicationStateManager
device.State = DeviceState.Error;
started = false;
failReason = "Cannot start a device with all disabled algoirhtms";
+ Logger.Error("ApplicationStateManager", $"{device.Name} is in error state due to all algos being disabled");
+ EventManager.Instance.AddEventDeviceError(device.Name, device.B64Uuid);
}
else if (isAllZeroPayingState && !needBenchmarkOrRebench)
{
device.State = DeviceState.Error;
started = false;
failReason = "No enabled algorithm is profitable";
+ Logger.Error("ApplicationStateManager", $"{device.Name} is in error state due to isAllZeroPayingState && !needBenchmarkOrRebench");
+ EventManager.Instance.AddEventDeviceError(device.Name, device.B64Uuid);
}
else
{
@@ -86,8 +95,13 @@ static partial class ApplicationStateManager
public static async Task<(bool stopped, string failReason)> StopAllDevicesTask()
{
+ EventManager.Instance.AddEventRigStopped(true);
// TODO when starting and stopping we are not taking Pending and Error states into account
+#if NHMWS4
+ var devicesToStop = AvailableDevices.Devices.Where(dev => dev.State == DeviceState.Mining || dev.State == DeviceState.Benchmarking || dev.State == DeviceState.Testing);
+#else
var devicesToStop = AvailableDevices.Devices.Where(dev => dev.State == DeviceState.Mining || dev.State == DeviceState.Benchmarking);
+#endif
if (devicesToStop.Count() == 0)
{
return (false, "No new devices to stop");
@@ -121,7 +135,16 @@ static partial class ApplicationStateManager
return (false, $"Device {device.Uuid} already stopped");
case DeviceState.Mining:
case DeviceState.Benchmarking:
+#if NHMWS4
+ case DeviceState.Testing:
+#endif
await MiningManager.StopDevice(device);
+#if NHMWS4
+ if (Helpers.IsElevated)
+ {
+ device.ResetEverything();
+ }
+#endif
return (true, "");
default:
return (false, $"Cannot handle state {device.State} for device {device.Uuid}");
@@ -149,7 +172,40 @@ public static void StartBenchmark()
.ToArray();
_ = Task.WhenAll(startBenchmarkingDevices);
}
-
+ public static Task<(ErrorCode err, string msg)> StartReBenchmark()
+ {
+ //check if any exist
+ var startBenchmarkingDevices = AvailableDevices.Devices
+ .Where(device => device.State == DeviceState.Stopped)?
+ .Where(device => device.AnyAlgorithmEnabled());
+ if(startBenchmarkingDevices == null || startBenchmarkingDevices.Count() == 0)
+ {
+ return Task.FromResult((ErrorCode.ErrNoAlgoDataFound, "No targets found. Stop mining first."));
+ }
+ foreach (var device in startBenchmarkingDevices) device.PrepareForRebenchmark();
+ var completeBenchmarkDevices = startBenchmarkingDevices
+ .Select(StartDeviceTask)
+ .ToArray();
+ _ = Task.WhenAll(completeBenchmarkDevices);
+ return Task.FromResult((ErrorCode.NoError, "Success"));
+ }
+ public static Task<(ErrorCode err, string msg)> StartRebenchmarkSpecific(string deviceUUID)
+ {
+ var startBenchmarkingDevices = AvailableDevices.Devices
+ .Where(device => device.B64Uuid == deviceUUID)?
+ .Where(device => device.State == DeviceState.Stopped)?
+ .Where(device => device.AnyAlgorithmEnabled());
+ if (startBenchmarkingDevices == null || startBenchmarkingDevices.Count() == 0)
+ {
+ return Task.FromResult((ErrorCode.ErrNoAlgoDataFound, "No targets found. Stop mining first."));
+ }
+ foreach (var device in startBenchmarkingDevices) device.PrepareForRebenchmark();
+ var completeBenchmarkDevices = startBenchmarkingDevices
+ .Select(StartDeviceTask)
+ .ToArray();
+ _ = Task.WhenAll(completeBenchmarkDevices);
+ return Task.FromResult((ErrorCode.NoError, "Success"));
+ }
public static Task StopBenchmark()
{
var stoptDevices = AvailableDevices.Devices
@@ -159,14 +215,17 @@ public static Task StopBenchmark()
return Task.WhenAll(stoptDevices);
}
- #region Updater mining state save/restore
+#region Updater mining state save/restore
private static string _miningStateFilePath => Paths.InternalsPath("DeviceRestoreStates.json");
private struct DeviceRestoreState
{
public bool IsStarted { get; set; }
public DeviceState LastState { get; set; }
-
+#if NHMWS4
+ public bool ShouldStart() => IsStarted || LastState == DeviceState.Benchmarking || LastState == DeviceState.Mining || LastState == DeviceState.Testing;
+#else
public bool ShouldStart() => IsStarted || LastState == DeviceState.Benchmarking || LastState == DeviceState.Mining;
+#endif
}
internal static void SaveMiningState()
{
@@ -209,6 +268,6 @@ internal static async Task RestoreMiningState()
await Task.WhenAll(startTasks);
}
- #endregion Update state push/pop
+#endregion Update state push/pop
}
}
diff --git a/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Program.cs b/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Program.cs
index f35c905b1..f84159496 100644
--- a/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Program.cs
+++ b/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Program.cs
@@ -65,6 +65,7 @@ public static async Task BeforeExit()
_beforeExitCalled = true;
try
{
+ DeviceActionsBeforeExit();
// should close websocket
ExitApplication.Cancel();
ConfigManager.GeneralConfigFileCommit();
@@ -83,6 +84,16 @@ public static async Task BeforeExit()
{
}
}
+ private static void DeviceActionsBeforeExit()
+ {
+ if (Helpers.IsElevated)
+ {
+ AvailableDevices.Devices.ToList().ForEach(d => {
+ d.ResetEverything();
+ });
+
+ }
+ }
private static bool _restartCalled = false;
public static async Task RestartProgram()
diff --git a/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Timers.cs b/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Timers.cs
index bdf1273a4..c731f0d94 100644
--- a/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Timers.cs
+++ b/src/NHMCore/ApplicationStateManager/ApplicationStateManager.Timers.cs
@@ -1,6 +1,9 @@
using NHM.Common;
+using NHM.Common.Enums;
using NHM.DeviceDetection;
using NHMCore.Configs;
+using NHMCore.Mining;
+using NHMCore.Nhmws.V4;
using NHMCore.Notifications;
using NHMCore.Utils;
using System;
@@ -73,8 +76,12 @@ private static void StartComputeDevicesCheckTimer()
// this function checks if count of CUDA devices is same as it was on application start, reason for that is
// because of some reason (especially when algo switching occure) CUDA devices are dissapiring from system
// creating tons of problems e.g. miners stop mining, lower rig hashrate etc.
- var hasMissingGPUs = await DeviceDetection.CheckIfMissingGPUs();
- if (!hasMissingGPUs) return;
+ var hasMissingGPUs = await DeviceDetection.CheckIfMissingGPUs(MiscSettings.Instance.DetectIntegratedDevices);
+ if (!hasMissingGPUs.isMissing) return;
+ foreach(var missingItem in hasMissingGPUs.uuids)
+ {
+ EventManager.Instance.AddEventMissingDevice(missingItem);
+ }
if (GlobalDeviceSettings.Instance.RestartMachineOnLostGPU)
{
Logger.Info("ApplicationStateManager.Timers", $"Detected missing GPUs will execute 'OnGPUsLost.bat'");
@@ -138,5 +145,50 @@ public static void StopInternetCheckTimer()
}
#endregion InternetCheck timer
+
+ #region FanProfile timer
+ private static AppTimer _fanProfileTimer;
+
+ public static void StartFanProfileTimer()
+ {
+ if (_fanProfileTimer?.IsActive ?? false) return;
+ _fanProfileTimer = new AppTimer((object sender, ElapsedEventArgs e) =>
+ {
+ var devices = AvailableDevices.GPUs;
+ foreach (var device in devices) device.SetFanSpeedWithPidController();
+ },5000);
+ _fanProfileTimer.Start();
+ }
+
+ public static void StopFanProfileTimer()
+ {
+ _fanProfileTimer?.Stop();
+ }
+ #endregion
+
+ #region DeviceTimer
+ private static AppTimer _deviceTimer;
+
+ public static void StartDeviceCheckTimer()
+ {
+ if (_deviceTimer?.IsActive ?? false) return;
+ _deviceTimer = new AppTimer((object sender, ElapsedEventArgs e) =>
+ {
+ var devs = AvailableDevices.Devices.SortedDevices();
+ foreach (var d in devs)
+ {
+ if (d.DeviceType != DeviceType.CPU)
+ NhmwsOverheatDetector.Instance.UpdateTempsAndWarnIfNeeded(d.ID, d.Name, d.B64Uuid, (int)d.Temp, d.VramTemperature);
+ else
+ NhmwsOverheatDetector.Instance.UpdateCPUTempsAndWarnIfNeeded(d.ID, d.Name, d.B64Uuid, (int)d.Temp);
+ }
+ }, 30000);
+ _deviceTimer.Start();
+ }
+ public static void StopDeviceCheckTimer()
+ {
+ _deviceTimer?.Stop();
+ }
+ #endregion
}
}
diff --git a/src/NHMCore/ApplicationStateManager/ApplicationStateManager.cs b/src/NHMCore/ApplicationStateManager/ApplicationStateManager.cs
index ae3d6f44a..27c4918e9 100644
--- a/src/NHMCore/ApplicationStateManager/ApplicationStateManager.cs
+++ b/src/NHMCore/ApplicationStateManager/ApplicationStateManager.cs
@@ -37,7 +37,7 @@ public static void SetNhmwsConnectionChanged(bool isConnected)
});
}
-
+ public static void ReSendLoginMessage() => ResetNiceHashStatsCredentials();
static void ResetNiceHashStatsCredentials()
{
if (CredentialsSettings.Instance.IsCredentialValid)
@@ -160,6 +160,10 @@ internal static bool StartMining()
{
StartComputeDevicesCheckTimer();
StartInternetCheckTimer();
+#if NHMWS4
+ StartFanProfileTimer();
+ StartDeviceCheckTimer();
+#endif
return true;
}
@@ -167,6 +171,10 @@ internal static void StopMining()
{
StopComputeDevicesCheckTimer();
StopInternetCheckTimer();
+#if NHMWS4
+ StopFanProfileTimer();
+ StopDeviceCheckTimer();
+#endif
DisplayNoInternetConnection(false); // hide warning
DisplayMiningProfitable(true); // hide warning
}
@@ -196,7 +204,7 @@ public static RigStatus CalcRigStatus()
rigState = RigStatus.Stopped;
}
#if NHMWS4
- var anyMining = allDevs.Any(dev => dev.State == DeviceState.Mining || dev.State == DeviceState.Gaming);
+ var anyMining = allDevs.Any(dev => dev.State == DeviceState.Mining || dev.State == DeviceState.Testing);
#else
var anyMining = allDevs.Any(dev => dev.State == DeviceState.Mining);
#endif
@@ -230,6 +238,8 @@ public static string CalcRigStatusString()
RigStatus.Error => "ERROR",
RigStatus.Pending => "PENDING",
RigStatus.Disabled => "DISABLED",
+ //RigStatus.Gaming => "GAMING",
+ RigStatus.Testing => "TESTING",
_ => "UNKNOWN",
};
}
diff --git a/src/NHMCore/Configs/ConfigManager.cs b/src/NHMCore/Configs/ConfigManager.cs
index 94adad892..658105385 100644
--- a/src/NHMCore/Configs/ConfigManager.cs
+++ b/src/NHMCore/Configs/ConfigManager.cs
@@ -4,6 +4,7 @@
using NHMCore.Configs.Data;
using NHMCore.Mining;
using NHMCore.Mining.Plugins;
+using NHMCore.Notifications;
using NHMCore.Schedules;
using System;
using System.Collections.Generic;
@@ -123,7 +124,7 @@ public static void CreateBackup()
LogToFile = LoggingDebugConsoleSettings.Instance.LogToFile,
LogMaxFileSize = LoggingDebugConsoleSettings.Instance.LogMaxFileSize,
DisableWindowsErrorReporting = WarningSettings.Instance.DisableWindowsErrorReporting,
- DisableDevicePowerModeSettings = GlobalDeviceSettings.Instance.DisableDevicePowerModeSettings,
+ AllowMultipleInstances = MiscSettings.Instance.AllowMultipleInstances,
};
_benchmarkConfigsBackup = new Dictionary();
foreach (var cDev in AvailableDevices.Devices)
@@ -139,14 +140,25 @@ public static bool IsRestartNeeded()
|| LoggingDebugConsoleSettings.Instance.LogToFile != _generalConfigBackup.LogToFile
|| LoggingDebugConsoleSettings.Instance.LogMaxFileSize != _generalConfigBackup.LogMaxFileSize
|| WarningSettings.Instance.DisableWindowsErrorReporting != _generalConfigBackup.DisableWindowsErrorReporting
- || GlobalDeviceSettings.Instance.DisableDevicePowerModeSettings != _generalConfigBackup.DisableDevicePowerModeSettings;
+ || MiscSettings.Instance.AllowMultipleInstances != _generalConfigBackup.AllowMultipleInstances;
}
public static void GeneralConfigFileCommit()
{
ApplicationStateManager.App.Dispatcher.Invoke(() =>
{
- InternalConfigs.WriteFileSettings(GeneralConfigPath, GeneralConfig);
+ var res = InternalConfigs.WriteFileSettings(GeneralConfigPath, GeneralConfig);
+ if (!res)
+ {
+ try
+ {
+ EventManager.Instance.AddEventGeneralCfg();
+ }
+ catch(Exception ex)
+ {
+ Logger.Error("ConfigManager", ex.Message);
+ }
+ }
ShowRestartRequired?.Invoke(null, IsRestartNeeded());
});
}
@@ -227,6 +239,7 @@ private class GeneralConfigBackup
public long LogMaxFileSize { get; set; }
public bool DisableWindowsErrorReporting { get; set; }
public bool DisableDevicePowerModeSettings { get; set; }
+ public bool AllowMultipleInstances { get; set; }
}
public static void SetDefaults()
diff --git a/src/NHMCore/Configs/Data/GeneralConfig.cs b/src/NHMCore/Configs/Data/GeneralConfig.cs
index 8c7a540a5..be48d5f03 100644
--- a/src/NHMCore/Configs/Data/GeneralConfig.cs
+++ b/src/NHMCore/Configs/Data/GeneralConfig.cs
@@ -90,6 +90,26 @@ public bool AdvancedMode
get => MiscSettings.Instance.AdvancedMode;
set => MiscSettings.Instance.AdvancedMode = value;
}
+ public bool SendEvents
+ {
+ get => MiscSettings.Instance.SendEvents;
+ set => MiscSettings.Instance.SendEvents = value;
+ }
+ public bool AutoResetOC
+ {
+ get => MiscSettings.Instance.AutoResetOC;
+ set => MiscSettings.Instance.AutoResetOC = value;
+ }
+ public bool EnableGPUManagement
+ {
+ get => MiscSettings.Instance.EnableGPUManagement;
+ set => MiscSettings.Instance.EnableGPUManagement = value;
+ }
+ public bool DetectIntegratedDevices
+ {
+ get => MiscSettings.Instance.DetectIntegratedDevices;
+ set => MiscSettings.Instance.DetectIntegratedDevices = value;
+ }
#endregion MiningSettings
#region IdleMiningSettings
@@ -328,11 +348,6 @@ public bool DisableDeviceStatusMonitoring
get => GlobalDeviceSettings.Instance.DisableDeviceStatusMonitoring;
set => GlobalDeviceSettings.Instance.DisableDeviceStatusMonitoring = value;
}
- public bool DisableDevicePowerModeSettings
- {
- get => GlobalDeviceSettings.Instance.DisableDevicePowerModeSettings;
- set => GlobalDeviceSettings.Instance.DisableDevicePowerModeSettings = value;
- }
public bool ShowGPUPCIeBusIDs
{
get => GlobalDeviceSettings.Instance.ShowGPUPCIeBusIDs;
@@ -412,12 +427,14 @@ public void SetDefaults()
RunAtStartup = false;
GUIWindowsAlwaysOnTop = false;
DisableDeviceStatusMonitoring = false;
- DisableDevicePowerModeSettings = true;
MineRegardlessOfProfit = true;
AutoUpdateNiceHashMiner2 = false;
AutoUpdateMinerPlugins = true;
AdvancedMode = false;
+ SendEvents = true;
+ AutoResetOC = true;
+ EnableGPUManagement = true;
}
public void SetValues(GeneralConfigOld configOld)
@@ -478,12 +495,14 @@ public void SetValues(GeneralConfigOld configOld)
RunAtStartup = configOld.RunAtStartup;
GUIWindowsAlwaysOnTop = configOld.GUIWindowsAlwaysOnTop;
DisableDeviceStatusMonitoring = configOld.DisableDeviceStatusMonitoring;
- DisableDevicePowerModeSettings = configOld.DisableDevicePowerModeSettings;
MineRegardlessOfProfit = configOld.MineRegardlessOfProfit;
AutoUpdateNiceHashMiner2 = configOld.AutoUpdateNiceHashMiner2;
AutoUpdateMinerPlugins = configOld.AutoUpdateMinerPlugins;
AdvancedMode = false;
+ SendEvents = true;
+ AutoResetOC = true;
+ EnableGPUManagement = true;
}
public void FixSettingBounds()
diff --git a/src/NHMCore/Configs/Data/GeneralConfigOld.cs b/src/NHMCore/Configs/Data/GeneralConfigOld.cs
index 540c17217..527c0c4d6 100644
--- a/src/NHMCore/Configs/Data/GeneralConfigOld.cs
+++ b/src/NHMCore/Configs/Data/GeneralConfigOld.cs
@@ -320,11 +320,6 @@ public bool DisableDeviceStatusMonitoring
get => GlobalDeviceSettings.Instance.DisableDeviceStatusMonitoring;
set => GlobalDeviceSettings.Instance.DisableDeviceStatusMonitoring = value;
}
- public bool DisableDevicePowerModeSettings
- {
- get => GlobalDeviceSettings.Instance.DisableDevicePowerModeSettings;
- set => GlobalDeviceSettings.Instance.DisableDevicePowerModeSettings = value;
- }
public bool ShowGPUPCIeBusIDs
{
get => GlobalDeviceSettings.Instance.ShowGPUPCIeBusIDs;
diff --git a/src/NHMCore/Configs/ELPDataModels/AlgoELPData.cs b/src/NHMCore/Configs/ELPDataModels/AlgoELPData.cs
index 6a00c089b..e9ba94cc2 100644
--- a/src/NHMCore/Configs/ELPDataModels/AlgoELPData.cs
+++ b/src/NHMCore/Configs/ELPDataModels/AlgoELPData.cs
@@ -1,6 +1,6 @@
using NHM.Common;
using NHMCore.ApplicationState;
-using NHMCore.Utils;
+using NHMCore.Configs.Managers;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
diff --git a/src/NHMCore/Configs/ELPDataModels/MinerELPData.cs b/src/NHMCore/Configs/ELPDataModels/MinerELPData.cs
index 044f5ab7e..a7b91085e 100644
--- a/src/NHMCore/Configs/ELPDataModels/MinerELPData.cs
+++ b/src/NHMCore/Configs/ELPDataModels/MinerELPData.cs
@@ -1,7 +1,7 @@
using NHM.Common;
using NHM.MinerPluginToolkitV1.CommandLine;
using NHMCore.ApplicationState;
-using NHMCore.Utils;
+using NHMCore.Configs.Managers;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
diff --git a/src/NHMCore/Configs/GlobalDeviceSettings.cs b/src/NHMCore/Configs/GlobalDeviceSettings.cs
index bdddefe65..137cd2a36 100644
--- a/src/NHMCore/Configs/GlobalDeviceSettings.cs
+++ b/src/NHMCore/Configs/GlobalDeviceSettings.cs
@@ -40,16 +40,6 @@ public bool DisableDeviceStatusMonitoring
}
}
- public bool DisableDevicePowerModeSettings
- {
- get => DeviceMonitorManager.DisableDevicePowerModeSettings;
- set
- {
- DeviceMonitorManager.DisableDevicePowerModeSettings = value;
- OnPropertyChanged(nameof(DisableDevicePowerModeSettings));
- }
- }
-
private bool _showGPUPCIeBusIDs = false;
public bool ShowGPUPCIeBusIDs
{
diff --git a/src/NHMCore/Configs/Managers/BundleManager.cs b/src/NHMCore/Configs/Managers/BundleManager.cs
new file mode 100644
index 000000000..eacffc641
--- /dev/null
+++ b/src/NHMCore/Configs/Managers/BundleManager.cs
@@ -0,0 +1,123 @@
+using Newtonsoft.Json;
+using NHM.Common;
+using NHMCore.ApplicationState;
+using NHMCore.Mining;
+using NHMCore.Nhmws.V4;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHMCore.Configs.Managers
+{
+ public static class BundleManager
+ {
+ private static readonly string _TAG = "BundleManager";
+ private static string BundleName = string.Empty;
+ private static string BundleID = string.Empty;
+ private static string _path = Paths.AppRootPath("bundle.json");
+ public static void SetBundleInfo(string name, string id)
+ {
+ BundleName = name;
+ BundleID = id;
+ }
+ public static (string BundleName, string BundleID) GetBundleInfo()
+ {
+ return (BundleName, BundleID);
+ }
+ public static void ResetBundleInfo()
+ {
+ BundleName = string.Empty;
+ BundleID = string.Empty;
+ try
+ {
+ File.WriteAllText(_path, string.Empty);
+ }
+ catch (Exception e)
+ {
+ Logger.Error(_TAG, e.Message);
+ }
+ }
+ public static void Init()
+ {
+ if (!File.Exists(_path))
+ {
+ File.Create(_path);
+ return;
+ }
+ try
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("BundleManager", "Did not load bundle, Gpu management is disabled");
+ return;
+ }
+ var content = File.ReadAllText(_path);
+ var bundleToApply = JsonConvert.DeserializeObject(content);
+ if(bundleToApply != null)
+ {
+ SetBundleInfo(bundleToApply.Name, bundleToApply.Id);
+ ApplyBundleOnInit(bundleToApply);
+ }
+ }
+ catch(Exception e)
+ {
+ Logger.Error(_TAG, e.Message);
+ File.WriteAllText(_path, string.Empty);
+ }
+ }
+ private static void ApplyBundleOnInit(Bundle bundle)
+ {
+ OCManager.Instance.ApplyOcBundle(bundle.OcBundles);
+ FanManager.Instance.ApplyFanBundle(bundle.FanBundles);
+ ELPManager.Instance.ApplyELPBundle(bundle.ElpBundles);
+ MiningState.Instance.CalculateDevicesStateChange();
+ }
+ public static async Task SaveBundle(Bundle bundle)
+ {
+ var text = JsonConvert.SerializeObject(bundle);//todo not saving
+ await File.AppendAllTextAsync(_path, text);
+ }
+ public static List FindTargetGPUNames(string bundleGPU)
+ {
+ var retGPU = bundleGPU;
+ var potentialTargets = AvailableDevices.Devices.Where(d => d.Name.ToLower().Contains(retGPU.ToLower()));
+ if (potentialTargets == null) return new() { bundleGPU };
+ //order matters
+ if (bundleGPU.ToLower().Contains("laptop gpu"))
+ {
+ return potentialTargets.Where(d => d.Name.ToLower().Contains("laptop gpu")).Select(d => d.Name.ToLower())?.ToList();
+ }
+ if (bundleGPU.ToLower().Contains("ti"))
+ {
+ return potentialTargets.Where(d => d.Name.ToLower().Contains("ti")).Select(d => d.Name.ToLower())?.ToList();
+ }
+ if (bundleGPU.ToLower().Contains("super"))
+ {
+ return potentialTargets.Where(d => d.Name.ToLower().Contains("super")).Select(d => d.Name.ToLower())?.ToList();
+ }
+ if (bundleGPU.ToLower().Contains("xtx"))
+ {
+ return potentialTargets.Where(d => d.Name.ToLower().Contains("xtx")).Select(d => d.Name.ToLower())?.ToList();
+ }
+ if (bundleGPU.ToLower().Contains("xt"))
+ {
+ return potentialTargets.Where(d => d.Name.ToLower().Contains("xt")).Select(d => d.Name.ToLower())?.ToList();
+ }
+ if(bundleGPU.ToLower().Contains("collectors edition"))
+ {
+ return potentialTargets.Where(d => d.Name.ToLower().Contains("collectors edition")).Select(d => d.Name.ToLower())?.ToList();
+ }
+ return potentialTargets.Where(d => !d.Name.ToLower().Contains("laptop gpu") &&
+ !d.Name.ToLower().Contains("ti") &&
+ !d.Name.ToLower().Contains("super") &&
+ !d.Name.ToLower().Contains("xtx") &&
+ !d.Name.ToLower().Contains("xt") &&
+ !d.Name.ToLower().Contains("collectors edition"))
+ .Select(d => d.Name.ToLower())?
+ .ToList();
+ }
+ }
+}
diff --git a/src/NHMCore/Utils/ELPManager.cs b/src/NHMCore/Configs/Managers/ELPManager.cs
similarity index 64%
rename from src/NHMCore/Utils/ELPManager.cs
rename to src/NHMCore/Configs/Managers/ELPManager.cs
index a97c04dd7..e5b1d497b 100644
--- a/src/NHMCore/Utils/ELPManager.cs
+++ b/src/NHMCore/Configs/Managers/ELPManager.cs
@@ -1,22 +1,27 @@
using NHM.Common;
using NHM.Common.Enums;
using NHM.MinerPluginToolkitV1.CommandLine;
+using NHMCore.ApplicationState;
using NHMCore.Configs;
using NHMCore.Configs.ELPDataModels;
using NHMCore.Mining;
+using NHMCore.Nhmws;
+using NHMCore.Nhmws.V4;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
+using System.Threading.Tasks;
using static NHM.MinerPluginToolkitV1.CommandLine.MinerConfigManager;
-namespace NHMCore.Utils
+namespace NHMCore.Configs.Managers
{
public delegate void NotifyELPChangeEventHandler(object sender, EventArgs e);
public class ELPManager
{
private ELPManager() { }
public static ELPManager Instance { get; } = new ELPManager();
+ private readonly string _TAG = "ELPManager";
public event NotifyELPChangeEventHandler ELPReiteration;
const int HEADER = 0;
const int FLAG = 0;
@@ -47,7 +52,7 @@ public MinerConfig CreateDefaultConfig(PluginConfiguration pconf)
defCfg.MinerName = pconf.PluginName;
defCfg.MinerUUID = pconf.PluginUUID;
defCfg.MinerCommands.AddRange(pconf.MinerSpecificCommands);
- Dictionary> algorithmDevicePairs = new();
+ Dictionary> algorithmDevicePairs = new();
foreach (var devAlgoPair in pconf.SupportedDevicesAlgorithms)
{
foreach (var algo in devAlgoPair.Value)
@@ -56,14 +61,14 @@ public MinerConfig CreateDefaultConfig(PluginConfiguration pconf)
var devs = pconf.Devices.Where(dev => dev.deviceType.ToString().Contains(devAlgoPair.Key))?
.Select(dev => new { P = (dev.Uuid, dev.FullName) })?
.Select(p => p.P);
- if(devs != null) algorithmDevicePairs[algo].AddRange(devs);
+ if (devs != null) algorithmDevicePairs[algo].AddRange(devs);
}
}
foreach (var algoPairs in algorithmDevicePairs)
{
- var devicesDict = new Dictionary();
- algoPairs.Value.ForEach(dev => devicesDict.TryAdd(dev.uuid, new Device() { DeviceName = dev.name, Commands = new List>() }));
- defCfg.Algorithms.Add(new Algo() { AlgorithmName = algoPairs.Key, Devices = devicesDict });
+ var devicesDict = new Dictionary();
+ algoPairs.Value.ForEach(dev => devicesDict.TryAdd(dev.uuid, new MinerConfigManager.Device() { DeviceName = dev.name, Commands = new List>() }));
+ defCfg.Algorithms.Add(new MinerConfigManager.Algo() { AlgorithmName = algoPairs.Key, Devices = devicesDict });
}
return defCfg;
}
@@ -103,7 +108,7 @@ public MinerConfig FixConfigIntegrityIfNeeded(MinerConfig data, PluginConfigurat
public void UpdateMinerELPConfig()
{
- foreach(var miner in _minerELPs)
+ foreach (var miner in _minerELPs)
{
var config = ConstructConfigFromMinerELPData(miner);
WriteConfig(config);
@@ -198,9 +203,35 @@ public string FindAppropriateCommandForAlgoContainer(List mi
var selectionGroup = devParams.Where((_, index) => group.Contains(index)).ToList();
deviceParamsGroups.Add(group, selectionGroup);
}
- return MinerExtraParameters.Parse(minerParams, algoParams, deviceParamsGroups.FirstOrDefault().Value.Select(v => v.paramList).ToList());
+ var localPart = MinerExtraParameters.Parse(minerParams, algoParams, deviceParamsGroups.FirstOrDefault().Value.Select(v => v.paramList).ToList());
+ var rigManagerPart = string.Empty;
+ var targetMP = miningPairs.FirstOrDefault();
+ if (targetMP.ActiveELPTestProfile != null)
+ {
+ rigManagerPart = targetMP.ActiveELPTestProfile.Elp;
+ }
+ if(!targetMP.HasTestProfileAndCanSet() && targetMP.ActiveELPProfile != null)
+ {
+ rigManagerPart = targetMP.ActiveELPProfile.Elp;
+ }
+ return $"{localPart} {rigManagerPart}".Trim();
}
+ public void SetAlgoCMDString(AlgorithmContainer ac, string newCMD)
+ {
+ if (ac == null) return;
+ var target = _minerELPs
+ .Where(miner => miner.UUID == ac.MinerUUID)?
+ .FirstOrDefault()?
+ .Algos.Where(algo => algo.Name == ac.AlgorithmName)?
+ .FirstOrDefault();
+ if (target == null) return;
+
+ var index = target.AllCMDStrings.ToList().FindIndex(i => i.uuid == ac.ComputeDevice.Uuid);
+ if (index == -1) return;
+ target.AllCMDStrings.RemoveAt(index);
+ target.AllCMDStrings.Add((ac.ComputeDevice.Uuid, newCMD));
+ }
public MinerELPData ConstructMinerELPDataFromConfig(MinerConfig cfg)
{
var minerELP = new MinerELPData();
@@ -221,12 +252,12 @@ public MinerELPData ConstructMinerELPDataFromConfig(MinerConfig cfg)
.Distinct()?
.ToList();
uniqueFlags?.ForEach(f => tempAlgo.Devices[HEADER].AddELP(f));
- if (!uniqueFlags.Any()) tempAlgo.Devices[HEADER].ELPs.Add(new DeviceELPElement(false) { ELP = String.Empty });
+ if (!uniqueFlags.Any()) tempAlgo.Devices[HEADER].ELPs.Add(new DeviceELPElement(false) { ELP = string.Empty });
tempAlgo.Name = algo.AlgorithmName;
foreach (var dev in algo.Devices)
{
var tempELPElts = new DeviceELPElement[uniqueFlags?.Count + 1 ?? 1];
- tempELPElts[tempELPElts.Length - 1] = new DeviceELPElement() { ELP = String.Empty };
+ tempELPElts[tempELPElts.Length - 1] = new DeviceELPElement() { ELP = string.Empty };
foreach (var arg in dev.Value.Commands)
{
if (arg.Count != 3) continue;
@@ -261,7 +292,7 @@ private MinerConfig ConstructConfigFromMinerELPData(MinerELPData miner)
miner.DoubleParams.ForEach(dbl => minerConfig.MinerCommands.Add(new List() { dbl.name, dbl.value }));
foreach (var algo in miner.Algos)
{
- var tempAlgo = new Algo();
+ var tempAlgo = new MinerConfigManager.Algo();
tempAlgo.AlgorithmName = algo.Name;
if (algo.SingleParams == null) algo.SingleParams = new();
algo.SingleParams.ForEach(single => tempAlgo.AlgoCommands.Add(new List() { single }));
@@ -273,14 +304,14 @@ private MinerConfig ConstructConfigFromMinerELPData(MinerELPData miner)
{
var deviceParams = new List>();
if (dev.IsDeviceDataHeader) continue;
- for (int i = 0; i < dev.ELPs.Count; i++)
+ for (var i = 0; i < dev.ELPs.Count; i++)
{
if (header.ELPs[i] == null || header.ELPs[i].ELP == null) continue;
var flagAndDelim = header.ELPs[i].ELP.Trim().Split(' ');
if (flagAndDelim.Length != 2) continue;
deviceParams.Add(new List { flagAndDelim[0], dev.ELPs[i].ELP, flagAndDelim[1] });
}
- tempAlgo.Devices.Add(dev.UUID, new Device() { DeviceName = dev.DeviceName, Commands = deviceParams });
+ tempAlgo.Devices.Add(dev.UUID, new MinerConfigManager.Device() { DeviceName = dev.DeviceName, Commands = deviceParams });
}
minerConfig.Algorithms.Add(tempAlgo);
}
@@ -306,19 +337,19 @@ private void IterateSubModelsAndConstructELPsForPlugin(MinerELPData miner)
.Select((elp, index) => new { elp, index })
.Where(item => string.IsNullOrEmpty(item.elp.ELP.Trim()))
.FirstOrDefault();
- bool shouldDelete = false;
- if(columnToDelete != null) shouldDelete = columnToDelete.index < header.ELPs.Count - 1;
+ var shouldDelete = false;
+ if (columnToDelete != null) shouldDelete = columnToDelete.index < header.ELPs.Count - 1;
List<(string devUUID, List> paramList)> devParams = new();
if (algo.Devices == null) algo.Devices = new();
foreach (var dev in algo.Devices)
{
if (dev.IsDeviceDataHeader && !string.IsNullOrEmpty(dev.ELPs?.LastOrDefault()?.ELP)) shouldAddnewColumn = true;
- if (shouldAddnewColumn) dev.ELPs.Add(new DeviceELPElement(!dev.IsDeviceDataHeader) { ELP = String.Empty });
+ if (shouldAddnewColumn) dev.ELPs.Add(new DeviceELPElement(!dev.IsDeviceDataHeader) { ELP = string.Empty });
if (header.ELPs == null || dev.ELPs == null) continue;
if (columnToDelete != null && shouldDelete) dev.ELPs.RemoveAt(columnToDelete.index);
if (header.ELPs.Count != dev.ELPs.Count) continue;
List> oneDevParams = new();
- for (int i = 0; i < dev.ELPs.Count; i++)
+ for (var i = 0; i < dev.ELPs.Count; i++)
{
var flagAndDelim = header.ELPs[i].ELP.Trim().Split(' ');
if (flagAndDelim.Length != 2) continue;
@@ -330,24 +361,24 @@ private void IterateSubModelsAndConstructELPsForPlugin(MinerELPData miner)
dev.ConstructedELPs = oneDevParams;
}
Dictionary, List<(string devUUID, List> paramList)>> deviceParamsGroups = new();
- for (int first = 1; first < devParams.Count; first++)
+ for (var first = 1; first < devParams.Count; first++)
{
var isPartOfGroup = deviceParamsGroups.Keys.Any(keys => keys.Contains(first));
if (isPartOfGroup) continue;
var group = new HashSet { first };
- for (int second = first + 1; second < devParams.Count; second++)
+ for (var second = first + 1; second < devParams.Count; second++)
{
if (MinerExtraParameters.CheckIfCanGroup(new List>> { devParams[first].paramList, devParams[second].paramList })) group.Add(second);
}
var selectionGroup = devParams.Where((_, index) => group.Contains(index)).ToList();
- deviceParamsGroups.Add(group, selectionGroup);
+ deviceParamsGroups.Add(group, selectionGroup);
}
var parsedCommandsPerGroup = new List<(string uuid, string command)>();
foreach (var dev in deviceParamsGroups)
{
var uuidList = dev.Value.Select(k => k.devUUID).ToList();
var command = MinerExtraParameters.Parse(minerParams, algoParams, dev.Value.Select(v => v.paramList).ToList());
- foreach(var uuid in uuidList)
+ foreach (var uuid in uuidList)
{
parsedCommandsPerGroup.Add((uuid, command));
}
@@ -355,5 +386,118 @@ private void IterateSubModelsAndConstructELPsForPlugin(MinerELPData miner)
algo.AllCMDStrings = new ObservableCollection<(string uuid, string command)>(parsedCommandsPerGroup);
}
}
+#if NHMWS4
+ public Task<(ErrorCode err, string msg)> ExecuteTest(string uuid, ElpProfile bundle)
+ {
+ if (!MiningState.Instance.AnyDeviceRunning) return Task.FromResult((ErrorCode.ErrNoDeviceRunning, "No devices mining"));
+ var allContainers = AvailableDevices.Devices
+ .Where(d => d.B64Uuid == uuid)?
+ .Where(d => d.State == DeviceState.Mining || d.State == DeviceState.Testing)?
+ .SelectMany(d => d.AlgorithmSettings);
+ if (allContainers == null || !allContainers.Any()) return Task.FromResult((ErrorCode.TargetDeviceNotFound, "No targets found"));
+
+ if (bundle.AlgoId != null && bundle.MinerId != null) allContainers = allContainers.Where(d =>
+ bundle.AlgoId.Contains(d.AlgorithmName.ToLower()) &&
+ bundle.MinerId.Contains(d.PluginName.ToLower()))?.ToList();
+ else if (bundle.AlgoId != null) allContainers = allContainers.Where(d => bundle.AlgoId.Contains(d.AlgorithmName.ToLower()))?.ToList();
+ else if (bundle.MinerId != null) allContainers = allContainers.Where(d => bundle.MinerId.Contains(d.PluginName.ToLower()))?.ToList();
+ if (allContainers == null || !allContainers.Any()) return Task.FromResult((ErrorCode.TargetDeviceNotFound, "Action target mismatch, containers null"));
+ var target = allContainers.Where(c => c.IsCurrentlyMining)?.FirstOrDefault();
+ if (target == null)
+ {
+ target = allContainers.Where(c => c.Enabled)?.FirstOrDefault();
+ if (target == null) return Task.FromResult((ErrorCode.TargetContainerNotFound, "Failed to switch to target algorithm container"));
+ }
+ target.SetTargetElpProfile(bundle, true);
+ MiningManager.TriggerSwitchCheck();
+ return Task.FromResult((ErrorCode.NoError, "Success"));
+ }
+ public Task<(ErrorCode err, string msg)> StopTest(string uuid, bool triggerSwitch)
+ {
+ var targetDeviceContainer = AvailableDevices.Devices
+ .Where(d => d.B64Uuid == uuid)?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .Where(a => a.IsTesting || a.ActiveELPTestProfile != null)?
+ .FirstOrDefault();
+ if (targetDeviceContainer == null)
+ {
+ Logger.Warn(_TAG, "Device not found for stop ELP test");
+ return Task.FromResult((ErrorCode.TargetDeviceNotFound, "Device is not in test mode"));
+ }
+ targetDeviceContainer.SetTargetElpProfile(null, true);
+ if (triggerSwitch) MiningManager.TriggerSwitchCheck();
+ return Task.FromResult((ErrorCode.NoError, "Success"));
+ }
+ public Task<(ErrorCode err, string msg)> ApplyELPBundle(List bundles)
+ {
+ if (bundles == null) return Task.FromResult((ErrorCode.NoError, "ELPBundles == null"));
+ List processed = new();
+ var sorted = new List<(int, ElpProfile)>();
+ foreach (var bundle in bundles)
+ {
+ if (bundle.MinerId != null && bundle.AlgoId != null) sorted.Add((0, bundle));
+ else if (bundle.MinerId == null && bundle.AlgoId != null) sorted.Add((1, bundle));
+ else if (bundle.MinerId != null && bundle.AlgoId == null) sorted.Add((2, bundle));
+ else sorted.Add((3, bundle));
+ }
+ sorted = sorted.OrderBy(item => item.Item1).ToList();
+ foreach (var (type, bundle) in sorted)
+ {
+ var targetList = BundleManager.FindTargetGPUNames(bundle.DeviceName);
+ if (targetList == null) continue;
+ var current = new List();
+ if (type == 0) current = AvailableDevices.Devices
+ .Where(d => targetList.Contains(d.Name.ToLower()))?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .Where(c => bundle.AlgoId.Contains(c.AlgorithmName.ToLower()))?
+ .Where(c => bundle.MinerId.Contains(c.PluginName.ToLower()))?
+ .ToList();
+ else if (type == 1) current = AvailableDevices.Devices
+ .Where(d => targetList.Contains(d.Name.ToLower()))?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .Where(c => bundle.AlgoId.Contains(c.AlgorithmName.ToLower()))?
+ .ToList();
+ else if (type == 2) current = AvailableDevices.Devices
+ .Where(d => targetList.Contains(d.Name.ToLower()))?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .Where(c => bundle.MinerId.Contains(c.PluginName.ToLower()))?
+ .ToList();
+ else current = AvailableDevices.Devices
+ .Where(d => targetList.Contains(d.Name.ToLower()))?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .ToList();
+ if (current == null) continue;
+ current = current.Where(c => !processed.Contains(c)).ToList();
+ processed.AddRange(current);
+ foreach (var container in current)
+ {
+ Logger.Warn(_TAG, $"\t{container.ComputeDevice.ID}-{container.ComputeDevice.Name}/{container.AlgorithmName}/{container.PluginName}");
+ container.SetTargetElpProfile(bundle, false);
+ }
+ }
+ MiningManager.TriggerSwitchCheck();
+ return Task.FromResult((ErrorCode.NoError, "Success"));
+ }
+
+ public Task ResetELPBundle(bool triggerSwitch = true)
+ {
+ var containers = AvailableDevices.Devices.SelectMany(d => d.AlgorithmSettings);
+ foreach (var container in containers)
+ {
+ container.SetTargetElpProfile(null, false);
+ }
+ if (triggerSwitch) MiningManager.TriggerSwitchCheck();
+ return Task.FromResult((ErrorCode.NoError, "Success"));
+ }
+ public void RestartMiningInstanceIfNeeded() //not specific enough, just elp?
+ {
+ var containers = AvailableDevices.Devices.SelectMany(d => d.AlgorithmSettings);
+ foreach (var c in containers)
+ {
+ //if (c.ActiveELPProfile == null && c.ActiveELPTestProfile == null) continue; //WILL NOT WORK
+ c.TriggerELPReset();
+ }
+ }
+#endif
}
}
diff --git a/src/NHMCore/Configs/Managers/FanManager.cs b/src/NHMCore/Configs/Managers/FanManager.cs
new file mode 100644
index 000000000..2a829ff6b
--- /dev/null
+++ b/src/NHMCore/Configs/Managers/FanManager.cs
@@ -0,0 +1,131 @@
+using NHM.Common;
+using NHM.Common.Enums;
+using NHMCore.ApplicationState;
+using NHMCore.Mining;
+using NHMCore.Nhmws;
+using NHMCore.Nhmws.V4;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NHMCore.Configs.Managers
+{
+ public class FanManager
+ {
+ private FanManager() { }
+ public static FanManager Instance { get; } = new FanManager();
+ private readonly string _TAG = "FanManager";
+
+ public enum FanReturn
+ {
+ Success,
+ PartialSuccess,
+ Fail
+ }
+
+ public Task<(ErrorCode err, string msg)> ExecuteTest(string uuid, FanProfile bundle)
+ {
+ if (!MiningState.Instance.AnyDeviceRunning) return Task.FromResult((ErrorCode.ErrNoDeviceRunning, "No devices mining"));
+ var allContainers = AvailableDevices.Devices
+ .Where(d => d.B64Uuid == uuid)?
+ .Where(d => d.State == DeviceState.Mining || d.State == DeviceState.Testing)?
+ .SelectMany(d => d.AlgorithmSettings);
+ if (allContainers == null || !allContainers.Any()) return Task.FromResult((ErrorCode.TargetDeviceNotFound, "No targets found"));
+
+ if (bundle.AlgoId != null && bundle.MinerId != null) allContainers = allContainers.Where(d =>
+ bundle.AlgoId.Contains(d.AlgorithmName) &&
+ bundle.MinerId.Contains(d.PluginName))?.ToList();
+ else if (bundle.AlgoId != null) allContainers = allContainers.Where(d => bundle.AlgoId.Contains(d.AlgorithmName))?.ToList();
+ else if (bundle.MinerId != null) allContainers = allContainers.Where(d => bundle.MinerId.Contains(d.PluginName))?.ToList();
+ if (allContainers == null || !allContainers.Any()) return Task.FromResult((ErrorCode.TargetDeviceNotFound, "Action target mismatch, containers null"));
+ var target = allContainers.Where(c => c.IsCurrentlyMining)?.FirstOrDefault();
+ if (target == null)
+ {
+ target = allContainers.Where(c => c.Enabled)?.FirstOrDefault();
+ if (target == null) return Task.FromResult((ErrorCode.TargetContainerNotFound, "Failed to switch to target algorithm container"));
+ }
+ target.SetTargetFanProfile(bundle, true);
+ MiningManager.TriggerSwitchCheck();
+ return Task.FromResult((ErrorCode.NoError, "Success"));
+ }
+ public Task<(ErrorCode err, string msg)> StopTest(string uuid, bool triggerSwitch)
+ {
+ var targetDeviceContainer = AvailableDevices.Devices
+ .Where(d => d.B64Uuid == uuid)?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .Where(a => a.IsTesting || a.ActiveFanTestProfile != null)?
+ .FirstOrDefault();
+ if (targetDeviceContainer == null)
+ {
+ Logger.Warn(_TAG, "Device not found for stop FAN test");
+ return Task.FromResult((ErrorCode.TargetDeviceNotFound, "Device is not in test mode"));
+ }
+ targetDeviceContainer.SetTargetFanProfile(null, true);
+ if (triggerSwitch) MiningManager.TriggerSwitchCheck();
+ return Task.FromResult((ErrorCode.NoError, "Success"));
+ }
+ public Task<(ErrorCode err, string msg)> ApplyFanBundle(List bundles)
+ {
+ if (bundles == null) return Task.FromResult((ErrorCode.NoError, "FanBundles == null"));
+ List processed = new();
+ var sorted = new List<(int, FanProfile)>();
+ foreach (var bundle in bundles)
+ {
+ if (bundle.MinerId != null && bundle.AlgoId != null) sorted.Add((0, bundle));
+ else if (bundle.MinerId == null && bundle.AlgoId != null) sorted.Add((1, bundle));
+ else if (bundle.MinerId != null && bundle.AlgoId == null) sorted.Add((2, bundle));
+ else sorted.Add((3, bundle));
+ }
+ sorted = sorted.OrderBy(item => item.Item1).ToList();
+ foreach (var (type, bundle) in sorted)
+ {
+ var targetList = BundleManager.FindTargetGPUNames(bundle.DeviceName);
+ if (targetList == null) continue;
+ var current = new List();
+ if (type == 0) current = AvailableDevices.Devices
+ .Where(d => targetList.Contains(d.Name.ToLower()))?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .Where(c => bundle.AlgoId.Contains(c.AlgorithmName.ToLower()))?
+ .Where(c => bundle.MinerId.Contains(c.PluginName.ToLower()))?
+ .ToList();
+ else if (type == 1) current = AvailableDevices.Devices
+ .Where(d => targetList.Contains(d.Name.ToLower()))?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .Where(c => bundle.AlgoId.Contains(c.AlgorithmName.ToLower()))?
+ .ToList();
+ else if (type == 2) current = AvailableDevices.Devices
+ .Where(d => targetList.Contains(d.Name.ToLower()))?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .Where(c => bundle.MinerId.Contains(c.PluginName.ToLower()))?
+ .ToList();
+ else current = AvailableDevices.Devices
+ .Where(d => targetList.Contains(d.Name.ToLower()))?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .ToList();
+ if (current == null) continue;
+ current = current.Where(c => !processed.Contains(c)).ToList();
+ processed.AddRange(current);
+ foreach (var container in current)
+ {
+ Logger.Warn(_TAG, $"\t{container.ComputeDevice.ID}-{container.ComputeDevice.Name}/{container.AlgorithmName}/{container.PluginName}");
+ container.SetTargetFanProfile(bundle, false);
+ }
+ }
+ MiningManager.TriggerSwitchCheck();
+ return Task.FromResult((ErrorCode.NoError, "Success"));
+ }
+
+ public Task ResetFanBundle(bool triggerSwitch = true)
+ {
+ var containers = AvailableDevices.Devices.SelectMany(d => d.AlgorithmSettings);
+ foreach (var container in containers)
+ {
+ container.SetTargetFanProfile(null, false);
+ }
+ if (triggerSwitch) MiningManager.TriggerSwitchCheck();
+ return Task.FromResult((ErrorCode.NoError, "Success"));
+ }
+ }
+}
diff --git a/src/NHMCore/Configs/Managers/OCManager.cs b/src/NHMCore/Configs/Managers/OCManager.cs
new file mode 100644
index 000000000..9221b5304
--- /dev/null
+++ b/src/NHMCore/Configs/Managers/OCManager.cs
@@ -0,0 +1,128 @@
+//using log4net.Core;
+using NHM.Common;
+using NHM.Common.Enums;
+using NHMCore.ApplicationState;
+using NHMCore.Mining;
+using NHMCore.Nhmws;
+using NHMCore.Nhmws.V4;
+using Org.BouncyCastle.Asn1.X509;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Reflection.Metadata;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace NHMCore.Configs.Managers
+{
+ public class OCManager
+ {
+ private OCManager() { }
+ public static OCManager Instance { get; } = new OCManager();
+ private readonly string _TAG = "OCManager";
+ public Task<(ErrorCode err, string msg)> ExecuteTest(string uuid, OcProfile bundle)
+ {
+ if (!MiningState.Instance.AnyDeviceRunning) return Task.FromResult((ErrorCode.ErrNoDeviceRunning, "No devices mining"));
+ var allContainers = AvailableDevices.Devices
+ .Where(d => d.B64Uuid == uuid)?
+ .Where(d => d.State == DeviceState.Mining || d.State == DeviceState.Testing)?
+ .SelectMany(d => d.AlgorithmSettings);
+ if (allContainers == null || !allContainers.Any()) return Task.FromResult((ErrorCode.TargetDeviceNotFound, "No targets found"));
+
+ if (bundle.AlgoId != null && bundle.MinerId != null) allContainers = allContainers.Where(d =>
+ bundle.AlgoId.Contains(d.AlgorithmName.ToLower()) &&
+ bundle.MinerId.Contains(d.PluginName.ToLower()));
+ else if (bundle.AlgoId != null) allContainers = allContainers.Where(d => bundle.AlgoId.Contains(d.AlgorithmName.ToLower()));
+ else if (bundle.MinerId != null) allContainers = allContainers.Where(d => bundle.MinerId.Contains(d.PluginName.ToLower()));
+ if (allContainers == null || !allContainers.Any()) return Task.FromResult((ErrorCode.TargetDeviceNotFound, "Action target mismatch, containers null"));
+ var target = allContainers.Where(c => c.IsCurrentlyMining)?.FirstOrDefault();
+ if(target == null)
+ {
+ target = allContainers.Where(c => c.Enabled)?.FirstOrDefault();
+ if (target == null) return Task.FromResult((ErrorCode.TargetContainerNotFound, "Failed to switch to target algorithm container"));
+ }
+ target.SetTargetOcProfile(bundle, true);
+ MiningManager.TriggerSwitchCheck();
+ return Task.FromResult((ErrorCode.NoError, "Success"));
+ }
+ public Task<(ErrorCode err, string msg)> StopTest(string uuid, bool triggerSwitch)
+ {
+ var targetDeviceContainer = AvailableDevices.Devices
+ .Where(d => d.B64Uuid == uuid)?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .Where(a => a.IsTesting || a.ActiveOCTestProfile != null)?
+ .FirstOrDefault();
+ if (targetDeviceContainer == null)
+ {
+ Logger.Warn(_TAG, "Device not found for stop OC test");
+ return Task.FromResult((ErrorCode.TargetDeviceNotFound, "Device is not in test mode"));
+ }
+ targetDeviceContainer.SetTargetOcProfile(null, true);
+ if(triggerSwitch) MiningManager.TriggerSwitchCheck();
+ return Task.FromResult((ErrorCode.NoError, "Success"));
+ }
+ public Task<(ErrorCode err, string msg)> ApplyOcBundle(List bundles)
+ {
+ if (bundles == null) return Task.FromResult((ErrorCode.NoError, "OcBundles == null"));
+ List processed = new();
+ var sorted = new List<(int, OcProfile)>();
+ foreach (var bundle in bundles)
+ {
+ if (bundle.MinerId != null && bundle.AlgoId != null) sorted.Add((0, bundle));
+ else if (bundle.MinerId == null && bundle.AlgoId != null) sorted.Add((1, bundle));
+ else if (bundle.MinerId != null && bundle.AlgoId == null) sorted.Add((2, bundle));
+ else sorted.Add((3, bundle));
+ }
+ sorted = sorted.OrderBy(item => item.Item1).ToList();
+ foreach (var (type, bundle) in sorted)
+ {
+ var targetList = BundleManager.FindTargetGPUNames(bundle.DeviceName);
+ if (targetList == null) continue;
+ var current = new List();
+ if (type == 0) current = AvailableDevices.Devices
+ .Where(d => targetList.Contains(d.Name.ToLower()))?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .Where(c => bundle.AlgoId.Contains(c.AlgorithmName.ToLower()))?
+ .Where(c => bundle.MinerId.Contains(c.PluginName.ToLower()))?
+ .ToList();
+ else if (type == 1) current = AvailableDevices.Devices
+ .Where(d => targetList.Contains(d.Name.ToLower()))?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .Where(c => bundle.AlgoId.Contains(c.AlgorithmName.ToLower()))?
+ .ToList();
+ else if (type == 2) current = AvailableDevices.Devices
+ .Where(d => targetList.Contains(d.Name.ToLower()))?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .Where(c => bundle.MinerId.Contains(c.PluginName.ToLower()))?
+ .ToList();
+ else current = AvailableDevices.Devices
+ .Where(d => targetList.Contains(d.Name.ToLower()))?
+ .SelectMany(d => d.AlgorithmSettings)?
+ .ToList();
+ if (current == null) continue;
+ current = current.Where(c => !processed.Contains(c)).ToList();
+ processed.AddRange(current);
+ foreach (var container in current)
+ {
+ Logger.Warn(_TAG, $"\t{container.ComputeDevice.ID}-{container.ComputeDevice.Name}/{container.AlgorithmName}/{container.PluginName}");
+ container.SetTargetOcProfile(bundle, false);
+ }
+ }
+ MiningManager.TriggerSwitchCheck();
+ return Task.FromResult((ErrorCode.NoError, "Success"));
+ }
+
+ public Task ResetOcBundle(bool triggerSwitch = true)
+ {
+ var containers = AvailableDevices.Devices.SelectMany(d => d.AlgorithmSettings);
+ foreach (var container in containers)
+ {
+ container.SetTargetOcProfile(null, false);
+ }
+ if (triggerSwitch) MiningManager.TriggerSwitchCheck();
+ return Task.FromResult((ErrorCode.NoError, "Success"));
+ }
+ }
+}
diff --git a/src/NHMCore/Configs/MiningSettings.cs b/src/NHMCore/Configs/MiningSettings.cs
index 127c6f082..2f8115c4e 100644
--- a/src/NHMCore/Configs/MiningSettings.cs
+++ b/src/NHMCore/Configs/MiningSettings.cs
@@ -1,6 +1,8 @@
using NHM.Common;
using NHMCore.Mining;
+using NHMCore.Nhmws.V4;
using System.Collections.Generic;
+using System.Threading.Tasks;
namespace NHMCore.Configs
{
@@ -101,6 +103,9 @@ public bool UseScheduler
{
_useScheduler = value;
OnPropertyChanged(nameof(UseScheduler));
+#if NHMWS4
+ _ = Task.Run(async () => await NHWebSocketV4.UpdateMinerStatus());
+#endif
}
}
diff --git a/src/NHMCore/Configs/MiscSettings.cs b/src/NHMCore/Configs/MiscSettings.cs
index d72a83dba..4d356784c 100644
--- a/src/NHMCore/Configs/MiscSettings.cs
+++ b/src/NHMCore/Configs/MiscSettings.cs
@@ -94,5 +94,45 @@ public bool AdvancedMode
OnPropertyChanged(nameof(AdvancedMode));
}
}
+ private bool _sendEvents = true;
+ public bool SendEvents
+ {
+ get => _sendEvents;
+ set
+ {
+ _sendEvents = value;
+ OnPropertyChanged(nameof(SendEvents));
+ }
+ }
+ private bool _autoResetOC = true;
+ public bool AutoResetOC
+ {
+ get => _autoResetOC;
+ set
+ {
+ _autoResetOC = value;
+ OnPropertyChanged(nameof(AutoResetOC));
+ }
+ }
+ private bool _enableGPUManagement = true;
+ public bool EnableGPUManagement
+ {
+ get => _enableGPUManagement;
+ set
+ {
+ _enableGPUManagement = value;
+ OnPropertyChanged(nameof(EnableGPUManagement));
+ }
+ }
+ private bool _detectIntegratedDevs = true;
+ public bool DetectIntegratedDevices
+ {
+ get => _detectIntegratedDevs;
+ set
+ {
+ _detectIntegratedDevs = value;
+ OnPropertyChanged(nameof(DetectIntegratedDevices));
+ }
+ }
}
}
diff --git a/src/NHMCore/Configs/UpdateSettings.cs b/src/NHMCore/Configs/UpdateSettings.cs
index 9080a4fdd..28e8b6253 100644
--- a/src/NHMCore/Configs/UpdateSettings.cs
+++ b/src/NHMCore/Configs/UpdateSettings.cs
@@ -1,4 +1,6 @@
using NHM.Common;
+using NHMCore.Nhmws.V4;
+using System.Threading.Tasks;
namespace NHMCore.Configs
{
@@ -26,6 +28,9 @@ public bool AutoUpdateNiceHashMiner
_autoUpdateNiceHashMiner = value;
}
OnPropertyChanged(nameof(AutoUpdateNiceHashMiner));
+#if NHMWS4
+ _ = Task.Run(async () => await NHWebSocketV4.UpdateMinerStatus());
+#endif
}
}
@@ -46,6 +51,9 @@ public bool AutoUpdateMinerPlugins
_autoUpdateMinerPlugins = value;
}
OnPropertyChanged(nameof(AutoUpdateMinerPlugins));
+#if NHMWS4
+ _ = Task.Run(async () => await NHWebSocketV4.UpdateMinerStatus());
+#endif
}
}
}
diff --git a/src/NHMCore/Mining/AlgorithmContainer.cs b/src/NHMCore/Mining/AlgorithmContainer.cs
index d9089dc36..400b59f8b 100644
--- a/src/NHMCore/Mining/AlgorithmContainer.cs
+++ b/src/NHMCore/Mining/AlgorithmContainer.cs
@@ -5,11 +5,17 @@
using NHMCore.ApplicationState;
using NHMCore.Configs;
using NHMCore.Configs.ELPDataModels;
+using NHMCore.Configs.Managers;
using NHMCore.Mining.Plugins;
-using NHMCore.Utils;
+using NHMCore.Nhmws.V4;
+using NHMCore.Notifications;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection.Metadata;
+using System.Threading.Tasks;
+using Windows.Media.Protection.PlayReady;
+using static NHMCore.Configs.Managers.OCManager;
namespace NHMCore.Mining
{
@@ -29,6 +35,7 @@ public class AlgorithmContainer : NotifyChangedBase
public DateTime IgnoreUntil { get; internal set; } = DateTime.UtcNow;
private List _powerUsageHistory = new List();
private List _speedHistory = new List();
+ private string _TAG = string.Empty;
// status is always calculated
public AlgorithmStatus Status
@@ -66,6 +73,7 @@ public AlgorithmContainer(Algorithm algorithm, PluginContainer pluginContainer,
PluginContainer = pluginContainer;
Algorithm = algorithm;
ComputeDevice = computeDevice;
+ _TAG = $"AC->{pluginContainer.Name}/{algorithm.AlgorithmName}/{computeDevice.Name}";
computeDevice.PropertyChanged += ComputeDevice_PropertyChanged;
SwitchSettings.Instance.PropertyChanged += SettingsChanged;
@@ -77,7 +85,11 @@ private void ComputeDevice_PropertyChanged(object sender, System.ComponentModel.
{
if (nameof(NHMCore.Mining.ComputeDevice.State) == e.PropertyName)
{
+#if NHMWS4
+ var miningOrBenchmarking = ComputeDevice.State == DeviceState.Benchmarking || ComputeDevice.State == DeviceState.Mining || ComputeDevice.State == DeviceState.Testing;
+#else
var miningOrBenchmarking = ComputeDevice.State == DeviceState.Benchmarking || ComputeDevice.State == DeviceState.Mining;
+#endif
IsUserEditable = !miningOrBenchmarking;
OnPropertyChanged(nameof(IsUserEditable));
}
@@ -91,7 +103,7 @@ public MiningPair ToMiningPair()
Algorithm = Algorithm
};
}
- public DeviceELPData FindInELPTree(string deviceUUID) => ELPManager.Instance.FindDeviceNode(this, deviceUUID);
+ public DeviceELPData FindInELPTree(string deviceUUID) => ELPManager.Instance.FindDeviceNode(this, deviceUUID);
public void UpdateConfigVersionIfNeeded()
{
if ((_powerUsageHistory.Count >= 2 && _powerUsageHistory.Last() != _powerUsageHistory[_powerUsageHistory.Count - 2]) ||
@@ -163,6 +175,9 @@ public double BenchmarkSpeed
Algorithm.Speeds[0] = value;
UpdateConfigVersionIfNeeded();
NotifySpeedChanged();
+#if NHMWS4
+ Task.Run(async () => await NHWebSocketV4.UpdateMinerStatus());
+#endif
}
}
@@ -230,9 +245,21 @@ public virtual bool Enabled
if (Algorithm != null) Algorithm.Enabled = value;
OnPropertyChanged();
OnPropertyChanged(nameof(Status));
+#if NHMWS4
+ Task.Run(async () => await NHWebSocketV4.UpdateMinerStatus());
+#endif
+ if (MinerUUID == null || MinerUUID == string.Empty) return; //initial stuff
+ if(value) EventManager.Instance.AddEventAlgoEnabled(ComputeDevice.B64Uuid, PluginName, new List { AlgorithmName } );
+ else EventManager.Instance.AddEventAlgoDisabled(ComputeDevice.B64Uuid, PluginName, new List { AlgorithmName });
}
}
-
+ public void SetEnabled(bool enabled) //for enable without WS (bulk setting)
+ {
+ if (Algorithm != null) Algorithm.Enabled = enabled;
+ OnPropertyChanged();
+ OnPropertyChanged(nameof(Enabled));
+ OnPropertyChanged(nameof(Status));
+ }
///
/// Indicates whether this algorithm requires a benchmark
///
@@ -302,7 +329,11 @@ public double CurrentEstimatedProfit
return 1000;
}
- if (!_updateEstimatedProfitCalled) return -2;
+ if (!_updateEstimatedProfitCalled)
+ {
+ Logger.Error("AlgoContainer", "UpdateEstimatedProfit not called, returning -2");
+ return -2;
+ }
if (EstimatedProfitAllSMAPresent && EstimatedProfitAllSMAPositiveOrZero)
{
@@ -315,6 +346,7 @@ public double CurrentEstimatedProfit
return Math.Round(newProfit, 8);
}
// we can't calculate
+ Logger.Error("AlgoContainer", "Cant calculate, returning -1");
return -1;
}
}
@@ -393,7 +425,8 @@ public string CurPayingRatioStr
/// Power consumption of this algorithm, in Watts
///
private double _powerUsage = 0;
- public virtual double PowerUsage {
+ public virtual double PowerUsage
+ {
get
{
return _powerUsage;
@@ -483,7 +516,7 @@ public void ClearSpeeds()
this.Speeds = allZero;
}
-
+
#endregion
@@ -541,5 +574,536 @@ void SettingsChanged(object sender, EventArgs e)
}
#endregion
+
+
+ internal bool IgnoreLocalELPInput //if ignore local ELPs for rig manager ones
+ {
+ get
+ {
+#if NHMWS4
+ if (ActiveELPProfile != null || ActiveELPTestProfile != null) return true;
+ return false;
+#else
+ return false;
+#endif
+ }
+ }
+#if NHMWS4
+ private readonly object _lock = new object();
+ public enum ProfileType
+ {
+ None,
+ Normal,
+ Test,
+ }
+ public ProfileType GetTargetProfileType()
+ {
+ if (ActiveFanTestProfile != null || ActiveOCTestProfile != null || ActiveELPTestProfile != null) return ProfileType.Test;
+ if (ActiveFanProfile != null || ActiveOCProfile != null || ActiveELPProfile != null) return ProfileType.Normal;
+ return ProfileType.None;
+ }
+ public bool HasNormalProfileToSet()
+ {
+ return ActiveFanProfile != null || ActiveOCProfile != null || ActiveELPProfile != null;
+ }
+ public bool HasTestProfileToSet()
+ {
+ return ActiveFanTestProfile != null || ActiveOCTestProfile != null || ActiveELPTestProfile != null;
+ }
+ public bool HasTestProfileAndCanSet()
+ {
+ return GetTargetProfileType() == ProfileType.Test && HasTestProfileToSet();
+ }
+ public bool HasNormalProfileAndCanSet()
+ {
+ return GetTargetProfileType() == ProfileType.Normal && HasNormalProfileToSet();
+ }
+ private OcProfile _runningOCProfile = null;
+ public OcProfile RunningOcProfile
+ {
+ get
+ {
+ lock (_lock)
+ {
+ return _runningOCProfile;
+ }
+ }
+ set
+ {
+ lock (_lock)
+ {
+ _runningOCProfile = value;
+ }
+ }
+ }
+ private ElpProfile _runningELPProfile = null;
+ public ElpProfile RunningELPProfile
+ {
+ get
+ {
+ lock (_lock)
+ {
+ return _runningELPProfile;
+ }
+ }
+ set
+ {
+ lock (_lock)
+ {
+ _runningELPProfile = value;
+ }
+ }
+ }
+ public FanProfile _runningFanProfile = null;
+ public FanProfile RunningFanProfile
+ {
+ get
+ {
+ lock (_lock)
+ {
+ return _runningFanProfile;
+ }
+ }
+ set
+ {
+ lock (_lock)
+ {
+ _runningFanProfile = value;
+ }
+ }
+ }
+ public bool IsTesting => HasTestProfileToSet();
+ #region OC
+ public string OCProfile
+ {
+ get
+ {
+ if (ActiveOCTestProfile != null) return ActiveOCTestProfile.Name;
+ if (ActiveOCProfile != null && !IsTesting) return ActiveOCProfile.Name;
+ return string.Empty;
+ }
+ }
+ public string OCProfileID
+ {
+ get
+ {
+ if (ActiveOCTestProfile != null) return ActiveOCTestProfile.Id;
+ if (ActiveOCProfile != null && !IsTesting) return ActiveOCProfile.Id;
+ return string.Empty;
+ }
+ }
+
+
+ private OcProfile _ActiveOCTestProfile = null;
+ public OcProfile ActiveOCTestProfile
+ {
+ get
+ {
+ lock (_lock)
+ {
+ return _ActiveOCTestProfile;
+ }
+ }
+ set
+ {
+ lock (_lock)
+ {
+ _ActiveOCTestProfile = value;
+ }
+ }
+ }
+ private OcProfile _ActiveOCProfile = null;
+ public OcProfile ActiveOCProfile
+ {
+ get
+ {
+ lock (_lock)
+ {
+ return _ActiveOCProfile;
+ }
+ }
+ set
+ {
+ lock (_lock)
+ {
+ _ActiveOCProfile = value;
+ }
+ }
+ }
+ public void SetTargetOcProfile(OcProfile profile, bool test)
+ {
+ if (test)
+ {
+ ActiveOCTestProfile = profile;
+ }
+ else
+ {
+ ActiveOCProfile = profile;
+ }
+ }
+ public Task SetOcForDevice(OcProfile bundle, bool reset = false)
+ {
+ //if (bundle != null) Logger.Warn(_TAG, $"Setting OC for {ComputeDevice.Name}: TDP={bundle.TDP},CC={bundle.CoreClock},MC={bundle.MemoryClock}");
+ var ret = RigManagementReturn.Fail;
+ int valuesToSet = 0;
+ bool willSetCC = false;
+ bool willSetCCDelta = false;
+ bool willSetMC = false;
+ bool willSetMCDelta = false;
+
+ if (bundle.CoreClockDelta != null) willSetCCDelta = true;
+ if (bundle.CoreClock != null) willSetCC = true;
+ if (bundle.MemoryClockDelta != null) willSetMCDelta = true;
+ if (bundle.MemoryClock != null) willSetMC = true;
+
+ if (willSetCC || willSetCCDelta) valuesToSet++;
+ if (willSetMC || willSetMCDelta) valuesToSet++;
+ if (bundle.TDP != null) valuesToSet++;
+ if (bundle.CoreVoltage != null) valuesToSet++;
+
+ if (valuesToSet == 0 && !reset)
+ {
+ Logger.Error(_TAG, "Have no values to set");
+ return Task.FromResult(ret);
+ }
+
+ int setValues = 4;
+ bool setTDP = false;
+ bool setCCabs = false;
+ bool setCCdelta = false;
+ bool setMCabs = false;
+ bool setMCdelta = false;
+ bool setCV = false;
+
+ bool setCC;
+ bool setMC;
+
+ if (reset)
+ {
+ Logger.Warn(_TAG, $"Resetting device {ComputeDevice.ID}");
+ Logger.Warn(_TAG, $"[{ComputeDevice.ID}] reset TDP: {ComputeDevice.SetPowerModeManual(ComputeDevice.TDPLimits.def)}");
+ Logger.Warn(_TAG, $"[{ComputeDevice.ID}] reset CC: {ComputeDevice.ResetCoreClock()}");
+ Logger.Warn(_TAG, $"[{ComputeDevice.ID}] reset CCD: {ComputeDevice.ResetCoreClockDelta()}");
+ Logger.Warn(_TAG, $"[{ComputeDevice.ID}] reset MC: {ComputeDevice.ResetMemoryClock()}");
+ Logger.Warn(_TAG, $"[{ComputeDevice.ID}] reset MCD: {ComputeDevice.ResetMemoryClockDelta()}");
+ Logger.Warn(_TAG, $"[{ComputeDevice.ID}] reset CV: {ComputeDevice.ResetCoreVoltage()}");
+ }
+
+
+ if (ComputeDevice.DeviceType == DeviceType.AMD)
+ {
+ Logger.Warn(_TAG, $"Setting AMD device {ComputeDevice.ID}");
+ if (bundle.TDP != null) Logger.Warn(_TAG, $"[{ComputeDevice.ID}] TDP to set: {(int)bundle.TDP}");
+ if (bundle.CoreClock != null) Logger.Warn(_TAG, $"[{ComputeDevice.ID}] CoreClock to set: {(int)bundle.CoreClock}");
+ if (bundle.MemoryClock != null) Logger.Warn(_TAG, $"[{ComputeDevice.ID}] MemoryClock to set: {(int)bundle.MemoryClock}");
+ if (bundle.CoreVoltage != null) Logger.Warn(_TAG, $"[{ComputeDevice.ID}] CoreVoltage to set: {(int)bundle.CoreVoltage}");
+
+ setTDP = bundle.TDP == null ? false : ComputeDevice.SetPowerModeManual((int)bundle.TDP);
+ setCCabs = willSetCC ? ComputeDevice.SetCoreClock((int)bundle.CoreClock) : false;
+ setMCabs = willSetMC ? ComputeDevice.SetMemoryClock((int)bundle.MemoryClock) : false;
+ setCV = bundle.CoreVoltage == null ? false : ComputeDevice.SetCoreVoltage((int)bundle.CoreVoltage);
+ setCC = setCCabs;
+ setMC = setMCabs;
+ }
+ else
+ {
+ Logger.Warn(_TAG, $"Setting {ComputeDevice.DeviceType} device {ComputeDevice.ID}");
+ if (bundle.TDP != null) Logger.Warn(_TAG, $"[{ComputeDevice.ID}] TDP to set: {(int)bundle.TDP}");
+ if (bundle.CoreClock != null) Logger.Warn(_TAG, $"[{ComputeDevice.ID}] CoreClock to set: {(int)bundle.CoreClock}");
+ if (bundle.CoreClockDelta != null) Logger.Warn(_TAG, $"[{ComputeDevice.ID}] CoreClockDelta to set: {(int)bundle.CoreClockDelta}");
+ if (bundle.MemoryClock != null) Logger.Warn(_TAG, $"[{ComputeDevice.ID}] MemoryClock to set: {(int)bundle.MemoryClock}");
+ if (bundle.MemoryClockDelta != null) Logger.Warn(_TAG, $"[{ComputeDevice.ID}] MemoryClockDelta to set: {(int)bundle.MemoryClockDelta}");
+ if (bundle.CoreVoltage != null) Logger.Warn(_TAG, $"[{ComputeDevice.ID}] CoreVoltage to set: {(int)bundle.CoreVoltage}");
+
+ setTDP = bundle.TDP == null ? false : ComputeDevice.SetPowerModeManual((int)bundle.TDP);
+ setCCabs = willSetCC ? ComputeDevice.SetCoreClock((int)bundle.CoreClock) : false;
+ setCCdelta = willSetCCDelta ? ComputeDevice.SetCoreClockDelta((int)bundle.CoreClockDelta) : false;
+ setMCabs = willSetMC ? ComputeDevice.SetMemoryClock((int)bundle.MemoryClock) : false;
+ setMCdelta = willSetMCDelta ? ComputeDevice.SetMemoryClockDelta((int)bundle.MemoryClockDelta) : false;
+ setCV = bundle.CoreVoltage == null ? false : ComputeDevice.SetCoreVoltage((int)bundle.CoreVoltage);
+ setCC = setCCabs || setCCdelta;
+ setMC = setMCabs || setMCdelta;
+ }
+
+ if (!setCC) setValues--;
+ if (!setMC) setValues--;
+ if (!setTDP) setValues--;
+ if (!setCV) setValues--;
+
+ Logger.Warn(_TAG, $"[{ComputeDevice.BaseDevice.ID}] Setting core clock success: {setCC}");
+ Logger.Warn(_TAG, $"[{ComputeDevice.BaseDevice.ID}] Setting memory clock success: {setMC}");
+ Logger.Warn(_TAG, $"[{ComputeDevice.BaseDevice.ID}] Setting TDP success: {setTDP}");
+ Logger.Warn(_TAG, $"[{ComputeDevice.BaseDevice.ID}] Setting voltage success: {setCV}");
+
+ if (setValues == valuesToSet) ret = RigManagementReturn.Success;
+ else if (setValues != 0 && setValues < valuesToSet) ret = RigManagementReturn.PartialSuccess;
+
+ if (!reset && (ret == RigManagementReturn.Success || ret == RigManagementReturn.PartialSuccess))
+ {
+ Logger.Warn(_TAG, $"Setting OC is successful");
+ return Task.FromResult(ret);
+ }
+ Logger.Warn(_TAG, $"OC not in test mode anymore");
+ return Task.FromResult(ret);
+ }
+ public Task ResetOcForDevice()
+ {
+ var res = SetOcForDevice(new OcProfile(), true);
+ return Task.FromResult(res.Result);
+ }
+ #endregion
+ #region ELP
+ public string DelayedELPString = string.Empty;
+ public string ELPProfile
+ {
+ get
+ {
+ if (ActiveELPTestProfile != null) return ActiveELPTestProfile.Name;
+ if (ActiveELPProfile != null && !IsTesting) return ActiveELPProfile.Name;
+ return string.Empty;
+ }
+ }
+ public string ELPProfileID
+ {
+ get
+ {
+ if (ActiveELPTestProfile != null) return ActiveELPTestProfile.Id;
+ if (ActiveELPProfile != null && !IsTesting) return ActiveELPProfile.Id;
+ return string.Empty;
+ }
+ }
+ private ElpProfile _ActiveELPTestProfile = null;
+ public ElpProfile ActiveELPTestProfile
+ {
+ get
+ {
+ lock (_lock)
+ {
+ return _ActiveELPTestProfile;
+ }
+ }
+ set
+ {
+ lock (_lock)
+ {
+ if ((value != null && _ActiveELPTestProfile == null) ||
+ (value != null && _ActiveELPTestProfile != null))
+ {
+ ELPTestChange = true;
+ }
+ else if (value == null && _ActiveELPTestProfile != null)
+ {
+ ELPTestChange = false;
+ }
+ _ActiveELPTestProfile = value;
+ }
+ }
+ }
+ private ElpProfile _ActiveELPProfile = null;
+ public ElpProfile ActiveELPProfile
+ {
+ get
+ {
+ lock (_lock)
+ {
+ return _ActiveELPProfile;
+ }
+ }
+ set
+ {
+ lock (_lock)
+ {
+ if ((value != null && _ActiveELPProfile == null) ||
+ (value != null && _ActiveELPProfile != null))
+ {
+ ELPChange = true;
+ }
+ else if (value == null && _ActiveELPProfile != null)
+ {
+ ELPChange = false;
+ }
+ _ActiveELPProfile = value;
+ }
+ }
+ }
+ private bool _newTestProfile = false;
+ private bool _newProfile = false;
+ public bool NewTestELPProfile
+ {
+ get
+ {
+ lock (_lock)
+ {
+ return _newTestProfile;
+ }
+ }
+ set
+ {
+ lock (_lock)
+ {
+ _newTestProfile = value;
+ }
+ }
+ }
+ public bool NewELPProfile
+ {
+ get
+ {
+ lock (_lock)
+ {
+ return _newProfile;
+ }
+ }
+ set
+ {
+ lock (_lock)
+ {
+ _newProfile = value;
+ }
+ }
+ }
+ private bool _ELPChange = false;
+ public bool ELPChange
+ {
+ get
+ {
+ lock (_lock)
+ {
+ return _ELPChange;
+ }
+ }
+ set
+ {
+ lock (_lock)
+ {
+ _ELPChange = value;
+ }
+ }
+ }
+ private bool _ELPTestChange = false;
+ public bool ELPTestChange
+ {
+ get
+ {
+ lock (_lock)
+ {
+ return _ELPTestChange;
+ }
+ }
+ set
+ {
+ lock (_lock)
+ {
+ _ELPTestChange = value;
+ }
+ }
+ }
+ public void ResetNewTestProfileStatus() { NewTestELPProfile = false; }
+ public void ResetNewProfileStatus() { NewELPProfile = false; }
+ public void SetTargetElpProfile(ElpProfile profile, bool test)
+ {
+ if (test)
+ {
+ ActiveELPTestProfile = profile;
+ NewTestELPProfile = true;
+ }
+ else
+ {
+ ActiveELPProfile = profile;
+ NewELPProfile = true;
+ }
+ SetELPForDevice(profile == null);
+ OnPropertyChanged(nameof(IgnoreLocalELPInput));
+ }
+ public void TriggerELPReset()
+ {
+ NewELPProfile = true;
+ }
+ public RigManagementReturn SetELPForDevice(bool reset = false)
+ {
+ var ret = RigManagementReturn.Success;
+ if (!reset)
+ {
+ var cmd = string.Empty;
+ if (ActiveELPProfile != null && !IsTesting) cmd = ActiveELPProfile.Elp;
+ if (ActiveELPTestProfile != null) cmd = ActiveELPTestProfile.Elp;
+ Logger.Warn(_TAG, $"Setting ELP for {ComputeDevice.Name}: ELP={cmd}");
+ ELPManager.Instance.SetAlgoCMDString(this, cmd);
+ Logger.Warn(_TAG, $"Setting ELP is successful");
+ return ret;
+ }
+ ELPManager.Instance.IterateSubModelsAndConstructELPs();
+ Logger.Warn(_TAG, $"ELP not in test mode anymore");
+ return ret;
+ }
+ #endregion
+ #region FAN
+ public string FanProfile
+ {
+ get
+ {
+ if (ActiveFanTestProfile != null) return ActiveFanTestProfile.Name;
+ if (ActiveFanProfile != null && !IsTesting) return ActiveFanProfile.Name;
+ return string.Empty;
+ }
+ }
+ public string FanProfileID
+ {
+ get
+ {
+ if (ActiveFanTestProfile != null) return ActiveFanTestProfile.Id;
+ if (ActiveFanProfile != null && !IsTesting) return ActiveFanProfile.Id;
+ return string.Empty;
+ }
+ }
+ private FanProfile _ActiveFanTestProfile = null;
+ public FanProfile ActiveFanTestProfile
+ {
+ get
+ {
+ lock (_lock)
+ {
+ return _ActiveFanTestProfile;
+ }
+ }
+ set
+ {
+ lock (_lock)
+ {
+ _ActiveFanTestProfile = value;
+ }
+ }
+ }
+ private FanProfile _ActiveFanProfile = null;
+ public FanProfile ActiveFanProfile
+ {
+ get
+ {
+ lock (_lock)
+ {
+ return _ActiveFanProfile;
+ }
+ }
+ set
+ {
+ lock (_lock)
+ {
+ _ActiveFanProfile = value;
+ }
+ }
+ }
+ public void SetTargetFanProfile(FanProfile profile, bool test)
+ {
+ if (test)
+ {
+ ActiveFanTestProfile = profile;
+ }
+ else
+ {
+ ActiveFanProfile = profile;
+ }
+ }
+ #endregion
+#endif
}
}
diff --git a/src/NHMCore/Mining/AvailableDevices.cs b/src/NHMCore/Mining/AvailableDevices.cs
index a1938591e..f131d6106 100644
--- a/src/NHMCore/Mining/AvailableDevices.cs
+++ b/src/NHMCore/Mining/AvailableDevices.cs
@@ -19,12 +19,14 @@ public static class AvailableDevices
public static bool HasAmd => Devices.Any(d => d.DeviceType == DeviceType.AMD);
public static bool HasCpu => Devices.Any(d => d.DeviceType == DeviceType.CPU);
public static bool HasGpu => HasNvidia || HasAmd;
- public static bool HasGpuToPause => Devices.Any(dev => dev.PauseMiningWhenGamingMode && dev.DeviceType != DeviceType.CPU);
+ //public static bool HasGpuToPause => Devices.Any(dev => dev.PauseMiningWhenGamingMode && dev.DeviceType != DeviceType.CPU);
public static int AvailCpus => GetCountForType(DeviceType.CPU);
public static int AvailNVGpus => GetCountForType(DeviceType.NVIDIA);
public static int AvailAmdGpus => GetCountForType(DeviceType.AMD);
- public static int AvailGpus => AvailAmdGpus + AvailNVGpus;
+ public static int AvailIntelGpus => GetCountForType(DeviceType.INTEL);
+
+ public static int AvailGpus => AvailAmdGpus + AvailNVGpus + AvailIntelGpus;
public static ulong AvailNvidiaGpuRam
{
@@ -56,6 +58,21 @@ public static ulong AvailAmdGpuRam
}
}
+ public static ulong AvailIntelGpuRam
+ {
+ get
+ {
+ var ramSum = 0ul;
+ var gpuRams = _devices
+ .Where(dev => dev.BaseDevice is IntelDevice)
+ .Select (dev => dev.BaseDevice)
+ .Cast()
+ .Select(gpu => gpu.GpuRam);
+ foreach(var ram in gpuRams) ramSum += ram;
+ return ramSum;
+ }
+ }
+
internal static void AddDevice(ComputeDevice dev)
{
_devices.Add(dev);
diff --git a/src/NHMCore/Mining/ComputeDevice.cs b/src/NHMCore/Mining/ComputeDevice.cs
index 7bc87c481..de7375ce8 100644
--- a/src/NHMCore/Mining/ComputeDevice.cs
+++ b/src/NHMCore/Mining/ComputeDevice.cs
@@ -1,17 +1,25 @@
-using NHM.Common;
+using Newtonsoft.Json;
+using NHM.Common;
using NHM.Common.Device;
using NHM.Common.Enums;
using NHM.DeviceMonitoring;
+using NHM.DeviceMonitoring.Core_clock;
+using NHM.DeviceMonitoring.Core_voltage;
+using NHM.DeviceMonitoring.Memory_clock;
using NHM.DeviceMonitoring.TDP;
using NHM.UUID;
using NHMCore.ApplicationState;
using NHMCore.Configs;
using NHMCore.Configs.Data;
using NHMCore.Nhmws;
+using NHMCore.Nhmws.V4;
+using NHMCore.Notifications;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
namespace NHMCore.Mining
{
@@ -32,6 +40,23 @@ public class ComputeDevice : NotifyChangedBase
// name count is the short name for displaying in moning groups
public string NameCount { get; private set; }
+#if NHMWS4
+ public bool IsTesting => AlgorithmSettings.Any(a => a.IsTesting);
+ public bool IsMiningBenchingTesting => State == DeviceState.Mining || State == DeviceState.Testing || State == DeviceState.Benchmarking;
+ private PidController _pidController = new();
+#endif
+ private bool IsLessThan2KSeries(string name)
+ {
+ string pattern = @"\b(1[0-9]{3}|[1-9][0-9]{2})\b";
+ Regex regex = new Regex(pattern);
+ Match match = regex.Match(name);
+ return match.Success;
+ }
+ public bool IsNvidiaAndSub2KSeries()
+ {
+ return DeviceType == DeviceType.NVIDIA && IsLessThan2KSeries(Name);
+ }
+ private int _memoryControlCounter = 0;
private bool _enabled = true;
public bool Enabled
@@ -44,20 +69,14 @@ internal set
StartState = false;
State = value ? DeviceState.Stopped : DeviceState.Disabled;
OnPropertyChanged();
+ if (B64Uuid == null || B64Uuid == string.Empty || B64Uuid == "-1") return; //initial stuff
+ var eventType = value ? EventType.DeviceEnabled : EventType.DeviceDisabled;
+ if (value) EventManager.Instance.AddEventDevEnabled(Name, B64Uuid, true);
+ else EventManager.Instance.AddEventDevDisabled(Name, B64Uuid, true);
}
}
- private bool _pauseMiningWhenGamingMode = false;
- public bool PauseMiningWhenGamingMode
- {
- get => _pauseMiningWhenGamingMode;
- internal set
- {
- if (value == _pauseMiningWhenGamingMode) return;
- _pauseMiningWhenGamingMode = value;
- OnPropertyChanged();
- }
- }
+ public List SupportedDynamicProperties { get; set; } = new();
// disabled state check
public bool IsDisabled => (!Enabled || State == DeviceState.Disabled);
@@ -120,10 +139,12 @@ public string B64Uuid
//CPU - 1
//GPU - 2 // NVIDIA
//AMD - 3
- int type = DeviceType switch {
+ int type = DeviceType switch
+ {
DeviceType.CPU => 1,
DeviceType.NVIDIA => 2,
DeviceType.AMD => 3,
+ DeviceType.INTEL => 4,
_ => throw new Exception($"Unknown DeviceType {(int)DeviceType}"),
};
var b64Web = UUID.GetB64UUID(Uuid);
@@ -149,6 +170,55 @@ protected set
}
}
}
+ public int ApplyNewAlgoStates(MinerAlgoState state)
+ {
+ if (State == DeviceState.Mining || State == DeviceState.Testing || State == DeviceState.Benchmarking) return -1;
+ foreach (var miner in state.Miners)
+ {
+ foreach (var algo in miner.Algos)
+ {
+ var targets = AlgorithmSettings.Where(a => a.AlgorithmName == algo.Id && a.PluginName == miner.Id)?.ToList();
+ if (targets == null) continue;
+ if (!miner.Enabled)
+ {
+ targets.ForEach(t => t.SetEnabled((bool)false));
+ continue;
+ }
+ targets.ForEach(t => t.SetEnabled((bool)algo.Enabled));
+ }
+ var enabledAlgos = miner.Algos.Where(a => (bool)a.Enabled);
+ var disabledAlgos = miner.Algos.Where(a => (bool)!a.Enabled);
+ if(enabledAlgos != null && enabledAlgos.Count() > 0 && miner.Enabled)
+ {
+ EventManager.Instance.AddEventAlgoEnabled(B64Uuid, miner.Id, enabledAlgos.Select(a => a.Id).ToList(), true);
+ }
+ if(disabledAlgos != null && disabledAlgos.Count() > 0)
+ {
+ EventManager.Instance.AddEventAlgoDisabled(B64Uuid, miner.Id, disabledAlgos.Select(a => a.Id).ToList(), true);
+ }
+ else if (!miner.Enabled)
+ {
+ EventManager.Instance.AddEventAlgoDisabled(B64Uuid, miner.Id, miner.Algos.Select(a => a.Id).ToList(), true);
+ }
+ }
+ Task.Run(async () => NHWebSocketV4.UpdateMinerStatus());
+ return 0;
+ }
+
+ public int ApplyNewAlgoSpeeds(MinerAlgoSpeed speed)
+ {
+ foreach (var miner in speed.Miners)
+ {
+ foreach (var algo in miner.Combinations)
+ {
+ var targets = AlgorithmSettings.Where(a => a.AlgorithmName == algo.Id && a.PluginName == miner.Id)?.ToList();
+ if (targets == null) continue;
+ targets.ForEach(t => t.BenchmarkSpeed = Convert.ToDouble(algo.Algos.FirstOrDefault().Speed));
+ }
+ }
+ Task.Run(async () => NHWebSocketV4.UpdateMinerStatus());
+ return 0;
+ }
private List PluginAlgorithmSettings { get; set; } = new List();
@@ -167,7 +237,7 @@ public void SetDeviceMonitor(DeviceMonitor deviceMonitor)
private bool CanMonitorStatus => !GlobalDeviceSettings.Instance.DisableDeviceStatusMonitoring && DeviceMonitor != null;
- private bool CanSetTDP => !GlobalDeviceSettings.Instance.DisableDevicePowerModeSettings && DeviceMonitor != null;
+ private bool CanSetTDP => DeviceMonitor != null;
public uint PowerTarget
{
@@ -265,15 +335,296 @@ public int MemoryControllerLoad
return -1;
}
}
+ public int CoreClock
+ {
+ get
+ {
+ if (!GlobalDeviceSettings.Instance.DisableDeviceStatusMonitoring && DeviceMonitor != null && DeviceMonitor is ICoreClock get) return get.CoreClock;
+ return -1;
+ }
+ }
+ public int CoreClockDelta
+ {
+ get
+ {
+ if (!GlobalDeviceSettings.Instance.DisableDeviceStatusMonitoring && DeviceMonitor != null && DeviceMonitor is ICoreClockDelta get) return get.CoreClockDelta;
+ return -1;
+ }
+ }
+ public int PreferredCoreClock
+ {
+ get
+ {
+ if (DeviceType == DeviceType.NVIDIA) return CoreClockDelta;
+ if (DeviceType == DeviceType.AMD) return CoreClock;
+ if (DeviceType == DeviceType.INTEL) return CoreClockDelta;
+ return -1;
+ }
+ }
+ public int MemoryClock
+ {
+ get
+ {
+ if (!GlobalDeviceSettings.Instance.DisableDeviceStatusMonitoring && DeviceMonitor != null && DeviceMonitor is IMemoryClock get) return get.MemoryClock;
+ return -1;
+ }
+ }
+
+ public int MemoryClockDelta
+ {
+ get
+ {
+ if (!GlobalDeviceSettings.Instance.DisableDeviceStatusMonitoring && DeviceMonitor != null && DeviceMonitor is IMemoryClockDelta get) return get.MemoryClockDelta;
+ return -1;
+ }
+ }
+ public int PreferredMemoryClock
+ {
+ get
+ {
+ if (DeviceType == DeviceType.NVIDIA) return MemoryClockDelta;
+ if (DeviceType == DeviceType.AMD) return MemoryClock;
+ if (DeviceType == DeviceType.INTEL) return MemoryClockDelta;
+ return -1;
+ }
+ }
+
+ public (int min, int max, int def) TDPLimits
+ {
+ get
+ {
+ if (!GlobalDeviceSettings.Instance.DisableDeviceStatusMonitoring && DeviceMonitor != null && DeviceMonitor is ITDPLimits get)
+ {
+ var ret = get.GetTDPLimits();
+ return (ret.min, ret.max, ret.def);
+ }
+ return (0, 0, 0);
+ }
+ }
+
+ public (bool ok, int min, int max, int def) CoreClockRange
+ {
+ get
+ {
+ if (!GlobalDeviceSettings.Instance.DisableDeviceStatusMonitoring && DeviceMonitor != null && DeviceMonitor is ICoreClockRange get)
+ {
+ var ret = get.CoreClockRange;
+ return (ret.ok, ret.min, ret.max, ret.def);
+ }
+ return (false, -1, -1, -1);
+ }
+ }
+
+ public (bool ok, int min, int max, int def) MemoryClockRange
+ {
+ get
+ {
+ if (!GlobalDeviceSettings.Instance.DisableDeviceStatusMonitoring && DeviceMonitor != null && DeviceMonitor is IMemoryClockRange get)
+ {
+ var ret = get.MemoryClockRange;
+ return (ret.ok, ret.min, ret.max, ret.def);
+ }
+ return (false, -1, -1, -1);
+ }
+ }
+
+ public (bool ok, int min, int max, int def) MemoryClockRangeDelta
+ {
+ get
+ {
+ if (!GlobalDeviceSettings.Instance.DisableDeviceStatusMonitoring && DeviceMonitor != null && DeviceMonitor is IMemoryClockRangeDelta get)
+ {
+ var ret = get.MemoryClockRangeDelta;
+ return (ret.ok, ret.min, ret.max, ret.def);
+ }
+ return (false, -1, -1, -1);
+ }
+ }
+
+ public int CoreVoltage
+ {
+ get
+ {
+ if (!GlobalDeviceSettings.Instance.DisableDeviceStatusMonitoring && DeviceMonitor != null && DeviceMonitor is ICoreVoltage get) return get.CoreVoltage;
+ return -1;
+ }
+ }
+
+ public (bool ok, int min, int max, int def) CoreVoltageRange
+ {
+ get
+ {
+ if (!GlobalDeviceSettings.Instance.DisableDeviceStatusMonitoring && DeviceMonitor != null && DeviceMonitor is ICoreVoltageRange get)
+ {
+ var ret = get.CoreVoltageRange;
+ return (ret.ok, ret.min, ret.max, ret.def);
+ }
+ return (false, -1, -1, -1);
+ }
+ }
#endregion Getters
#region Setters
public bool SetPowerMode(TDPSimpleType level)
{
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("ComputeDevice", "GPU Management is disabled(SetPowerMode)");
+ return false;
+ }
if (CanSetTDP && DeviceMonitor is ITDP set) return set.SetTDPSimple(level);
return false;
}
+ public bool SetPowerModeManual(int TDP)
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("ComputeDevice", "GPU Management is disabled(SetPowerModeManual)");
+ return false;
+ }
+ if (CanSetTDP && DeviceMonitor is ITDP set) return set.SetTDP(TDP);
+ return false;
+ }
+ public bool SetCoreClock(int coreClock)
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("ComputeDevice", "GPU Management is disabled(SetCoreClock)");
+ return false;
+ }
+ if (CanSetTDP && DeviceMonitor is ICoreClockSet set) return set.SetCoreClock(coreClock);
+ return false;
+ }
+ public bool SetCoreClockDelta(int coreClockDelta)
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("ComputeDevice", "GPU Management is disabled(SetCoreClockDelta)");
+ return false;
+ }
+ if (CanSetTDP && DeviceMonitor is ICoreClockSetDelta set) return set.SetCoreClockDelta(coreClockDelta);
+ return false;
+ }
+ public bool SetMemoryClock(int memoryClock)
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("ComputeDevice", "GPU Management is disabled(SetMemoryClock)");
+ return false;
+ }
+ if (CanSetTDP && DeviceMonitor is IMemoryClockSet set) return set.SetMemoryClock(memoryClock);
+ return false;
+ }
+ public bool SetMemoryClockDelta(int memoryClockDelta)
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("ComputeDevice", "GPU Management is disabled(SetMemoryClockDelta)");
+ return false;
+ }
+ if (CanSetTDP && DeviceMonitor is IMemoryClockSetDelta set) return set.SetMemoryClockDelta(memoryClockDelta);
+ return false;
+ }
+ public bool SetFanSpeedPercentage(int percent)
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("ComputeDevice", "GPU Management is disabled(SetFanSpeedPercentage)");
+ return false;
+ }
+ if (DeviceMonitor is ISetFanSpeedPercentage set) return set.SetFanSpeedPercentage(percent);
+ return false;
+ }
+ public bool ResetFanSpeed()
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("ComputeDevice", "GPU Management is disabled(ResetFanSpeed)");
+ return false;
+ }
+ if (DeviceMonitor is IResetFanSpeed set) return set.ResetFanSpeedPercentage();
+ return false;
+ }
+ public bool SetCoreVoltage(int voltage)
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("ComputeDevice", "GPU Management is disabled(SetCoreVoltage)");
+ return false;
+ }
+ if (DeviceMonitor is ICoreVoltageSet set) return set.SetCoreVoltage(voltage);
+ return false;
+ }
+ public bool ResetCoreVoltage()
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("ComputeDevice", "GPU Management is disabled(ResetCoreVoltage)");
+ return false;
+ }
+ if (DeviceMonitor is ICoreVoltageSet set) return set.ResetCoreVoltage();
+ return false;
+ }
+ public bool ResetCoreClock()
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("ComputeDevice", "GPU Management is disabled(ResetCoreClock)");
+ return false;
+ }
+ if (DeviceMonitor is ICoreClockSet set) return set.ResetCoreClock();
+ return false;
+ }
+ public bool ResetMemoryClock()
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("ComputeDevice", "GPU Management is disabled(ResetMemoryClock)");
+ return false;
+ }
+ if (DeviceMonitor is IMemoryClockSet set) return set.ResetMemoryClock();
+ return false;
+ }
+ public bool ResetCoreClockDelta()
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("ComputeDevice", "GPU Management is disabled(ResetCoreClockDelta)");
+ return false;
+ }
+ if (DeviceMonitor is ICoreClockSetDelta set) return set.ResetCoreClockDelta();
+ return false;
+ }
+ public bool ResetMemoryClockDelta()
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("ComputeDevice", "GPU Management is disabled(ResetMemoryClockDelta)");
+ return false;
+ }
+ if (DeviceMonitor is IMemoryClockSetDelta set) return set.ResetMemoryClockDelta();
+ return false;
+ }
+ public void ResetEverything()
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ Logger.Warn("ComputeDevice", "GPU Management is disabled(ResetEverything)");
+ ResetFanSpeed();
+ return;
+ }
+ if (MiscSettings.Instance.AutoResetOC)
+ {
+ ResetCoreClock();
+ ResetCoreClockDelta();
+ ResetMemoryClock();
+ ResetMemoryClockDelta();
+ ResetCoreVoltage();
+ SetPowerModeManual(TDPLimits.def);
+ }
+ ResetFanSpeed();
+ }
#endregion
@@ -405,50 +756,47 @@ public void SetDeviceConfig(DeviceConfig config)
//Enabled = config.Enabled;
Enabled = config.Enabled;
MinimumProfit = config.MinimumProfit;
- PauseMiningWhenGamingMode = config.PauseMiningWhenGamingMode;
-
- if (!DeviceMonitorManager.DisableDevicePowerModeSettings)
+ //PauseMiningWhenGamingMode = config.PauseMiningWhenGamingMode;
+
+ var tdpSimpleDefault = TDPSimpleType.HIGH;
+ var tdpSettings = config.TDPSettings;
+ if (tdpSettings != null && DeviceMonitor is ITDP tdp)
{
- var tdpSimpleDefault = TDPSimpleType.HIGH;
- var tdpSettings = config.TDPSettings;
- if (tdpSettings != null && DeviceMonitor is ITDP tdp)
- {
- tdp.SettingType = config.TDPSettings.SettingType;
- switch (config.TDPSettings.SettingType)
- {
- case TDPSettingType.PERCENTAGE:
- if (config.TDPSettings.Percentage.HasValue)
- {
- // config values are from 0.0% to 100.0%
- tdp.SetTDPPercentage(config.TDPSettings.Percentage.Value / 100);
- }
- else
- {
- tdp.SetTDPSimple(tdpSimpleDefault); // fallback
- }
- break;
- // here we decide to not allow per GPU disable state, default fallback is SIMPLE setting
- case TDPSettingType.UNSUPPORTED:
- case TDPSettingType.DISABLED:
- case TDPSettingType.SIMPLE:
- default:
- tdp.SettingType = TDPSettingType.SIMPLE;
- if (config.TDPSettings.Simple.HasValue)
- {
- tdp.SetTDPSimple(config.TDPSettings.Simple.Value);
- }
- else
- {
- tdp.SetTDPSimple(tdpSimpleDefault); // fallback
- }
- break;
- }
- }
- else if (DeviceMonitor is ITDP tdpDefault)
+ tdp.SettingType = config.TDPSettings.SettingType;
+ switch (config.TDPSettings.SettingType)
{
- tdpDefault.SetTDPSimple(tdpSimpleDefault); // set default high
+ case TDPSettingType.PERCENTAGE:
+ if (config.TDPSettings.Percentage.HasValue)
+ {
+ // config values are from 0.0% to 100.0%
+ tdp.SetTDP(config.TDPSettings.Percentage.Value / 100);
+ }
+ else
+ {
+ tdp.SetTDPSimple(tdpSimpleDefault); // fallback
+ }
+ break;
+ // here we decide to not allow per GPU disable state, default fallback is SIMPLE setting
+ case TDPSettingType.UNSUPPORTED:
+ case TDPSettingType.DISABLED:
+ case TDPSettingType.SIMPLE:
+ default:
+ tdp.SettingType = TDPSettingType.SIMPLE;
+ if (config.TDPSettings.Simple.HasValue)
+ {
+ tdp.SetTDPSimple(config.TDPSettings.Simple.Value);
+ }
+ else
+ {
+ tdp.SetTDPSimple(tdpSimpleDefault); // fallback
+ }
+ break;
}
}
+ else if (DeviceMonitor is ITDP tdpDefault)
+ {
+ tdpDefault.SetTDPSimple(tdpSimpleDefault); // set default high
+ }
if (config.PluginAlgorithmSettings == null) return;
PluginAlgorithmSettings = config.PluginAlgorithmSettings;
@@ -473,21 +821,14 @@ public DeviceConfig GetDeviceConfig()
var TDPSettings = new DeviceTDPSettings { SettingType = TDPSettingType.UNSUPPORTED };
if (DeviceMonitor is ITDP tdp)
{
- if (DeviceMonitorManager.DisableDevicePowerModeSettings)
+ TDPSettings.SettingType = tdp.SettingType;
+ if (TDPSettings.SettingType == TDPSettingType.SIMPLE)
{
- TDPSettings.SettingType = TDPSettingType.DISABLED;
+ TDPSettings.Simple = tdp.TDPSimple;
}
- else
+ if (TDPSettings.SettingType == TDPSettingType.PERCENTAGE)
{
- TDPSettings.SettingType = tdp.SettingType;
- if (TDPSettings.SettingType == TDPSettingType.SIMPLE)
- {
- TDPSettings.Simple = tdp.TDPSimple;
- }
- if (TDPSettings.SettingType == TDPSettingType.PERCENTAGE)
- {
- TDPSettings.Percentage = tdp.TDPPercentage * 100;
- }
+ TDPSettings.Percentage = tdp.TDPPercentage * 100;
}
}
var ret = new DeviceConfig
@@ -497,7 +838,7 @@ public DeviceConfig GetDeviceConfig()
Enabled = Enabled,
MinimumProfit = MinimumProfit,
TDPSettings = TDPSettings,
- PauseMiningWhenGamingMode = PauseMiningWhenGamingMode
+ //PauseMiningWhenGamingMode = PauseMiningWhenGamingMode
};
// init algo settings
foreach (var algo in AlgorithmSettings)
@@ -531,12 +872,18 @@ public DeviceConfig GetDeviceConfig()
public bool AllEnabledAlgorithmsZeroPaying()
{
+ if (MiningProfitSettings.Instance.MineRegardlessOfProfit) return false;
return AlgorithmSettings
.Where(a => a.Enabled)
.All(a => a.CurrentEstimatedProfit <= 0d);
}
public bool AnyEnabledAlgorithmsNeedBenchmarking() => AlgorithmsForBenchmark().Any();
+ public void PrepareForRebenchmark()
+ {
+ var algosToRebenchmark = AlgorithmSettings.Where(a => a.Enabled);
+ foreach(var algo in algosToRebenchmark) algo.IsReBenchmark = true;
+ }
public IEnumerable AlgorithmsForBenchmark()
{
@@ -549,7 +896,7 @@ public IEnumerable AlgorithmsForBenchmark()
public int TrySetMemoryTimings(string mtString)
{
- if(DeviceMonitor is IMemoryTimings mp)
+ if (DeviceMonitor is IMemoryTimings mp)
{
return mp.SetMemoryTimings(mtString);
}
@@ -558,7 +905,7 @@ public int TrySetMemoryTimings(string mtString)
public int TryResetMemoryTimings()
{
- if(DeviceMonitor is IMemoryTimings mp)
+ if (DeviceMonitor is IMemoryTimings mp)
{
return mp.ResetMemoryTimings();
}
@@ -571,5 +918,263 @@ public void PrintMemoryTimings()
mp.PrintMemoryTimings();
}
}
+#if NHMWS4
+ public string OCProfile
+ {
+ get
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement) return string.Empty;
+ var testTarget = AlgorithmSettings.FirstOrDefault(a => a.IsCurrentlyMining);
+ if (testTarget != null)
+ {
+ return testTarget.OCProfile;
+ }
+ return string.Empty;
+ }
+ }
+ public string OCProfileID
+ {
+ get
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement) return string.Empty;
+ var testTarget = AlgorithmSettings.FirstOrDefault(a => a.IsCurrentlyMining);
+ if (testTarget != null)
+ {
+ return testTarget.OCProfileID;
+ }
+ return string.Empty;
+ }
+ }
+ public string FanProfile
+ {
+ get
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement) return string.Empty;
+ var testTarget = AlgorithmSettings.FirstOrDefault(a => a.IsCurrentlyMining);
+ if (testTarget != null)
+ {
+ return testTarget.FanProfile;
+ }
+ return string.Empty;
+ }
+ }
+ public string FanProfileID
+ {
+ get
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement) return string.Empty;
+ var testTarget = AlgorithmSettings.FirstOrDefault(a => a.IsCurrentlyMining);
+ if (testTarget != null)
+ {
+ return testTarget.FanProfileID;
+ }
+ return string.Empty;
+ }
+ }
+ public string ELPProfile
+ {
+ get
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement) return string.Empty;
+ var testTarget = AlgorithmSettings.FirstOrDefault(a => a.IsCurrentlyMining);
+ if (testTarget != null)
+ {
+ return testTarget.ELPProfile;
+ }
+ return string.Empty;
+ }
+ }
+ public string ELPProfileID
+ {
+ get
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement) return string.Empty;
+ var testTarget = AlgorithmSettings.FirstOrDefault(a => a.IsCurrentlyMining);
+ if (testTarget != null)
+ {
+ return testTarget.ELPProfileID;
+ }
+ return string.Empty;
+ }
+ }
+ private bool HasNewTestItem(AlgorithmContainer target, string runningOC, string runningELP, string runningFAN)
+ {
+ return JsonConvert.SerializeObject(target.ActiveOCTestProfile) != runningOC ||
+ JsonConvert.SerializeObject(target.ActiveELPTestProfile) != runningELP ||
+ JsonConvert.SerializeObject(target.ActiveFanTestProfile) != runningFAN;
+ }
+ private bool HasNewItem(AlgorithmContainer target, string runningOC, string runningELP, string runningFAN)
+ {
+ return JsonConvert.SerializeObject(target.ActiveOCProfile) != runningOC ||
+ JsonConvert.SerializeObject(target.ActiveELPProfile) != runningELP ||
+ JsonConvert.SerializeObject(target.ActiveFanProfile) != runningFAN;
+ }
+
+ public async Task AfterStartMining()
+ {
+ var target = AlgorithmSettings.Where(a => a.IsCurrentlyMining)?.FirstOrDefault();
+ if (target == null) return;
+ if (!MiscSettings.Instance.EnableGPUManagement)
+ {
+ return;
+ }
+ var serializedRunningOC = JsonConvert.SerializeObject(target.RunningOcProfile);
+ var serializedRunningELP = JsonConvert.SerializeObject(target.RunningELPProfile);
+ var serializedRunningFan = JsonConvert.SerializeObject(target.RunningFanProfile);
+ if (target.HasTestProfileAndCanSet())
+ {
+ if(HasNewTestItem(target, serializedRunningOC, serializedRunningELP, serializedRunningFan))
+ {
+ ResetFanSpeed();
+ await target.ResetOcForDevice();
+ target.RunningOcProfile = null;
+ target.RunningFanProfile = null;
+ target.RunningELPProfile = null;
+ }
+
+ if (target.ActiveOCTestProfile != null)
+ {
+ await target.SetOcForDevice(target.ActiveOCTestProfile, false);
+ target.RunningOcProfile = target.ActiveOCTestProfile;
+ State = DeviceState.Testing;
+ return;
+ }
+ if (target.ActiveELPTestProfile != null)
+ {
+ State = DeviceState.Testing;
+ target.RunningELPProfile = target.ActiveELPTestProfile;
+ return;
+ }
+ if (target.ActiveFanTestProfile != null)
+ {
+ State = DeviceState.Testing;
+ target.RunningFanProfile = target.ActiveFanTestProfile;
+ return;
+ }
+ }
+ if (target.HasNormalProfileAndCanSet() && !target.HasTestProfileAndCanSet())
+ {
+ if (HasNewItem(target, serializedRunningOC, serializedRunningELP, serializedRunningFan))
+ {
+ ResetFanSpeed();
+ await target.ResetOcForDevice();
+ target.RunningOcProfile = null;
+ target.RunningELPProfile = null;
+ target.RunningFanProfile = null;
+ }
+ if (target.ActiveOCProfile != null)
+ {
+ await target.SetOcForDevice(target.ActiveOCProfile, false);
+ target.RunningOcProfile = target.ActiveOCProfile;
+ }
+ else
+ {
+ target.RunningOcProfile = null;
+ }
+ if (target.ActiveFanProfile != null)
+ {
+ target.RunningFanProfile = target.ActiveFanProfile;
+ }
+ else
+ {
+ target.RunningFanProfile = null;
+ }
+ if (target.ActiveELPProfile != null)
+ {
+ target.RunningELPProfile = target.ActiveELPProfile;
+ }
+ else
+ {
+ target.RunningELPProfile = null;
+ }
+ State = DeviceState.Mining;
+ return;
+ }
+ if(!target.HasTestProfileAndCanSet() && !target.HasNormalProfileAndCanSet())
+ {
+ if (HasNewItem(target, serializedRunningOC, serializedRunningELP, serializedRunningFan) ||
+ HasNewTestItem(target, serializedRunningOC, serializedRunningELP, serializedRunningFan)) //IF HAS NEW ITEM
+ {
+ ResetFanSpeed();
+ await target.ResetOcForDevice();
+ target.RunningOcProfile = null;
+ target.RunningFanProfile = null;
+ target.RunningELPProfile = null;
+ }
+ State = DeviceState.Mining;
+ return;
+ }
+ State = DeviceState.Mining;
+ }
+ public void SetFanSpeedWithPidController()
+ {
+ if (!MiscSettings.Instance.EnableGPUManagement) return;
+ var testTarget = AlgorithmSettings.Where(a => a.IsCurrentlyMining)?.FirstOrDefault();
+ if (testTarget == null) return;
+ var profile = testTarget.ActiveFanTestProfile ?? testTarget.ActiveFanProfile ?? null;
+ if (profile == null) return;
+
+ switch (profile.Type)
+ {
+ case 0:
+ SetFanSpeedPercentage(profile.FanSpeed);
+ return;
+ case 1:
+ SetFanSpeed(profile);
+ return;
+ case 2:
+ SetFanSpeed(profile);
+ return;
+ case 3:
+ SetFanSpeedWithLoweringMemoryClocks(profile);
+ return;
+ default:
+ return;
+ }
+ }
+
+ private void SetFanSpeed(FanProfile profile)
+ {
+ if (profile.Type == 1)
+ {
+ _pidController.SetPid(10, 0.8, 1);
+ _pidController.SetOutputLimit(100);
+ _pidController.SetReversed(true);
+ var speed = _pidController.GetOutput(Temp, profile.GpuTemp);
+ SetFanSpeedPercentage((int)speed);
+ }
+ else
+ {
+ _pidController.SetPid(10, 0.8, 1);
+ _pidController.SetOutputLimit(profile.MaxFanSpeed);
+ _pidController.SetReversed(true);
+ var speed = _pidController.GetOutput(Temp, Math.Min(profile.GpuTemp, profile.VramTemp));
+ SetFanSpeedPercentage((int)speed);
+ }
+ }
+
+ private void SetFanSpeedWithLoweringMemoryClocks(FanProfile profile)
+ {
+ _pidController.SetPid(10, 0.8, 1);
+ _pidController.SetOutputLimit(profile.MaxFanSpeed);
+ _pidController.SetReversed(true);
+ var speed = _pidController.GetOutput(Temp, Math.Min(profile.GpuTemp, profile.VramTemp));
+ SetFanSpeedPercentage((int)speed);
+
+ var deltaTemp = Math.Max(Temp, VramTemperature) - Math.Min(profile.GpuTemp, profile.VramTemp);
+ if (deltaTemp > 5) _memoryControlCounter++;
+
+ if (_memoryControlCounter >= 5)
+ {
+ _pidController.SetPid(100, 0.8, 1);
+ _pidController.SetOutputLimits(MemoryClockRange.min, MemoryClockDelta);
+ _pidController.SetReversed(false);
+ var memory_clock = _pidController.GetOutput(Temp, Math.Min(profile.GpuTemp, profile.VramTemp));
+ SetMemoryClock((int)memory_clock);
+ _memoryControlCounter = 0;
+ }
+ }
+
+#endif
}
}
diff --git a/src/NHMCore/Mining/Grouping/BenchmarkingDevice.cs b/src/NHMCore/Mining/Grouping/BenchmarkingDevice.cs
index 779e019cd..fe1358879 100644
--- a/src/NHMCore/Mining/Grouping/BenchmarkingDevice.cs
+++ b/src/NHMCore/Mining/Grouping/BenchmarkingDevice.cs
@@ -1,9 +1,11 @@
using NHM.Common;
using NHM.Common.Enums;
using NHM.MinerPlugin;
+using NHM.MinerPluginToolkitV1;
using NHM.MinerPluginToolkitV1.Interfaces;
using NHMCore.ApplicationState;
using NHMCore.Configs;
+using NHMCore.Configs.Managers;
using NHMCore.Mining.Benchmarking;
using NHMCore.Notifications;
using NHMCore.Utils;
@@ -60,8 +62,7 @@ private async Task