#!/usr/bin/env bash
|
|
|
|
# Created by argbash-init v2.10.0
|
|
# ARG_OPTIONAL_BOOLEAN([asm])
|
|
# ARG_OPTIONAL_BOOLEAN([multi_threads])
|
|
# ARG_HELP([<Hyperplonk benchmarks>])
|
|
# ARGBASH_GO()
|
|
# needed because of Argbash --> m4_ignore([
|
|
### START OF CODE GENERATED BY Argbash v2.10.0 one line above ###
|
|
# Argbash is a bash code generator used to get arguments parsing right.
|
|
# Argbash is FREE SOFTWARE, see https://argbash.io for more info
|
|
|
|
|
|
die()
|
|
{
|
|
local _ret="${2:-1}"
|
|
test "${_PRINT_HELP:-no}" = yes && print_help >&2
|
|
echo "$1" >&2
|
|
exit "${_ret}"
|
|
}
|
|
|
|
|
|
begins_with_short_option()
|
|
{
|
|
local first_option all_short_options='h'
|
|
first_option="${1:0:1}"
|
|
test "$all_short_options" = "${all_short_options/$first_option/}" && return 1 || return 0
|
|
}
|
|
|
|
# THE DEFAULTS INITIALIZATION - OPTIONALS
|
|
_arg_asm="off"
|
|
_arg_multi_threads="off"
|
|
|
|
|
|
print_help()
|
|
{
|
|
printf '%s\n' "<Hyperplonk benchmarks>"
|
|
printf 'Usage: %s [--(no-)asm] [--(no-)multi_threads] [-h|--help]\n' "$0"
|
|
printf '\t%s\n' "-h, --help: Prints help"
|
|
}
|
|
|
|
|
|
parse_commandline()
|
|
{
|
|
while test $# -gt 0
|
|
do
|
|
_key="$1"
|
|
case "$_key" in
|
|
--no-asm|--asm)
|
|
_arg_asm="on"
|
|
test "${1:0:5}" = "--no-" && _arg_asm="off"
|
|
;;
|
|
--no-multi_threads|--multi_threads)
|
|
_arg_multi_threads="on"
|
|
test "${1:0:5}" = "--no-" && _arg_multi_threads="off"
|
|
;;
|
|
-h|--help)
|
|
print_help
|
|
exit 0
|
|
;;
|
|
-h*)
|
|
print_help
|
|
exit 0
|
|
;;
|
|
*)
|
|
_PRINT_HELP=yes die "FATAL ERROR: Got an unexpected argument '$1'" 1
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
}
|
|
|
|
parse_commandline "$@"
|
|
|
|
# OTHER STUFF GENERATED BY Argbash
|
|
|
|
### END OF CODE GENERATED BY Argbash (sortof) ### ])
|
|
# [ <-- needed because of Argbash
|
|
|
|
cargo clean
|
|
|
|
if [ "$_arg_multi_threads" = on ]
|
|
then
|
|
echo "Multi-threads: ON"
|
|
# Do nothing
|
|
else
|
|
echo "Multi-threads: OFF"
|
|
export RAYON_NUM_THREADS=1
|
|
fi
|
|
|
|
if [ "$_arg_asm" = on ]
|
|
then
|
|
echo "Asm feature: ON"
|
|
export RUSTFLAGS="-C target-feature=+bmi2,+adx"
|
|
else
|
|
echo "Asm feature: OFF"
|
|
# Do nothing
|
|
fi
|
|
|
|
# Run the benchmark binary
|
|
cargo bench
|
|
|
|
|
|
# ^^^ TERMINATE YOUR CODE BEFORE THE BOTTOM ARGBASH MARKER ^^^
|
|
|
|
# ] <-- needed because of Argbash
|