run.sh 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #!/bin/bash
  2. fast=false
  3. sequential=false
  4. ncpus=""
  5. cpurange=""
  6. while [ -n "$1" ]; do
  7. if [ "$1" == "--fast" ]; then
  8. fast=true
  9. elif [ "$1" == "-s" ]; then
  10. sequential=true
  11. elif [ "$1" == "-n" ]; then
  12. ncpus="$2"
  13. shift
  14. elif [ "$1" == "-N" ]; then
  15. cpurange="$2"
  16. shift
  17. fi
  18. shift
  19. done
  20. if [ -z "$ncpus" ]; then
  21. ncpus=$(nproc)
  22. fi
  23. if [ -z "$cpurange" ]; then
  24. cpurange="0-$((ncpus - 1))"
  25. fi
  26. abort() {
  27. echo "Step $1 failed."
  28. echo "To restart from this step, try running:"
  29. if [ "$1" == "setup" ]; then
  30. echo " rm -rf belarus-2020-2021 cmz lox-new lox-old sigma-compiler simga-proofs spongefish"
  31. elif [ "$1" == "belarus" ]; then
  32. echo " rm -rf appendix-a-results.{pdf,tex} section-3-results"
  33. echo " docker stop tp-belarus"
  34. echo " docker rm tp-belarus"
  35. elif [ "$1" == "lox-gen" ]; then
  36. echo " rm -rf parsing-results/{lox-{old,new},troll-patrol}"
  37. echo " docker stop {lox-{old,new},troll-patrol}-{trust_levels,invitations,blockage_migration{05,50,100}}.log troll-patrol-reporting.log"
  38. echo " docker rm {lox-{old,new},troll-patrol}-{trust_levels,invitations,blockage_migration{05,50,100}}.log troll-patrol-reporting.log"
  39. elif [ "$1" == "lox-eval" ]; then
  40. echo " rm -f appendix-b-results.{pdf,tex} table-{2,3}-results.{pdf,tex}"
  41. echo " docker stop tp-lox"
  42. echo " docker rm tp-lox"
  43. fi
  44. echo "Then run this script again."
  45. echo "Exiting..."
  46. exit 1
  47. }
  48. if [ -z "$(command -v numactl)" ]; then
  49. echo "This script uses numactl to isolate each experiment to a single processing unit."
  50. echo "You do not seem to have numactl installed. You can still run this script without numactl, but this may affect the results."
  51. read -p "Continue without numactl? [y/N] " confirm
  52. confirm=$(echo "$confirm" | tr '[:lower:]' '[:upper:]')
  53. if [[ "$confirm" != "Y" && "$confirm" != "YES" ]]; then
  54. exit 1
  55. else
  56. echo "Continuing without numactl"
  57. fi
  58. fi
  59. # Set up dockers
  60. if [ ! -d troll-patrol ]; then
  61. # Clean up any remnants of previous attempts and try again
  62. rm -rf belarus-2020-2021 cmz lox-new lox-old sigma-compiler simga-proofs spongefish
  63. # Set up our dockers
  64. ./scripts/setup.sh || abort "setup"
  65. fi
  66. # Get Belarus results
  67. if [[ ! -f appendix-a-results.pdf || ! -f section-3-results ]]; then
  68. # Clean up any remnants of previous attempts and try again
  69. rm -f appendix-a-results.{pdf,tex} section-3-results
  70. if [ "$fast" == "true" ]; then
  71. ./scripts/belarus.sh --fast || abort "belarus"
  72. elif [ "$sequential" == "true" ]; then
  73. ./scripts/belarus.sh -s || abort "belarus"
  74. else
  75. ./scripts/belarus.sh || abort "belarus"
  76. fi
  77. fi
  78. # Run Lox benchmarks
  79. if [[ ! -d parsing-results/lox-old || ! -d parsing-results/lox-new || ! -d parsing-results/troll-patrol ]]; then
  80. # Clean up any remnants of previous attempts and try again
  81. rm -rf parsing-results/{lox-{old,new},troll-patrol}
  82. ./scripts/generate-lox-results.sh -N "$cpurange" -n "$ncpus" || abort "lox-gen"
  83. fi
  84. # Process Lox benchmark results
  85. if [[ ! -f appendix-b-results.pdf || ! -f table-2-results.pdf || ! -f table-3-results.pdf ]]; then
  86. # Clean up any remnants of previous attempts and try again
  87. rm -f appendix-b-results.{pdf,tex} table-{2,3}-results.{pdf,tex}
  88. ./scripts/process-lox-results.sh || abort "lox-eval"
  89. fi
  90. echo "Done!"
  91. echo "Results from Section 3 can be found in the section-3-results file."
  92. echo "Table 4 (in Appendix A) can be found in appendix-a-results.pdf."
  93. echo "Results from Section 6 (Tables 2 and 3) can be found in the table-2-results.pdf and table-3-results.pdf files."
  94. echo "Table 5 (in Appendix B) can be found in appendix-b-results.pdf."