run.sh 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. abort() {
  21. echo "Step $1 failed."
  22. echo "To restart from this step, try running:"
  23. if [ "$1" == "setup" ]; then
  24. echo " rm -rf belarus-2020-2021 cmz lox-new lox-old sigma-compiler simga-proofs spongefish"
  25. elif [ "$1" == "belarus" ]; then
  26. echo " rm -rf appendix-a-results.{pdf,tex} appendix-a-results"
  27. echo " docker stop tp-belarus"
  28. echo " docker rm tp-belarus"
  29. elif [ "$1" == "lox-gen" ]; then
  30. echo " rm -rf parsing-results/{lox-{old,new},troll-patrol}"
  31. echo " docker stop {lox-{old,new},troll-patrol}-{trust_levels,invitations,blockage_migration{05,50,100}}.log troll-patrol-reporting.log"
  32. echo " docker rm {lox-{old,new},troll-patrol}-{trust_levels,invitations,blockage_migration{05,50,100}}.log troll-patrol-reporting.log"
  33. elif [ "$1" == "lox-eval" ]; then
  34. echo " rm -f appendix-c-results.{pdf,tex} table-{2,3}-results.{pdf,tex}"
  35. echo " docker stop tp-lox"
  36. echo " docker rm tp-lox"
  37. fi
  38. echo "Then run this script again."
  39. echo "Exiting..."
  40. exit 1
  41. }
  42. # Set up dockers
  43. if [ ! -d troll-patrol ]; then
  44. # Clean up any remnants of previous attempts and try again
  45. rm -rf belarus-2020-2021 cmz lox-new lox-old sigma-compiler simga-proofs spongefish
  46. # Set up our dockers
  47. ./scripts/setup.sh || abort "setup"
  48. fi
  49. # Run Lox benchmarks
  50. if [[ ! -d parsing-results/lox-old || ! -d parsing-results/lox-new || ! -d parsing-results/troll-patrol ]]; then
  51. # Clean up any remnants of previous attempts and try again
  52. rm -rf parsing-results/{lox-{old,new},troll-patrol}
  53. # Arguments here may be empty; the generate-lox-results.sh script handles this case
  54. ./scripts/generate-lox-results.sh -N "$cpurange" -n "$ncpus" || abort "lox-gen"
  55. fi
  56. # Process Lox benchmark results
  57. if [[ ! -f appendix-c-results.pdf || ! -f table-2-results.pdf || ! -f table-3-results.pdf ]]; then
  58. # Clean up any remnants of previous attempts and try again
  59. rm -f appendix-c-results.{pdf,tex} table-{2,3}-results.{pdf,tex}
  60. ./scripts/process-lox-results.sh || abort "lox-eval"
  61. fi
  62. # Get Belarus results
  63. if [[ ! -f appendix-a-results.pdf || ! -f appendix-a-results ]]; then
  64. # Clean up any remnants of previous attempts and try again
  65. rm -f appendix-a-results.{pdf,tex} appendix-a-results
  66. if [ "$fast" == "true" ]; then
  67. ./scripts/belarus.sh --fast || abort "belarus"
  68. elif [ "$sequential" == "true" ]; then
  69. ./scripts/belarus.sh -s || abort "belarus"
  70. else
  71. ./scripts/belarus.sh || abort "belarus"
  72. fi
  73. fi
  74. echo "Done!"
  75. echo "Results from Section 6 (Tables 2 and 3) can be found in the table-2-results.pdf and table-3-results.pdf files."
  76. echo "Table 5 (in Appendix C) can be found in appendix-c-results.pdf."
  77. echo "Results from Appendix A can be found in the appendix-a-results file."
  78. echo "Table 4 (in Appendix A) can be found in appendix-a-results.pdf."