repro 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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 master NUMA commands are set, use them for Floram
  11. if [ "$NUMA_P0" != "" ]; then
  12. export FLORAM_NUMA_P0="$NUMA_P0"
  13. fi
  14. if [ "$NUMA_P1" != "" ]; then
  15. export FLORAM_NUMA_P1="$NUMA_P1"
  16. fi
  17. # Allow running only subsets of the experiment suite. Valid values are
  18. # "test", "small", "large", "scaling", "all", "none". ("none" is useful
  19. # if you just want to re-parse the output of existing logs. "scaling"
  20. # is the subset of "small" that generates the data points for Figure 10;
  21. # see the README for that one, since you need a machine with at least 64
  22. # cores to generate it.) You can also say "single" followed by all the
  23. # arguments to "run" (below) to run a single experiment; for example:
  24. # ./repro single readwrite 20 1us 100gbit 128
  25. if [ "$1" == "" ]; then
  26. whichexps="test"
  27. else
  28. whichexps="$1"
  29. fi
  30. # The number of operations per run; the graphs in the paper use 128
  31. if [ "$whichexps" == "single" -o "$2" == "" ]; then
  32. # If there's an explicit run on the command line, don't read the
  33. # next argument as the number of operations. $numops will be
  34. # ignores, anyway, since it will be specified as part of the
  35. # command.
  36. numops=128
  37. else
  38. numops="$2"
  39. fi
  40. # Run one experiment
  41. # Arguments:
  42. # $1: mode (read, write, readwrite)
  43. # $2: depth (the ORAM has 2^depth elements)
  44. # $3: latency (e.g., 30ms)
  45. # $4: bandwidth (e.g., 100mbit)
  46. # $5: number of operations (e.g., 128)
  47. run() {
  48. now=`date`
  49. echo "$now: Running $1 $2 $3 $4 $5 ..."
  50. logfile="${1}_${3}_${4}_${5}.out${LOGSUFFIX}"
  51. ./set-networking $3 $4
  52. echo "Network setup: $3 $4" >> $logfile
  53. ./run-experiment $1 $2 $5 >> $logfile
  54. }
  55. # Parse the output logs. We run this in the docker in case you don't
  56. # have perl installed on the host.
  57. # Arguments: a list of logfiles
  58. parse() {
  59. cat $* | docker exec -w /root -i floram_p0 ./parse_logs
  60. }
  61. # A very small kick-the-tires test to ensure everything compiled and
  62. # built properly
  63. if [ "$whichexps" == "test" ]; then
  64. echo "Running test experiment..."
  65. run read 16 1us 100gbit 2
  66. parse read_1us_100gbit_2.out${LOGSUFFIX}
  67. exit
  68. fi
  69. # Be able to run a single experiment specified on the command line
  70. if [ "$whichexps" == "single" ]; then
  71. echo "Running single experiment..."
  72. shift
  73. run $*
  74. exit
  75. fi
  76. now=`date`
  77. echo "$now: Starting experiments"
  78. if [ "$whichexps" == "small" -o "$whichexps" == "all" ]; then
  79. echo "Running small experiments..."
  80. # Figure 7(a), 8(c)
  81. run readwrite 16 30ms 100mbit ${numops}
  82. run readwrite 18 30ms 100mbit ${numops}
  83. run readwrite 20 30ms 100mbit ${numops}
  84. run readwrite 22 30ms 100mbit ${numops}
  85. run readwrite 24 30ms 100mbit ${numops}
  86. run readwrite 26 30ms 100mbit ${numops}
  87. # Figure 7(b)
  88. run readwrite 20 30ms 10mbit ${numops}
  89. run readwrite 20 30ms 30mbit ${numops}
  90. run readwrite 20 30ms 50mbit ${numops}
  91. run readwrite 20 30ms 70mbit ${numops}
  92. run readwrite 20 30ms 90mbit ${numops}
  93. run readwrite 20 30ms 110mbit ${numops}
  94. # Figure 7(c)
  95. run readwrite 20 10ms 100mbit ${numops}
  96. run readwrite 20 50ms 100mbit ${numops}
  97. run readwrite 20 70ms 100mbit ${numops}
  98. # Figures 8(a), 9(b), and 9(c)
  99. # Note that we set the latency to 1us, which really means "don't add
  100. # artificial latency", but we measure the onw-way latency to
  101. # actually be 30us, which is what we report in the paper. (pings
  102. # from one docker to the other take about 60us round trip.)
  103. run read 16 1us 100gbit ${numops}
  104. run read 18 1us 100gbit ${numops}
  105. run read 20 1us 100gbit ${numops}
  106. run read 22 1us 100gbit ${numops}
  107. run read 24 1us 100gbit ${numops}
  108. run read 26 1us 100gbit ${numops}
  109. # Figure 8(b)
  110. run write 16 1us 100gbit ${numops}
  111. run write 18 1us 100gbit ${numops}
  112. run write 20 1us 100gbit ${numops}
  113. run write 22 1us 100gbit ${numops}
  114. run write 24 1us 100gbit ${numops}
  115. run write 26 1us 100gbit ${numops}
  116. # Figure 9(a)
  117. run read 18 30ms 100mbit ${numops}
  118. run read 22 30ms 100mbit ${numops}
  119. run read 24 30ms 100mbit ${numops}
  120. fi
  121. if [ "$whichexps" == "small" -o "$whichexps" == "scaling" -o "$whichexps" == "all" ]; then
  122. # Figures 9(a), 10
  123. run read 16 30ms 100mbit ${numops}
  124. run read 20 30ms 100mbit ${numops}
  125. run read 26 30ms 100mbit ${numops}
  126. fi
  127. if [ "$whichexps" == "large" -o "$whichexps" == "all" ]; then
  128. echo "Running large experiments..."
  129. # Figure 9(a)
  130. run read 28 30ms 100mbit ${numops}
  131. run read 30 30ms 100mbit ${numops}
  132. run read 32 30ms 100mbit ${numops}
  133. # Figures 9(b) and 9(c)
  134. run read 28 1us 100gbit ${numops}
  135. run read 30 1us 100gbit ${numops}
  136. run read 32 1us 100gbit ${numops}
  137. fi
  138. now=`date`
  139. echo "$now: Experiments complete"
  140. # If you specified a custom log suffix, you're going to be parsing the
  141. # outputs differently.
  142. if [ "$LOGSUFFIX" == "" ]; then
  143. parse *_${numops}.out > floram_${numops}.dat
  144. echo
  145. echo "# Figure 7(a)"
  146. egrep 'Floram readwrite .* 30ms 100mbit .* s$' floram_${numops}.dat | sort -k3 -n
  147. echo
  148. echo "# Figure 7(b)"
  149. egrep 'Floram readwrite 20 30ms .* s$' floram_${numops}.dat | sort -k5 -n
  150. echo
  151. echo "# Figure 7(c)"
  152. egrep 'Floram readwrite 20 .* 100mbit .* s$' floram_${numops}.dat | sort -k4 -n
  153. echo
  154. echo "# Figure 8(a)"
  155. egrep 'Floram read .* 1us 100gbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  156. echo
  157. echo "# Figure 8(b)"
  158. egrep 'Floram write .* 1us 100gbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  159. echo
  160. echo "# Figure 8(c)"
  161. egrep 'Floram readwrite .* 1us 100gbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  162. echo
  163. echo "# Figure 9(a)"
  164. egrep 'Floram read .* 30ms 100mbit .* s$' floram_${numops}.dat | sort -k3 -n
  165. echo
  166. echo "# Figure 9(b)"
  167. egrep 'Floram read .* 1us 100gbit .* s$' floram_${numops}.dat | sort -k3 -n
  168. echo
  169. echo "# Figure 9(c)"
  170. egrep 'Floram read .* 1us 100gbit .* KiB$' floram_${numops}.dat | sort -k3 -n
  171. fi