repro 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. cat $* | docker exec -w /root -i floram_p0 ./parse_logs
  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 read 16 1us 100gbit 2
  67. echo
  68. echo "# Test output"
  69. echo
  70. parse read_1us_100gbit_2.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" = "small" -o "$whichexps" = "all" ]; then
  86. echo "Running small experiments..."
  87. # Figure 7(a), 8(c)
  88. run readwrite 16 30ms 100mbit ${numops}
  89. run readwrite 18 30ms 100mbit ${numops}
  90. run readwrite 20 30ms 100mbit ${numops}
  91. run readwrite 22 30ms 100mbit ${numops}
  92. run readwrite 24 30ms 100mbit ${numops}
  93. run readwrite 26 30ms 100mbit ${numops}
  94. # Figure 7(b)
  95. run readwrite 20 30ms 10mbit ${numops}
  96. run readwrite 20 30ms 30mbit ${numops}
  97. run readwrite 20 30ms 50mbit ${numops}
  98. run readwrite 20 30ms 70mbit ${numops}
  99. run readwrite 20 30ms 90mbit ${numops}
  100. run readwrite 20 30ms 110mbit ${numops}
  101. # Figure 7(c)
  102. run readwrite 20 10ms 100mbit ${numops}
  103. run readwrite 20 50ms 100mbit ${numops}
  104. run readwrite 20 70ms 100mbit ${numops}
  105. # Figures 8(a), 9(b), and 9(c)
  106. # Note that we set the latency to 1us, which really means "don't add
  107. # artificial latency", but we measure the one-way latency to
  108. # actually be 30us, which is what we report in the paper. (pings
  109. # from one docker to the other take about 60us round trip.)
  110. run read 16 1us 100gbit ${numops}
  111. run read 18 1us 100gbit ${numops}
  112. run read 20 1us 100gbit ${numops}
  113. run read 22 1us 100gbit ${numops}
  114. run read 24 1us 100gbit ${numops}
  115. run read 26 1us 100gbit ${numops}
  116. # Figure 8(b)
  117. run write 16 1us 100gbit ${numops}
  118. run write 18 1us 100gbit ${numops}
  119. run write 20 1us 100gbit ${numops}
  120. run write 22 1us 100gbit ${numops}
  121. run write 24 1us 100gbit ${numops}
  122. run write 26 1us 100gbit ${numops}
  123. # Figure 9(a)
  124. run read 18 30ms 100mbit ${numops}
  125. run read 22 30ms 100mbit ${numops}
  126. run read 24 30ms 100mbit ${numops}
  127. fi
  128. if [ "$whichexps" = "small" -o "$whichexps" = "scaling" -o "$whichexps" = "all" ]; then
  129. # Figures 9(a), 10
  130. run read 16 30ms 100mbit ${numops}
  131. run read 20 30ms 100mbit ${numops}
  132. run read 26 30ms 100mbit ${numops}
  133. fi
  134. if [ "$whichexps" = "large" -o "$whichexps" = "all" ]; then
  135. echo "Running large experiments..."
  136. # Figure 9(a)
  137. run read 28 30ms 100mbit ${numops}
  138. run read 30 30ms 100mbit ${numops}
  139. run read 32 30ms 100mbit ${numops}
  140. # Figures 9(b) and 9(c)
  141. run read 28 1us 100gbit ${numops}
  142. run read 30 1us 100gbit ${numops}
  143. run read 32 1us 100gbit ${numops}
  144. fi
  145. now=`date`
  146. echo "$now: Experiments complete"
  147. # If you specified a custom log suffix, you're going to be parsing the
  148. # outputs differently.
  149. if [ "$LOGSUFFIX" = "" ]; then
  150. parse *_${numops}.out > floram_${numops}.dat
  151. echo
  152. echo "# Figure 7(a)"
  153. egrep 'Floram readwrite .* 30ms 100mbit .* s$' floram_${numops}.dat | sort -k3 -n
  154. echo
  155. echo "# Figure 7(b)"
  156. egrep 'Floram readwrite 20 30ms .* s$' floram_${numops}.dat | sort -k5 -n
  157. echo
  158. echo "# Figure 7(c)"
  159. egrep 'Floram readwrite 20 .* 100mbit .* s$' floram_${numops}.dat | sort -k4 -n
  160. echo
  161. echo "# Figure 8(a)"
  162. egrep 'Floram read .* 1us 100gbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  163. echo
  164. echo "# Figure 8(b)"
  165. egrep 'Floram write .* 1us 100gbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  166. echo
  167. echo "# Figure 8(c)"
  168. egrep 'Floram readwrite .* 30ms 100mbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  169. echo
  170. echo "# Figure 9(a)"
  171. egrep 'Floram read .* 30ms 100mbit .* s$' floram_${numops}.dat | sort -k3 -n
  172. echo
  173. echo "# Figure 9(b)"
  174. egrep 'Floram read .* 1us 100gbit .* s$' floram_${numops}.dat | sort -k3 -n
  175. echo
  176. echo "# Figure 9(c)"
  177. egrep 'Floram read .* 1us 100gbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  178. echo
  179. echo "# End figures"
  180. fi