repro 5.4 KB

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