You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.0 KiB

2 years ago
  1. #!/usr/bin/env bash
  2. # Created by argbash-init v2.10.0
  3. # ARG_OPTIONAL_BOOLEAN([asm])
  4. # ARG_OPTIONAL_BOOLEAN([multi_threads])
  5. # ARG_HELP([<Hyperplonk benchmarks>])
  6. # ARGBASH_GO()
  7. # needed because of Argbash --> m4_ignore([
  8. ### START OF CODE GENERATED BY Argbash v2.10.0 one line above ###
  9. # Argbash is a bash code generator used to get arguments parsing right.
  10. # Argbash is FREE SOFTWARE, see https://argbash.io for more info
  11. die()
  12. {
  13. local _ret="${2:-1}"
  14. test "${_PRINT_HELP:-no}" = yes && print_help >&2
  15. echo "$1" >&2
  16. exit "${_ret}"
  17. }
  18. begins_with_short_option()
  19. {
  20. local first_option all_short_options='h'
  21. first_option="${1:0:1}"
  22. test "$all_short_options" = "${all_short_options/$first_option/}" && return 1 || return 0
  23. }
  24. # THE DEFAULTS INITIALIZATION - OPTIONALS
  25. _arg_asm="off"
  26. _arg_multi_threads="off"
  27. print_help()
  28. {
  29. printf '%s\n' "<Hyperplonk benchmarks>"
  30. printf 'Usage: %s [--(no-)asm] [--(no-)multi_threads] [-h|--help]\n' "$0"
  31. printf '\t%s\n' "-h, --help: Prints help"
  32. }
  33. parse_commandline()
  34. {
  35. while test $# -gt 0
  36. do
  37. _key="$1"
  38. case "$_key" in
  39. --no-asm|--asm)
  40. _arg_asm="on"
  41. test "${1:0:5}" = "--no-" && _arg_asm="off"
  42. ;;
  43. --no-multi_threads|--multi_threads)
  44. _arg_multi_threads="on"
  45. test "${1:0:5}" = "--no-" && _arg_multi_threads="off"
  46. ;;
  47. -h|--help)
  48. print_help
  49. exit 0
  50. ;;
  51. -h*)
  52. print_help
  53. exit 0
  54. ;;
  55. *)
  56. _PRINT_HELP=yes die "FATAL ERROR: Got an unexpected argument '$1'" 1
  57. ;;
  58. esac
  59. shift
  60. done
  61. }
  62. parse_commandline "$@"
  63. # OTHER STUFF GENERATED BY Argbash
  64. ### END OF CODE GENERATED BY Argbash (sortof) ### ])
  65. # [ <-- needed because of Argbash
  66. cargo clean
  67. if [ "$_arg_multi_threads" = on ]
  68. then
  69. echo "Multi-threads: ON"
  70. # Do nothing
  71. else
  72. echo "Multi-threads: OFF"
  73. export RAYON_NUM_THREADS=1
  74. fi
  75. if [ "$_arg_asm" = on ]
  76. then
  77. echo "Asm feature: ON"
  78. export RUSTFLAGS="-C target-feature=+bmi2,+adx"
  79. else
  80. echo "Asm feature: OFF"
  81. # Do nothing
  82. fi
  83. # Run the benchmark binary
  84. cargo bench
  85. # ^^^ TERMINATE YOUR CODE BEFORE THE BOTTOM ARGBASH MARKER ^^^
  86. # ] <-- needed because of Argbash