repro 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. #!/bin/bash
  2. # Reproduce the Duoram experiments from our paper:
  3. # Adithya Vadapalli, Ryan Henry, Ian Goldberg. Duoram: A
  4. # Bandwidth-Efficient Distributed ORAM for 2- and 3-Party Computation.
  5. # USENIX Security Symposium 2023.
  6. # cd into the directory containing this script (from the bash faq 028)
  7. if [[ $BASH_SOURCE = */* ]]; then
  8. cd -- "${BASH_SOURCE%/*}/" || exit
  9. fi
  10. # If the master NUMA commands are set, use them for Duoram
  11. if [ "$NUMA_P0" != "" ]; then
  12. export DUORAM_NUMA_P0="$NUMA_P0"
  13. fi
  14. if [ "$NUMA_P1" != "" ]; then
  15. export DUORAM_NUMA_P1="$NUMA_P1"
  16. fi
  17. if [ "$NUMA_P2" != "" ]; then
  18. export DUORAM_NUMA_P2="$NUMA_P2"
  19. fi
  20. # Allow running only subsets of the experiment suite. Valid values are
  21. # "test", "small", "large", "scaling", "all", "none". ("none" is useful
  22. # if you just want to re-parse the output of existing logs. "scaling"
  23. # is the subset of "small" that generates the data points for Figure 10;
  24. # see the README for that one, since you need a machine with at least 64
  25. # cores to generate it.) You can also say "single" followed by all the
  26. # arguments to "run" (below) to run a single experiment; for example:
  27. # ./repro single readwrite 20 1us 100gbit 128
  28. if [ "$1" = "" ]; then
  29. whichexps="test"
  30. else
  31. whichexps="$1"
  32. fi
  33. # The number of operations per run; the graphs in the paper use 128
  34. if [ "$whichexps" = "single" -o "$2" = "" ]; then
  35. # If there's an explicit experiment on the command line, don't read
  36. # the next argument as the number of operations. $numops will be
  37. # ignored, anyway, since it will be specified as part of the
  38. # command.
  39. numops=128
  40. else
  41. numops="$2"
  42. fi
  43. # The maximum amount of memory to use (in GB). Set the environment
  44. # variable DUORAM_MAXGB to increase it beyond 16 (don't set it lower
  45. # than 16).
  46. if [ "$DUORAM_MAXGB" != "" -a "$DUORAM_MAXGB" -gt 16 ]; then
  47. maxgb=$DUORAM_MAXGB
  48. else
  49. maxgb=16
  50. fi
  51. # Run one experiment
  52. # Arguments:
  53. # $1: mode (read, write, readwrite)
  54. # $2: depth (the ORAM has 2^depth elements)
  55. # $3: latency (e.g., 30ms)
  56. # $4: bandwidth (e.g., 100mbit)
  57. # $5: number of operations (e.g., 128)
  58. # $6: phase (preproc or online)
  59. # $7: number of parties (3P or 2P)
  60. runone() {
  61. now=`date`
  62. echo "$now: Running $1 $2 $3 $4 $5 $6 $7 ..."
  63. logfile="${1}_${3}_${4}_${5}_${6}_${7}.out${LOGSUFFIX}"
  64. ./set-networking $3 $4
  65. echo "Max GB: $maxgb" >> $logfile
  66. echo "Network setup: $3 $4" >> $logfile
  67. ./run-experiment $1 $2 $5 $6 $7 $maxgb >> $logfile
  68. }
  69. # Run one set of Duoram experiments: 2P and 3P, read and write,
  70. # preprocessing and online
  71. # Arguments:
  72. # $1: depth (the ORAM has 2^depth elements)
  73. # $2: latency (e.g., 30ms)
  74. # $3: bandwidth (e.g., 100mbit)
  75. # $4: number of operations (e.g., 128)
  76. run() {
  77. # The 2P read actually does both preprocessing and online
  78. runone read $1 $2 $3 $4 online 2P
  79. runone write $1 $2 $3 $4 preproc 2P
  80. runone write $1 $2 $3 $4 online 2P
  81. # The 3P protocols do both reads and writes
  82. runone read $1 $2 $3 $4 preproc 3P
  83. runone read $1 $2 $3 $4 online 3P
  84. }
  85. # Parse the output logs. We run this in the docker in case you don't
  86. # have perl installed on the host.
  87. # Arguments: a list of logfiles
  88. parse() {
  89. cat $* | docker exec -w /root/duoram/Docker -i duoram_p0 ./parse_logs
  90. }
  91. # A very small kick-the-tires test to ensure everything compiled and
  92. # built properly
  93. if [ "$whichexps" = "test" ]; then
  94. echo "Running test experiment..."
  95. run 16 1us 100gbit 2
  96. parse read_1us_100gbit_2_online_2P.out${LOGSUFFIX} \
  97. write_1us_100gbit_2_preproc_2P.out${LOGSUFFIX} \
  98. write_1us_100gbit_2_online_2P.out${LOGSUFFIX} \
  99. read_1us_100gbit_2_preproc_3P.out${LOGSUFFIX} \
  100. read_1us_100gbit_2_online_3P.out${LOGSUFFIX}
  101. exit
  102. fi
  103. # Be able to run a single experiment specified on the command line
  104. if [ "$whichexps" = "single" ]; then
  105. echo "Running single experiment..."
  106. shift
  107. runone $*
  108. exit
  109. fi
  110. now=`date`
  111. echo "$now: Starting experiments"
  112. if [ "$whichexps" = "small" -o "$whichexps" = "all" ]; then
  113. echo "Running small experiments..."
  114. # Figure 7(b)
  115. run 20 30ms 10mbit ${numops}
  116. run 20 30ms 30mbit ${numops}
  117. run 20 30ms 50mbit ${numops}
  118. run 20 30ms 70mbit ${numops}
  119. run 20 30ms 90mbit ${numops}
  120. run 20 30ms 110mbit ${numops}
  121. # Figure 7(c)
  122. run 20 10ms 100mbit ${numops}
  123. run 20 50ms 100mbit ${numops}
  124. run 20 70ms 100mbit ${numops}
  125. # Figures 8(a), 8(b), 8(c), 9(b), and 9(c)
  126. # Note that we set the latency to 1us, which really means "don't add
  127. # artificial latency", but we measure the one-way latency to
  128. # actually be 30us, which is what we report in the paper. (pings
  129. # from one docker to the other take about 60us round trip.)
  130. run 16 1us 100gbit ${numops}
  131. run 18 1us 100gbit ${numops}
  132. run 20 1us 100gbit ${numops}
  133. run 22 1us 100gbit ${numops}
  134. run 24 1us 100gbit ${numops}
  135. run 26 1us 100gbit ${numops}
  136. # Figures 7(a), 9(a)
  137. run 18 30ms 100mbit ${numops}
  138. run 22 30ms 100mbit ${numops}
  139. run 24 30ms 100mbit ${numops}
  140. fi
  141. if [ "$whichexps" = "small" -o "$whichexps" = "scaling" -o "$whichexps" = "all" ]; then
  142. # Figures s 7(a), 9(a), 10
  143. run 16 30ms 100mbit ${numops}
  144. run 20 30ms 100mbit ${numops}
  145. run 26 30ms 100mbit ${numops}
  146. fi
  147. # if [ "$whichexps" = "large" -o "$whichexps" = "all" ]; then
  148. # echo "Running large experiments..."
  149. # # Figure 9(a)
  150. # run read 28 30ms 100mbit ${numops}
  151. # run read 30 30ms 100mbit ${numops}
  152. # run read 32 30ms 100mbit ${numops}
  153. # # Figures 9(b) and 9(c)
  154. # run read 28 1us 100gbit ${numops}
  155. # run read 30 1us 100gbit ${numops}
  156. # run read 32 1us 100gbit ${numops}
  157. # fi
  158. now=`date`
  159. echo "$now: Experiments complete"
  160. # # If you specified a custom log suffix, you're going to be parsing the
  161. # # outputs differently.
  162. # if [ "$LOGSUFFIX" = "" ]; then
  163. # parse *_${numops}.out > floram_${numops}.dat
  164. # echo
  165. # echo "# Figure 7(a)"
  166. # egrep 'Duoram readwrite .* 30ms 100mbit .* s$' floram_${numops}.dat | sort -k3 -n
  167. # echo
  168. # echo "# Figure 7(b)"
  169. # egrep 'Duoram readwrite 20 30ms .* s$' floram_${numops}.dat | sort -k5 -n
  170. # echo
  171. # echo "# Figure 7(c)"
  172. # egrep 'Duoram readwrite 20 .* 100mbit .* s$' floram_${numops}.dat | sort -k4 -n
  173. # echo
  174. # echo "# Figure 8(a)"
  175. # egrep 'Duoram read .* 1us 100gbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  176. # echo
  177. # echo "# Figure 8(b)"
  178. # egrep 'Duoram write .* 1us 100gbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  179. # echo
  180. # echo "# Figure 8(c)"
  181. # egrep 'Duoram readwrite .* 30ms 100mbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  182. # echo
  183. # echo "# Figure 9(a)"
  184. # egrep 'Duoram read .* 30ms 100mbit .* s$' floram_${numops}.dat | sort -k3 -n
  185. # echo
  186. # echo "# Figure 9(b)"
  187. # egrep 'Duoram read .* 1us 100gbit .* s$' floram_${numops}.dat | sort -k3 -n
  188. # echo
  189. # echo "# Figure 9(c)"
  190. # egrep 'Duoram read .* 1us 100gbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  191. # fi