repro 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. #!/bin/bash
  2. # Reproduce the Ramen 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 Ramen-specific ones are not,
  10. # use them for Ramen.
  11. if [ "$RAMEN_NUMA_P0" == "" -a "$PRAC_NUMA_P0" != "" ]; then
  12. export RAMEN_NUMA_P0="$PRAC_NUMA_P0"
  13. fi
  14. if [ "$RAMEN_NUMA_P1" == "" -a "$PRAC_NUMA_P1" != "" ]; then
  15. export RAMEN_NUMA_P1="$PRAC_NUMA_P1"
  16. fi
  17. if [ "$RAMEN_NUMA_P2" == "" -a "$PRAC_NUMA_P2" != "" ]; then
  18. export RAMEN_NUMA_P2="$PRAC_NUMA_P2"
  19. fi
  20. # If the PRAC memory usage is set, use it for Ramen.
  21. if [ "$PRAC_P0_MAXGB" != "" ]; then
  22. export RAMEN_MAXGB=$((3*PRAC_P0_MAXGB))
  23. elif [ "$PRAC_P02_MAXGB" != "" ]; then
  24. export RAMEN_MAXGB=$((2*PRAC_P02_MAXGB))
  25. elif [ "$PRAC_MAXGB" != "" ]; then
  26. export RAMEN_MAXGB=$PRAC_MAXGB
  27. else
  28. export RAMEN_MAXGB=16
  29. fi
  30. # Allow running only subsets of the experiment suite. Valid values are
  31. # "test", "all", "none". ("none" is useful if you just want to re-parse
  32. # the output of existing logs.) You can also say "single" followed by
  33. # all the arguments to "run" (below) to run a single experiment; for
  34. # example:
  35. # ./repro single 20 1
  36. if [ "$1" = "" ]; then
  37. whichexps="test"
  38. else
  39. whichexps="$1"
  40. fi
  41. # The number of operations per run; the graphs in the paper use 3
  42. if [ "$whichexps" = "single" -o "$2" = "" ]; then
  43. # If there's an explicit experiment on the command line, don't read
  44. # the next argument as the number of operations. $numops will be
  45. # ignored, anyway, since it will be specified as part of the
  46. # command.
  47. numiters=3
  48. else
  49. numiters="$2"
  50. fi
  51. # Run one experiment
  52. # Arguments:
  53. # $1: depth (the ORAM has 2^depth elements)
  54. # $2: number of operations (e.g., 20)
  55. run() {
  56. now=`date`
  57. echo "$now: Running $1 $2 ..."
  58. logfile="ramen_${1}_${2}.out${LOGSUFFIX}"
  59. mkdir -p data
  60. ../Docker/run-experiment $1 $2 >> data/$logfile
  61. }
  62. # Parse the output logs. We run this in the docker in case you don't
  63. # have perl installed on the host.
  64. # Arguments: a list of logfiles
  65. parse() {
  66. if [ "$RAMEN_PARSE_HOST" = "1" ]; then
  67. ./parse_logs $*
  68. else
  69. cat $* | docker exec -w /root/ramen/repro -i ramen_p0 ./parse_logs
  70. fi
  71. }
  72. # A very small kick-the-tires test to ensure everything compiled and
  73. # built properly
  74. if [ "$whichexps" = "test" ]; then
  75. echo "Running test experiment..."
  76. run 16 1
  77. echo
  78. echo "# Test output"
  79. echo
  80. parse data/ramen_16_1.out${LOGSUFFIX}
  81. echo
  82. echo "# End test output"
  83. echo
  84. exit
  85. fi
  86. # Be able to run a single experiment specified on the command line
  87. if [ "$whichexps" = "single" ]; then
  88. echo "Running single experiment..."
  89. shift
  90. run $*
  91. exit
  92. fi
  93. now=`date`
  94. echo "$now: Starting experiments"
  95. if [ "$whichexps" = "fig6" -o "$whichexps" = "all" ]; then
  96. echo "Running Figure 6 experiments..."
  97. # Figure 6(a)
  98. ./generate_raw_data_reads_const_db.sh ${numiters}
  99. # Figures 6(b) and 6(c)
  100. ./generate_raw_data_reads.sh ${numiters}
  101. fi
  102. if [ "$whichexps" = "fig7" -o "$whichexps" = "all" ]; then
  103. echo "Running Figure 7 experiments..."
  104. # Figure 7(a)
  105. ./generate_raw_data_bs_const_db.sh ${numiters}
  106. # Figures 7(b) and 7(c)
  107. ./generate_raw_data_bs.sh ${numiters}
  108. fi
  109. if [ "$whichexps" = "fig8" -o "$whichexps" = "all" ]; then
  110. echo "Running Figure 8 experiments..."
  111. # Figure 8(a)
  112. ./generate_raw_data_heap_const_db.sh ${numiters}
  113. # Figures 8(b) and 8(c)
  114. ./generate_raw_data_heap.sh ${numiters}
  115. fi
  116. now=`date`
  117. echo "$now: Experiments complete"
  118. # If you specified a custom log suffix, you're going to be parsing the
  119. # outputs differently.
  120. if [ "$LOGSUFFIX" = "" ]; then
  121. parse data/*.out > data/ramen.dat
  122. echo
  123. echo "# Figure 6(a)"
  124. egrep 'Ramen read 20 (16|32|64|128|256|512|1024|2048) .* s$' data/ramen.dat | sort -k4 -n
  125. echo
  126. echo "# Figure 6(b)"
  127. egrep 'Ramen read ([0-9]+) 10 .* s$' data/ramen.dat | sort -k3 -n
  128. echo
  129. echo "# Figure 6(c)"
  130. egrep 'Ramen read ([0-9]+) 10 .* KiB$' data/ramen.dat | sort -k3 -n
  131. echo
  132. echo "# Figure 7(a)"
  133. egrep 'Ramen read 20 (80|160|320|640|1280) .* s$' data/ramen.dat | sort -k4 -n
  134. echo
  135. echo "# Figure 7(b)"
  136. egrep 'Ramen read ([0-9]+) \1 .* s$' data/ramen.dat | sort -k3 -n
  137. echo
  138. echo "# Figure 7(c)"
  139. egrep 'Ramen read ([0-9]+) \1 .* KiB$' data/ramen.dat | sort -k3 -n
  140. echo
  141. echo "# Figure 8(a)"
  142. egrep 'Ramen read 20 (456|912|1824|3648) .* s$' data/ramen.dat | sort -k4 -n
  143. echo
  144. echo "# Figure 8(b)"
  145. egrep 'Ramen read (16 90|18 102|20 114|22 126|24 138|26 150|28 162|30 174) .* s$' data/ramen.dat | sort -k3 -n
  146. echo
  147. echo "# Figure 8(c)"
  148. egrep 'Ramen read (16 90|18 102|20 114|22 126|24 138|26 150|28 162|30 174) .* KiB$' data/ramen.dat | sort -k3 -n
  149. echo
  150. echo "# End figures"
  151. fi