Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

445 add srbmulti cpu #447

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions build/api/miners/srbcpu.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function Global:Get-StatsSrbcpu {
$Request = Global:Get-HTTP -Server $global:Server -Port $global:Port
if ($Request) {
try { $Data = $Request.Content | ConvertFrom-Json -ErrorAction Stop }
Catch { Write-Host "Failed To parse API" -ForegroundColor Red; Break }
if ($Data) {
$global:RAW += $Data.algorithms.hashrate.'1min';
$global:CPUKHS = $Data.algorithms.hashrate.'1min' / 1000
Global:Write-MinerData2;
catch { Write-Host "Failed To parse Threads" -ForegroundColor Red };
$global:MinerACC = $Data.algorithms.shares.accepted; $global:ALLACC += $Data.algorithms.shares.accepted
$global:MinerREJ = $Data.algorithms.shares.rejected; $global:ALLREJ += $Data.algorithms.shares.rejected
}
}
else { Global:Set-APIFailure }
}
2 changes: 1 addition & 1 deletion build/api/miners/srbmulti.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function Global:Get-StatsSrbmulti {
}
catch { Write-Host "Failed To parse Threads" -ForegroundColor Red };
$global:MinerACC = $Data.algorithms.shares.accepted; $global:ALLACC += $Data.algorithms.shares.accepted
$global:MinerREJ = $Data.algorithms.shares.rejected; $global:ALLREG += $Data.algorithms.shares.rejected
$global:MinerREJ = $Data.algorithms.shares.rejected; $global:ALLREJ += $Data.algorithms.shares.rejected
$Hash | ForEach-Object { $global:GPUKHS += [Double]$_ / 1000 }
}
}
Expand Down
1 change: 1 addition & 0 deletions build/powershell/control/launchcode.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ function Global:Start-LaunchCode($MinerCurrent, $AIP) {
if ($MinerCurrent.Devices -eq '') { $MinerArguments = "$($MinerCurrent.Arguments)" }
elseif ($MinerCurrent.DeviceCall -eq "cpuminer-opt") { $MinerArguments = "-t $($MinerCurrent.Devices) $($MinerCurrent.Arguments)" }
elseif ($MinerCurrent.DeviceCall -eq "xmrig-opt") { $MinerArguments = "-t $($MinerCurrent.Devices) $($MinerCurrent.Arguments)" }
elseif ($MinerCurrent.DeviceCall -eq "srbmulti-cpu") { $MinerArguments = "--cpu-threads $($MinerCurrent.Devices) $($MinerCurrent.Arguments)" }
}
}

Expand Down
52 changes: 30 additions & 22 deletions build/powershell/scripts/background.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

param(
# Parameter help description
[Parameter(mandatory=$false)]
[Parameter(mandatory = $false)]
[string]$WorkingDir
)

Expand All @@ -30,7 +30,7 @@ if ($isWindows) {
}
#$WorkingDir = "C:\Users\Mayna\Documents\GitHub\SWARM"
#$WorkingDir = "/SWARM"
if($IsLinux){
if ($IsLinux) {
$env:SWARM_DIR = $WorkingDir;
}
Set-Location $env:SWARM_DIR
Expand All @@ -41,7 +41,7 @@ $Global:config = [hashtable]::Synchronized(@{ })
$global:config.Add("vars", @{ })
. .\build\powershell\global\modules.ps1
$(vars).Add("dir", $env:SWARM_DIR)
if($isWindows){$env:Path += ";$($(vars).dir)\build\cmd"}
if ($isWindows) { $env:Path += ";$($(vars).dir)\build\cmd" }

try { if ((Get-MpPreference).ExclusionPath -notcontains (Convert-Path .)) { Start-Process "powershell" -Verb runAs -ArgumentList "Add-MpPreference -ExclusionPath `'$WorkingDir`'" -WindowStyle Minimized } }catch { }
try { $Net = Get-NetFireWallRule } catch { }
Expand Down Expand Up @@ -134,8 +134,8 @@ if (Test-Path $CheckForSWARM) {
}
$(vars).ADD("GCount", (Get-Content ".\debug\devicelist.txt" | ConvertFrom-Json))
$(vars).ADD("BusData", @{})
if(Test-Path ".\debug\busdata.txt") { $(vars).BusData = (Get-Content ".\debug\busdata.txt" | ConvertFrom-Json) }
$(vars).BusData = $(vars).BusData | Where-Object {$_.brand -ne "cpu"}
if (Test-Path ".\debug\busdata.txt") { $(vars).BusData = (Get-Content ".\debug\busdata.txt" | ConvertFrom-Json) }
$(vars).BusData = $(vars).BusData | Where-Object { $_.brand -ne "cpu" }
$(vars).ADD("BackgroundTimer", (New-Object -TypeName System.Diagnostics.Stopwatch))
$(vars).ADD("watchdog_start", (Get-Date))
$(vars).ADD("watchdog_triggered", $false)
Expand Down Expand Up @@ -590,6 +590,14 @@ While ($True) {
}
catch { Global:Get-OhNo }
}
'srbmulti-cpu' {
try {
Global:Add-Module "$($(vars).miners)\srbcpu.psm1";
Global:Get-StatsSrbcpu
Remove-Module -name "srbcpu"
}
catch { Global:Get-OhNo }
}
}

##Check To See if High Rejections
Expand Down Expand Up @@ -730,24 +738,24 @@ While ($True) {
summary = $global:MinerTable;
}
$global:Config.stats = @{
gpus = @($global:GPUHashTable);
cpus = @($global:CPUHashTable);
asics = @($global:ASICHashTable);
cpu_total = $global:CPUKHS;
asic_total = $global:ASICKHS;
gpus = @($global:GPUHashTable);
cpus = @($global:CPUHashTable);
asics = @($global:ASICHashTable);
cpu_total = $global:CPUKHS;
asic_total = $global:ASICKHS;
gpu_total_khs = ($global:AllRAW / 1000)
algo = $Global:StatAlgo;
uptime = $global:UPTIME;
hsu = "hs";
fans = @($global:GPUFanTable);
temps = @($global:GPUTempTable);
power = @($global:GPUPowerTable);
accepted = $global:AllACC;
rejected = $global:AllREJ;
stratum = $Global:StatStratum;
start_time = $Global:StartTime;
workername = $Global:StatWorker;
bus_numbers = @($global:Bus_Numbers);
algo = $Global:StatAlgo;
uptime = $global:UPTIME;
hsu = "hs";
fans = @($global:GPUFanTable);
temps = @($global:GPUTempTable);
power = @($global:GPUPowerTable);
accepted = $global:AllACC;
rejected = $global:AllREJ;
stratum = $Global:StatStratum;
start_time = $Global:StartTime;
workername = $Global:StatWorker;
bus_numbers = @($global:Bus_Numbers);
}
$global:Config.params = $(arg)

Expand Down
132 changes: 132 additions & 0 deletions config/miners/srbmulti-cpu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
"name": "srbmulti-cpu",
"CPU": {
"name": "CPU",
"delay": "1",
"prestart": [],
"commands": {
"cpupower": "",
"argon2d16000": "",
"argon2dyn": "",
"blake2b": "",
"blake2s": "",
"cryptonight-gpu": "",
"cryptonight-upx": "",
"curvehash": "",
"ghostrider": "",
"heavyhash": "",
"mike": "",
"minotaurx": "",
"minotaur": "",
"randomarq": "",
"randomx": "",
"scryptn2": "",
"yespower": "",
"yespowermgpc": "",
"yespowerr16": "",
"yespowersugar": "",
"yespowertide": "",
"yespowerurx": "",
"sha3d": "",
"sha512256d": "",
"ubqhash": "",
"verthash": "",
"yescrypt": "",
"yescryptr16": "",
"yescryptr32": ""
},
"difficulty": {
"cpupower": "",
"argon2d16000": "",
"argon2dyn": "",
"blake2b": "",
"blake2s": "",
"cryptonight-gpu": "",
"cryptonight-upx": "",
"curvehash": "",
"ghostrider": "",
"heavyhash": "",
"mike": "",
"minotaurx": "",
"minotaur": "",
"randomarq": "",
"randomx": "",
"scryptn2": "",
"yespower": "",
"yespowermgpc": "",
"yespowerr16": "",
"yespowersugar": "",
"yespowertide": "",
"yespowerurx": "",
"sha3d": "",
"sha512256d": "",
"ubqhash": "",
"verthash": "",
"yescrypt": "",
"yescryptr16": "",
"yescryptr32": ""
},
"naming": {
"cpupower": "cpupower",
"argon2d16000": "argon2d_16000",
"argon2dyn": "argon2d_dynamic",
"blake2b": "blake2b",
"blake2s": "blake2s",
"cryptonight-gpu": "cryptonight_gpu",
"cryptonight-upx": "cryptonight_upx",
"curvehash": "curvehash",
"ghostrider": "ghostrider",
"heavyhash": "heavyhash",
"mike": "mike",
"minotaurx": "minotaurx",
"minotaur": "minotaur",
"randomarq": "randomarq",
"randomx": "randomx",
"scryptn2": "scryptn2",
"yespower": "yespower",
"yespowermgpc": "yespowermgpc",
"yespowerr16": "yespowerr16",
"yespowersugar": "yespowersugar",
"yespowertide": "yespowertide",
"yespowerurx": "yespowerurx",
"sha512256d": "sha512_256d_radiant",
"sha3d": "sha3d",
"ubqhash": "ubqhash",
"verthash": "verthash",
"yescrypt": "yescrypt",
"yescryptr16": "yescryptr16",
"yescryptr32": "yescryptr32"
},
"fee": {
"cpupower": 0.85,
"argon2d16000": 0.85,
"argon2dyn": 0.85,
"blake2b": 0.85,
"blake2s": 0.85,
"cryptonight-gpu": 0.85,
"cryptonight-upx": 0.85,
"curvehash": 0.85,
"ghostrider": 0.85,
"heavyhash": 0.85,
"mike": 0.85,
"minotaurx": 0.85,
"minotaur": 0.85,
"randomarq": 0.85,
"randomx": 0.85,
"scryptn2": 0.85,
"sha512256d": 1,
"yespower": 0.85,
"yespowermgpc": 0.85,
"yespowerr16": 0.85,
"yespowersugar": 0.85,
"yespowertide": 0.85,
"yespowerurx": 0.85,
"sha3d": 0.85,
"ubqhash": 0.85,
"verthash": 0.85,
"yescrypt": 0.85,
"yescryptr16": 0.85,
"yescryptr32": 0.85
}
}
}
9 changes: 9 additions & 0 deletions config/update/cpu-linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,14 @@
"version": "1.0",
"optional": "No",
"uri": "https://github.com/MaynardMiner/MM.Compiled-Miners/releases/download/v8.0/cpupower-linux.tar.gz"
},
"srbmulti-cpu": {
"name": "srbmulti-cpu",
"type": "cpu",
"CPU": ".\\bin\\srbmulti-cpu-1\\SRBMiner-MULTI",
"minername": "SRBMiner-MULTI",
"version": "1.1.1",
"optional": "No",
"uri": "https://github.com/doktor83/SRBMiner-Multi/releases/download/1.1.1/SRBMiner-Multi-1-1-1-Linux.tar.xz"
}
}
9 changes: 9 additions & 0 deletions config/update/cpu-win.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,14 @@
"version": "1.0",
"optional": "No",
"uri": "https://github.com/cpu-pool/cpuminer-opt-cpupower/releases/download/v1.0/Cpuminer-opt-cpupower-win64.zip"
},
"srbmulti-cpu": {
"name": "srbmulti-cpu",
"type": "cpu",
"CPU": ".\\bin\\srbmulti-cpu-1\\SRBMiner-MULTI.exe",
"minername": "SRBMiner-MULTI.exe",
"version": "1.1.1",
"optional": "No",
"uri": "https://github.com/doktor83/SRBMiner-Multi/releases/download/1.1.1/SRBMiner-Multi-1-1-1-win64.zip"
}
}
105 changes: 105 additions & 0 deletions miners/cpu/srbmulti-cpu.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
. .\build\powershell\global\miner_stat.ps1;
. .\build\powershell\global\modules.ps1;
$(vars).CPUTypes | ForEach-Object {

$ConfigType = $_;

$CName = "srbmulti-cpu";

##Miner Path Information
if ($(vars).cpu.$CName.$ConfigType) { $Path = "$($(vars).cpu.$CName.$ConfigType)" }
else { $Path = "None" }
if ($(vars).cpu.$CName.uri) { $Uri = "$($(vars).cpu.$CName.uri)" }
else { $Uri = "None" }
if ($(vars).cpu.$CName.minername) { $MinerName = "$($(vars).cpu.$CName.minername)" }
else { $MinerName = "None" }

$Name = "$CName";

##Log Directory
$Log = Join-Path $($(vars).dir) "logs\$Name.log"

##Parse -CPUThreads
if ($(arg).CPUThreads -ne '') { $Devices = $(arg).CPUThreads }

##Get Configuration File
##This is located in config\miners
$MinerConfig = $Global:config.miners.$CName

##Export would be /path/to/[SWARMVERSION]/build/export##
$ExportDir = "/usr/local/swarm/lib64"
$Miner_Dir = Join-Path ($(vars).dir) ((Split-Path $Path).replace(".", ""))

##Prestart actions before miner launch
##This can be edit in miner.json
$Prestart = @()
#if ($IsLinux) { $Prestart += "export LD_PRELOAD=/usr/local/swarm/lib64/libcurl.so.3" }
$PreStart += "unset LD_LIBRARY_PATH"
if ($IsLinux) { $Prestart += "export DISPLAY=:0" }
$MinerConfig.$ConfigType.prestart | ForEach-Object { $Prestart += "$($_)" }

if ($(vars).Coins) { $Pools = $(vars).CoinPools } else { $Pools = $(vars).AlgoPools }

if ($(vars).Bancount -lt 1) { $(vars).Bancount = 5 }

##Build Miner Settings
$MinerConfig.$ConfigType.commands | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name | ForEach-Object {

$MinerAlgo = $_

if (
$MinerAlgo -in $(vars).Algorithm -and
$Name -notin $global:Config.Pool_Algos.$MinerAlgo.exclusions -and
$ConfigType -notin $global:Config.Pool_Algos.$MinerAlgo.exclusions -and
$Name -notin $(vars).BanHammer
) {
$StatAlgo = $MinerAlgo -replace "`_", "`-"
$Stat = Global:Get-Stat -Name "$($Name)_$($StatAlgo)_hashrate"
if ($(arg).Rej_Factor -eq "Yes" -and $Stat.Rejections -gt 0 -and $Stat.Rejection_Periods -ge 3) { $HashStat = $Stat.Hour * (1 - ($Stat.Rejections * 0.01)) }
else { $HashStat = $Stat.Hour }
$Pools | Where-Object Algorithm -eq $MinerAlgo | ForEach-Object {
$Nicehash = ""
if($_.Name -eq "Nicehash") {
$Nicehash = "--Nicehash true "
}
$Diff = ""
if ($MinerConfig.$ConfigType.difficulty.$($_.Algorithm)) {
switch($_.Name) {
"zergpool" { $Diff = ",sd=$($MinerConfig.$ConfigType.difficulty.$($_.Algorithm))" }
default { $Diff = ",d=$($MinerConfig.$ConfigType.difficulty.$($_.Algorithm))" }
}
}
[PSCustomObject]@{
MName = $Name
Coin = $(vars).Coins
Delay = $MinerConfig.$ConfigType.delay
Fees = $MinerConfig.$ConfigType.fee.$($_.Algorithm)
Symbol = "$($_.Symbol)"
MinerName = $MinerName
Prestart = $PreStart
Type = $ConfigType
Path = $Path
Devices = $Devices
Stratum = "$($_.Protocol)://$($_.Pool_Host):$($_.Port)"
Version = "$($(vars).cpu.$CName.version)"
DeviceCall = "srbmulti-cpu"
Arguments = "$Nicehash--disable-gpu --cpu-threads-priority $($(arg).cpu_priority) --disable-worker-watchdog --algorithm $($MinerConfig.$ConfigType.naming.$($_.Algorithm)) --pool $($_.Pool_Host):$($_.Port) --wallet $($_.User1) --password $($_.Pass1)$Diff --api-enable --log-file `'$Log`' --api-port 10001 $($MinerConfig.$ConfigType.commands.$($_.Algorithm))"
HashRates = [Decimal]$Stat.Hour
HashRate_Adjusted = [Decimal]$Hashstat
Quote = $_.Price
Rejections = $Stat.Rejections
Power = if ($(vars).Watts.$($_.Algorithm)."$($ConfigType)_Watts") { $(vars).Watts.$($_.Algorithm)."$($ConfigType)_Watts" }elseif ($(vars).Watts.default."$($ConfigType)_Watts") { $(vars).Watts.default."$($ConfigType)_Watts" }else { 0 }
MinerPool = "$($_.Name)"
Port = 10001
Worker = $Rig
API = "srbmulti-cpu"
Wallet = "$($_.$User)"
URI = $Uri
Server = "localhost"
Algo = "$($_.Algorithm)"
Log = "miner_generated"
}
}
}
}
}