repro 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. #!/bin/bash
  2. # Reproduce the Floram 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 Duoram NUMA commands are set, but Floram-specific ones are not,
  11. # use them for Floram
  12. if [ "$FLORAM_NUMA_P0" == "" -a "$DUORAM_NUMA_P0" != "" ]; then
  13. export FLORAM_NUMA_P0="$DUORAM_NUMA_P0"
  14. fi
  15. if [ "$FLORAM_NUMA_P1" == "" -a "$DUORAM_NUMA_P1" != "" ]; then
  16. export FLORAM_NUMA_P1="$DUORAM_NUMA_P1"
  17. fi
  18. # Allow running only subsets of the experiment suite. Valid values are
  19. # "test", "small", "large", "scaling", "all", "none". ("none" is useful
  20. # if you just want to re-parse the output of existing logs. "scaling"
  21. # is the subset of "small" that generates the data points for Figure 10;
  22. # see the README for that one, since you need a machine with at least 64
  23. # cores to generate it.) You can also say "single" followed by all the
  24. # arguments to "run" (below) to run a single experiment; for example:
  25. # ./repro single readwrite 20 1us 100gbit 128
  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 128
  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. numops=128
  38. else
  39. numops="$2"
  40. fi
  41. # Run one experiment
  42. # Arguments:
  43. # $1: mode (read, write, readwrite)
  44. # $2: depth (the ORAM has 2^depth elements)
  45. # $3: latency (e.g., 30ms)
  46. # $4: bandwidth (e.g., 100mbit)
  47. # $5: number of operations (e.g., 128)
  48. run() {
  49. now=`date`
  50. echo "$now: Running $1 $2 $3 $4 $5 ..."
  51. logfile="${1}_${3}_${4}_${5}.out${LOGSUFFIX}"
  52. ./set-networking $3 $4
  53. echo "Network setup: $3 $4" >> $logfile
  54. ./run-experiment $1 $2 $5 >> $logfile
  55. }
  56. # Parse the output logs. We run this in the docker in case you don't
  57. # have perl installed on the host.
  58. # Arguments: a list of logfiles
  59. parse() {
  60. if [ "$FLORAM_PARSE_HOST" = "1" ]; then
  61. ./parse_logs $*
  62. else
  63. cat $* | docker exec -w /root -i floram_p0 ./parse_logs
  64. fi
  65. }
  66. # A very small kick-the-tires test to ensure everything compiled and
  67. # built properly
  68. if [ "$whichexps" = "test" ]; then
  69. echo "Running test experiment..."
  70. run read 16 1us 100gbit 2
  71. echo
  72. echo "# Test output"
  73. echo
  74. parse read_1us_100gbit_2.out${LOGSUFFIX}
  75. echo
  76. echo "# End test output"
  77. echo
  78. exit
  79. fi
  80. # Be able to run a single experiment specified on the command line
  81. if [ "$whichexps" = "single" ]; then
  82. echo "Running single experiment..."
  83. shift
  84. run $*
  85. exit
  86. fi
  87. now=`date`
  88. echo "$now: Starting experiments"
  89. if [ "$whichexps" = "small" -o "$whichexps" = "all" ]; then
  90. echo "Running small experiments..."
  91. # Figures 7(a), 8(c)
  92. run readwrite 16 30ms 100mbit ${numops}
  93. run readwrite 18 30ms 100mbit ${numops}
  94. run readwrite 20 30ms 100mbit ${numops}
  95. run readwrite 22 30ms 100mbit ${numops}
  96. run readwrite 24 30ms 100mbit ${numops}
  97. run readwrite 26 30ms 100mbit ${numops}
  98. # Figure 7(b)
  99. run readwrite 20 30ms 10mbit ${numops}
  100. run readwrite 20 30ms 30mbit ${numops}
  101. run readwrite 20 30ms 50mbit ${numops}
  102. run readwrite 20 30ms 70mbit ${numops}
  103. run readwrite 20 30ms 90mbit ${numops}
  104. run readwrite 20 30ms 110mbit ${numops}
  105. # Figure 7(c)
  106. run readwrite 20 10ms 100mbit ${numops}
  107. run readwrite 20 50ms 100mbit ${numops}
  108. run readwrite 20 70ms 100mbit ${numops}
  109. # Figures 8(a), 9(b), and 9(c)
  110. # Note that we set the latency to 1us, which really means "don't add
  111. # artificial latency", but we measure the one-way latency to
  112. # actually be 30us, which is what we report in the paper. (pings
  113. # from one docker to the other take about 60us round trip.)
  114. run read 16 1us 100gbit ${numops}
  115. run read 18 1us 100gbit ${numops}
  116. run read 20 1us 100gbit ${numops}
  117. run read 22 1us 100gbit ${numops}
  118. run read 24 1us 100gbit ${numops}
  119. run read 26 1us 100gbit ${numops}
  120. # Figure 8(b)
  121. run write 16 1us 100gbit ${numops}
  122. run write 18 1us 100gbit ${numops}
  123. run write 20 1us 100gbit ${numops}
  124. run write 22 1us 100gbit ${numops}
  125. run write 24 1us 100gbit ${numops}
  126. run write 26 1us 100gbit ${numops}
  127. # Figures 9(a), 11(a)
  128. run read 18 30ms 100mbit ${numops}
  129. run read 22 30ms 100mbit ${numops}
  130. run read 24 30ms 100mbit ${numops}
  131. fi
  132. if [ "$whichexps" = "small" -o "$whichexps" = "scaling" -o "$whichexps" = "all" ]; then
  133. # Figures 9(a), 10, 11(a)
  134. run read 16 30ms 100mbit ${numops}
  135. run read 20 30ms 100mbit ${numops}
  136. run read 26 30ms 100mbit ${numops}
  137. fi
  138. if [ "$whichexps" = "large" -o "$whichexps" = "all" ]; then
  139. echo "Running large experiments..."
  140. # Figure 9(a)
  141. run read 28 30ms 100mbit ${numops}
  142. run read 30 30ms 100mbit ${numops}
  143. run read 32 30ms 100mbit ${numops}
  144. # Figures 9(b) and 9(c)
  145. run read 28 1us 100gbit ${numops}
  146. run read 30 1us 100gbit ${numops}
  147. run read 32 1us 100gbit ${numops}
  148. fi
  149. if [ "$whichexps" = "extended" ]; then
  150. # Do the experiments for the plots that appear only in the extended version
  151. # of the paper
  152. # Figure 11(b)
  153. run read 20 30ms 10mbit ${numops}
  154. run read 20 30ms 30mbit ${numops}
  155. run read 20 30ms 50mbit ${numops}
  156. run read 20 30ms 70mbit ${numops}
  157. run read 20 30ms 90mbit ${numops}
  158. run read 20 30ms 110mbit ${numops}
  159. # Figure 11(c)
  160. run read 20 10ms 100mbit ${numops}
  161. run read 20 50ms 100mbit ${numops}
  162. run read 20 70ms 100mbit ${numops}
  163. # Figure 12(a)
  164. run write 16 30ms 100mbit ${numops}
  165. run write 18 30ms 100mbit ${numops}
  166. run write 20 30ms 100mbit ${numops}
  167. run write 22 30ms 100mbit ${numops}
  168. run write 24 30ms 100mbit ${numops}
  169. run write 26 30ms 100mbit ${numops}
  170. # Figure 12(b)
  171. run write 20 30ms 10mbit ${numops}
  172. run write 20 30ms 30mbit ${numops}
  173. run write 20 30ms 50mbit ${numops}
  174. run write 20 30ms 70mbit ${numops}
  175. run write 20 30ms 90mbit ${numops}
  176. run write 20 30ms 110mbit ${numops}
  177. # Figure 12(c)
  178. run write 20 10ms 100mbit ${numops}
  179. run write 20 50ms 100mbit ${numops}
  180. run write 20 70ms 100mbit ${numops}
  181. fi
  182. now=`date`
  183. echo "$now: Experiments complete"
  184. # If you specified a custom log suffix, you're going to be parsing the
  185. # outputs differently.
  186. if [ "$LOGSUFFIX" = "" ]; then
  187. parse *_${numops}.out > floram_${numops}.dat
  188. echo
  189. echo "# Figure 7(a)"
  190. egrep 'Floram readwrite .* 30ms 100mbit .* s$' floram_${numops}.dat | sort -k3 -n
  191. echo
  192. echo "# Figure 7(b)"
  193. egrep 'Floram readwrite 20 30ms .* s$' floram_${numops}.dat | sort -k5 -n
  194. echo
  195. echo "# Figure 7(c)"
  196. egrep 'Floram readwrite 20 .* 100mbit .* s$' floram_${numops}.dat | sort -k4 -n
  197. echo
  198. echo "# Figure 8(a)"
  199. egrep 'Floram read .* 1us 100gbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  200. echo
  201. echo "# Figure 8(b)"
  202. egrep 'Floram write .* 1us 100gbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  203. echo
  204. echo "# Figure 8(c)"
  205. egrep 'Floram readwrite .* 30ms 100mbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  206. echo
  207. echo "# Figure 9(a)"
  208. egrep 'Floram read .* 30ms 100mbit .* s$' floram_${numops}.dat | sort -k3 -n
  209. echo
  210. echo "# Figure 9(b)"
  211. egrep 'Floram read .* 1us 100gbit .* s$' floram_${numops}.dat | sort -k3 -n
  212. echo
  213. echo "# Figure 9(c)"
  214. egrep 'Floram read .* 1us 100gbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  215. echo
  216. if [ "$DUORAM_EXTENDED_PLOTS" = "1" ]; then
  217. # Also show the plots for the extended version (Figures 11, 12)
  218. echo "# Figure 11(a)"
  219. egrep 'Floram read .* 30ms 100mbit .* s$' floram_${numops}.dat | sort -k3 -n
  220. echo
  221. echo "# Figure 11(b)"
  222. egrep 'Floram read 20 30ms .* s$' floram_${numops}.dat | sort -k5 -n
  223. echo
  224. echo "# Figure 11(c)"
  225. egrep 'Floram read 20 .* 100mbit .* s$' floram_${numops}.dat | sort -k4 -n
  226. echo
  227. echo "# Figure 12(a)"
  228. egrep 'Floram write .* 30ms 100mbit .* s$' floram_${numops}.dat | sort -k3 -n
  229. echo
  230. echo "# Figure 12(b)"
  231. egrep 'Floram write 20 30ms .* s$' floram_${numops}.dat | sort -k5 -n
  232. echo
  233. echo "# Figure 12(c)"
  234. egrep 'Floram write 20 .* 100mbit .* s$' floram_${numops}.dat | sort -k4 -n
  235. echo
  236. fi
  237. echo "# End figures"
  238. echo
  239. fi