Skip to content

Commit

Permalink
Add the two rx modes to ar_bench_hash
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesPiechota committed Sep 10, 2024
1 parent 04464c2 commit 177f91c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/arweave/src/ar_bench_hash.erl
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@
-include_lib("arweave/include/ar_config.hrl").

run_benchmark_from_cli(Args) ->
RandomX = get_flag_value(Args, "randomx", "512"),
JIT = list_to_integer(get_flag_value(Args, "jit", "1")),
LargePages = list_to_integer(get_flag_value(Args, "large_pages", "1")),
HardwareAES = list_to_integer(get_flag_value(Args, "hw_aes", "1")),

RandomXMode = case RandomX of
"512" -> rx512;
"4096" -> rx4096;
_ -> show_help()
end,

Schedulers = erlang:system_info(dirty_cpu_schedulers_online),
RandomXState = ar_mine_randomx:init_fast2(
rx512, ?RANDOMX_PACKING_KEY, JIT, LargePages, Schedulers),
RandomXMode, ?RANDOMX_PACKING_KEY, JIT, LargePages, Schedulers),
{H0, H1} = run_benchmark(RandomXState, JIT, LargePages, HardwareAES),
H0String = io_lib:format("~.3f", [H0 / 1000]),
H1String = io_lib:format("~.3f", [H1 / 1000]),
Expand All @@ -28,6 +35,7 @@ get_flag_value([_ | Tail], TargetFlag, DefaultValue) ->
show_help() ->
io:format("~nUsage: benchmark-hash [options]~n"),
io:format("Options:~n"),
io:format(" randomx <512|4096> (default: 512)~n"),
io:format(" jit <0|1> (default: 1)~n"),
io:format(" large_pages <0|1> (default: 1)~n"),
io:format(" hw_aes <0|1> (default: 1)~n"),
Expand Down

0 comments on commit 177f91c

Please sign in to comment.