repro 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #!/bin/bash
  2. # Reproduce the Floram experiments from our paper:
  3. # Sajin Sasy, Adithya Vadapalli, Ian Goldberg. PRAC: Round-Efficient
  4. # 3-Party MPC for Dynamic Data Structures
  5. # cd into the directory containing this script (from the bash faq 028)
  6. if [[ $BASH_SOURCE = */* ]]; then
  7. cd -- "${BASH_SOURCE%/*}/" || exit
  8. fi
  9. # If the PRAC NUMA commands are set, but Floram-specific ones are not,
  10. # use them for Floram.
  11. if [ "$FLORAM_NUMA_P0" == "" -a "$PRAC_NUMA_P0" != "" ]; then
  12. export FLORAM_NUMA_P0="$PRAC_NUMA_P0"
  13. fi
  14. if [ "$FLORAM_NUMA_P1" == "" -a "$PRAC_NUMA_P1" != "" ]; then
  15. export FLORAM_NUMA_P1="$PRAC_NUMA_P1"
  16. fi
  17. # If the PRAC memory usage is set, use it for Floram.
  18. if [ "$PRAC_P0_MAXGB" != "" ]; then
  19. export FLORAM_MAXGB=$((2*PRAC_P0_MAXGB))
  20. elif [ "$PRAC_P02_MAXGB" != "" ]; then
  21. export FLORAM_MAXGB=$((2*PRAC_P02_MAXGB))
  22. elif [ "$PRAC_MAXGB" != "" ]; then
  23. export FLORAM_MAXGB=$PRAC_MAXGB
  24. else
  25. export FLORAM_MAXGB=16
  26. fi
  27. # Allow running only subsets of the experiment suite. Valid values are
  28. # "test", "all", "none". ("none" is useful if you just want to re-parse
  29. # the output of existing logs.) You can also say "single" followed by
  30. # all the arguments to "run" (below) to run a single experiment; for
  31. # example:
  32. # ./repro single read 20 1
  33. if [ "$1" = "" ]; then
  34. whichexps="test"
  35. else
  36. whichexps="$1"
  37. fi
  38. # The number of operations per run; the graphs in the paper use 3
  39. if [ "$whichexps" = "single" -o "$2" = "" ]; then
  40. # If there's an explicit experiment on the command line, don't read
  41. # the next argument as the number of operations. $numops will be
  42. # ignored, anyway, since it will be specified as part of the
  43. # command.
  44. numiters=3
  45. else
  46. numiters="$2"
  47. fi
  48. # Run one experiment
  49. # Arguments:
  50. # $1: mode (read, bs)
  51. # $2: depth (the ORAM has 2^depth elements)
  52. # $3: number of operations (e.g., 20)
  53. run() {
  54. now=`date`
  55. echo "$now: Running $1 $2 $3 ..."
  56. logfile="${1}_${3}.out${LOGSUFFIX}"
  57. mkdir -p data
  58. ../run-experiment $1 $2 $3 >> data/$logfile
  59. }
  60. # Parse the output logs. We run this in the docker in case you don't
  61. # have perl installed on the host.
  62. # Arguments: a list of logfiles
  63. parse() {
  64. if [ "$FLORAM_PARSE_HOST" = "1" ]; then
  65. ../parse_logs $*
  66. else
  67. cat $* | docker exec -w /root -i floram_p0 ./parse_logs
  68. fi
  69. }
  70. # A very small kick-the-tires test to ensure everything compiled and
  71. # built properly
  72. if [ "$whichexps" = "test" ]; then
  73. echo "Running test experiment..."
  74. run read 16 1
  75. echo
  76. echo "# Test output"
  77. echo
  78. parse data/read_1.out${LOGSUFFIX}
  79. echo
  80. echo "# End test output"
  81. echo
  82. exit
  83. fi
  84. # Be able to run a single experiment specified on the command line
  85. if [ "$whichexps" = "single" ]; then
  86. echo "Running single experiment..."
  87. shift
  88. run $*
  89. exit
  90. fi
  91. now=`date`
  92. echo "$now: Starting experiments"
  93. if [ "$whichexps" = "fig6" -o "$whichexps" = "all" ]; then
  94. echo "Running Figure 6 experiments..."
  95. # Figure 6(a)
  96. ./repro-reads-const-db.sh ${numiters}
  97. # Figures 6(b) and 6(c)
  98. ./repro-reads.sh ${numiters}
  99. fi
  100. if [ "$whichexps" = "fig7" -o "$whichexps" = "all" ]; then
  101. echo "Running Figure 7 experiments..."
  102. # Figure 7(a)
  103. ./repro-bs-const-db.sh ${numiters}
  104. # Figures 7(b) and 7(c)
  105. ./repro-bs.sh ${numiters}
  106. fi
  107. now=`date`
  108. echo "$now: Experiments complete"
  109. # If you specified a custom log suffix, you're going to be parsing the
  110. # outputs differently.
  111. if [ "$LOGSUFFIX" = "" ]; then
  112. parse data/*.out > data/floram.dat
  113. echo
  114. echo "# Figure 6(a)"
  115. egrep 'Floram read 20 (16|32|64|128|256|512|1024|2048) .* s$' data/floram.dat | sort -k4 -n
  116. echo
  117. echo "# Figure 6(b)"
  118. egrep 'Floram read ([0-9]+) 10 .* s$' data/floram.dat | sort -k3 -n
  119. echo
  120. echo "# Figure 6(c)"
  121. egrep 'Floram read ([0-9]+) 10 .* KiB$' data/floram.dat | sort -k3 -n
  122. echo
  123. echo "# Figure 7(a)"
  124. egrep 'Floram bs 20 (4|8|16|32|64) .* s$' data/floram.dat | sort -k4 -n
  125. echo
  126. echo "# Figure 7(b)"
  127. egrep 'Floram bs ([0-9]+) 1 .* s$' data/floram.dat | sort -k3 -n
  128. echo
  129. echo "# Figure 7(c)"
  130. egrep 'Floram bs ([0-9]+) 1 .* KiB$' data/floram.dat | sort -k3 -n
  131. echo
  132. echo "# End figures"
  133. echo
  134. fi