run.sh 3.1 KB

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