Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0ec8109684 | |||
| ca0d48b498 | |||
| 7eaacaddce | |||
| be63fe141b | |||
| 06907a6c8b | |||
| 7feea1421b | |||
| 5d4fd6a2ab | |||
| 35842b8ac7 |
+1
-1
@@ -3,6 +3,6 @@
|
|||||||
{registered,[]},
|
{registered,[]},
|
||||||
{included_applications,[]},
|
{included_applications,[]},
|
||||||
{applications,[stdlib,kernel]},
|
{applications,[stdlib,kernel]},
|
||||||
{vsn,"0.2.5"},
|
{vsn,"0.2.8"},
|
||||||
{modules,[gajumine,gmc_con,gmc_conf,gmc_gui,gmc_sup]},
|
{modules,[gajumine,gmc_con,gmc_conf,gmc_gui,gmc_sup]},
|
||||||
{mod,{gajumine,[]}}]}.
|
{mod,{gajumine,[]}}]}.
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(gajumine).
|
-module(gajumine).
|
||||||
-vsn("0.2.5").
|
-vsn("0.2.8").
|
||||||
-behavior(application).
|
-behavior(application).
|
||||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||||
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
||||||
|
|||||||
+26
-8
@@ -3,7 +3,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(gmc_con).
|
-module(gmc_con).
|
||||||
-vsn("0.2.5").
|
-vsn("0.2.8").
|
||||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||||
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
||||||
-license("GPL-3.0-or-later").
|
-license("GPL-3.0-or-later").
|
||||||
@@ -101,16 +101,28 @@ start_link() ->
|
|||||||
|
|
||||||
init(none) ->
|
init(none) ->
|
||||||
ok = log(info, "Starting"),
|
ok = log(info, "Starting"),
|
||||||
|
{AProcs, AMem} = proc_mem(),
|
||||||
|
TwoMaps = default_spec(mem) * 2,
|
||||||
|
RProcs =
|
||||||
|
case AProcs >= 2 of
|
||||||
|
true -> 2;
|
||||||
|
false -> 1
|
||||||
|
end,
|
||||||
|
RMem =
|
||||||
|
case AMem >= TwoMaps of
|
||||||
|
true -> TwoMaps;
|
||||||
|
false -> default_spec(mem)
|
||||||
|
end,
|
||||||
{Acc, Keys, Network, MaxCores, MaxMem} =
|
{Acc, Keys, Network, MaxCores, MaxMem} =
|
||||||
case read_conf() of
|
case read_conf() of
|
||||||
{ok, C} ->
|
{ok, C} ->
|
||||||
{maps:get(account, C, none),
|
{maps:get(account, C, none),
|
||||||
maps:get(keys, C, []),
|
maps:get(keys, C, []),
|
||||||
maps:get(network, C, <<"mainnet">>),
|
maps:get(network, C, <<"mainnet">>),
|
||||||
maps:get(max_cores, C, 2),
|
maps:get(max_cores, C, RProcs),
|
||||||
maps:get(max_mem, C, 3550722201)};
|
maps:get(max_mem, C, RMem)};
|
||||||
none ->
|
none ->
|
||||||
{none, [], <<"mainnet">>, 2, 3550722201}
|
{none, [], <<"mainnet">>, RProcs, RMem}
|
||||||
end,
|
end,
|
||||||
State = #s{network = Network, acc = Acc, keys = Keys, max_cores = MaxCores, max_mem = MaxMem},
|
State = #s{network = Network, acc = Acc, keys = Keys, max_cores = MaxCores, max_mem = MaxMem},
|
||||||
{ok, start_gui(State)}.
|
{ok, start_gui(State)}.
|
||||||
@@ -217,7 +229,8 @@ do_start_stop(#s{acc = PubKey, keys = Keys, network = Network, max_cores = MaxCo
|
|||||||
% Check avx2.
|
% Check avx2.
|
||||||
% Both should be provided by the F# start program
|
% Both should be provided by the F# start program
|
||||||
case Network of
|
case Network of
|
||||||
<<"mainnet">> -> {"mean", "avx2.exe"};
|
% <<"mainnet">> -> {"mean", "avx2.exe"};
|
||||||
|
<<"mainnet">> -> {"mean", "generic.exe"};
|
||||||
<<"testnet">> -> {"mean", "generic.exe"}
|
<<"testnet">> -> {"mean", "generic.exe"}
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@@ -252,7 +265,7 @@ optimize_count(MaxC, MaxM) ->
|
|||||||
MaxMem = max(MapSize, MaxM),
|
MaxMem = max(MapSize, MaxM),
|
||||||
{Procs, Memory} = proc_mem(),
|
{Procs, Memory} = proc_mem(),
|
||||||
MeanMaps = min(MaxMem, Memory) div MapSize,
|
MeanMaps = min(MaxMem, Memory) div MapSize,
|
||||||
Recommended = min(MaxCores, max(min(Procs, MeanMaps) - 1, 1)),
|
Recommended = min(MaxCores, min(Procs, MeanMaps)),
|
||||||
Notice = fun(F, A) -> gmc_gui:message({notice, io_lib:format(F, A)}) end,
|
Notice = fun(F, A) -> gmc_gui:message({notice, io_lib:format(F, A)}) end,
|
||||||
ok = Notice("Physical Processors: ~p", [Procs]),
|
ok = Notice("Physical Processors: ~p", [Procs]),
|
||||||
ok = Notice("Physical Memory: ~p", [Memory]),
|
ok = Notice("Physical Memory: ~p", [Memory]),
|
||||||
@@ -270,8 +283,13 @@ platform_dir() ->
|
|||||||
{unix, linux} ->
|
{unix, linux} ->
|
||||||
"linux_x86_64";
|
"linux_x86_64";
|
||||||
{unix, darwin} ->
|
{unix, darwin} ->
|
||||||
% TODO: Check M2 vs x86
|
case erlang:system_info(system_architecture) of
|
||||||
"mac_m2";
|
"aarch64-" ++ _ ->
|
||||||
|
"mac_arm64";
|
||||||
|
Other ->
|
||||||
|
ok = log(info, "system_architecture: ~p", [Other]),
|
||||||
|
"mac_x86_64"
|
||||||
|
end;
|
||||||
{win32, nt} ->
|
{win32, nt} ->
|
||||||
"win_x86_64"
|
"win_x86_64"
|
||||||
end,
|
end,
|
||||||
|
|||||||
+7
-7
@@ -3,7 +3,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(gmc_conf).
|
-module(gmc_conf).
|
||||||
-vsn("0.2.5").
|
-vsn("0.2.8").
|
||||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||||
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
||||||
-license("GPL-3.0-or-later").
|
-license("GPL-3.0-or-later").
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
net = none :: none | wx:wx_object(),
|
net = none :: none | wx:wx_object(),
|
||||||
acc = none :: none | wx:wx_object(),
|
acc = none :: none | wx:wx_object(),
|
||||||
keys = none :: none | wx:wx_object(),
|
keys = none :: none | wx:wx_object(),
|
||||||
cores = none :: none | wx:wx_object(),
|
cores = 2 :: pos_integer(),
|
||||||
memory = none :: none | wx:wx_object()}).
|
memory = 3550722201 :: pos_integer()}).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -213,16 +213,16 @@ done(State = #s{net = Network, acc = AccTx, keys = KeysTx, cores = CoresTx, memo
|
|||||||
buh_bye(State).
|
buh_bye(State).
|
||||||
|
|
||||||
cores("") ->
|
cores("") ->
|
||||||
none;
|
2;
|
||||||
cores(CoreS) ->
|
cores(CoreS) ->
|
||||||
try
|
try
|
||||||
list_to_integer(CoreS)
|
list_to_integer(CoreS)
|
||||||
catch
|
catch
|
||||||
_:_ -> none
|
_:_ -> 2
|
||||||
end.
|
end.
|
||||||
|
|
||||||
bytes("") ->
|
bytes("") ->
|
||||||
none;
|
3550722201;
|
||||||
bytes(GigsS) ->
|
bytes(GigsS) ->
|
||||||
try
|
try
|
||||||
list_to_integer(GigsS) * gig()
|
list_to_integer(GigsS) * gig()
|
||||||
@@ -231,7 +231,7 @@ bytes(GigsS) ->
|
|||||||
try
|
try
|
||||||
trunc(list_to_float(GigsS) * gig())
|
trunc(list_to_float(GigsS) * gig())
|
||||||
catch
|
catch
|
||||||
_:_ -> none
|
_:_ -> 3550722201
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(gmc_gui).
|
-module(gmc_gui).
|
||||||
-vsn("0.2.5").
|
-vsn("0.2.8").
|
||||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||||
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
||||||
-license("GPL-3.0-or-later").
|
-license("GPL-3.0-or-later").
|
||||||
@@ -277,7 +277,7 @@ do_message({pool_notification, #{info := #{msg := MSG}}}, State = #s{height = He
|
|||||||
ok = wxStaticText:setLabel(CandT, Candidate),
|
ok = wxStaticText:setLabel(CandT, Candidate),
|
||||||
State;
|
State;
|
||||||
#{solution_accepted := #{seq := Seq}} ->
|
#{solution_accepted := #{seq := Seq}} ->
|
||||||
Entry = io_lib:format("~nSolution Accepted! You solved one! Sequence: ~w", [Seq]),
|
Entry = io_lib:format("~nThe hive has produced a solution! Sequence: ~w", [Seq]),
|
||||||
do_message2(Entry, State);
|
do_message2(Entry, State);
|
||||||
Other ->
|
Other ->
|
||||||
Entry = io_lib:format("~nUnexpected 'pool_notification': ~tp", [Other]),
|
Entry = io_lib:format("~nUnexpected 'pool_notification': ~tp", [Other]),
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(gmc_sup).
|
-module(gmc_sup).
|
||||||
-vsn("0.2.5").
|
-vsn("0.2.8").
|
||||||
-behaviour(supervisor).
|
-behaviour(supervisor).
|
||||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||||
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
{prefix,"gmc"}.
|
{prefix,"gmc"}.
|
||||||
{author,"Craig Everett"}.
|
{author,"Craig Everett"}.
|
||||||
{desc,"Mining client for the Gajumaru Root"}.
|
{desc,"Mining client for the Gajumaru Root"}.
|
||||||
{package_id,{"qpq","gajumine",{0,2,5}}}.
|
{package_id,{"qpq","gajumine",{0,2,8}}}.
|
||||||
{deps,[{"uwiger","gmhive_client",{0,4,4}},
|
{deps,[{"uwiger","gmhive_worker",{0,4,0}},
|
||||||
|
{"qpq","cuckoo_cpu",{0,3,1}},
|
||||||
|
{"uwiger","gmhive_client",{0,4,4}},
|
||||||
{"uwiger","gmcuckoo",{1,2,3}},
|
{"uwiger","gmcuckoo",{1,2,3}},
|
||||||
{"qpq","cuckoo_cpu",{0,3,0}},
|
|
||||||
{"uwiger","gmhive_worker",{0,3,0}},
|
|
||||||
{"uwiger","gmconfig",{0,1,2}},
|
{"uwiger","gmconfig",{0,1,2}},
|
||||||
{"uwiger","gproc",{1,0,1}},
|
{"uwiger","gproc",{1,0,1}},
|
||||||
{"uwiger","gmhive_protocol",{0,1,1}},
|
{"uwiger","gmhive_protocol",{0,1,1}},
|
||||||
|
|||||||
Reference in New Issue
Block a user