run.sh 3.4 KB

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