repro 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. #!/bin/bash
  2. # Reproduce the 3-party Circuit ORAM 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 Circuit-ORAM-specific ones are not,
  11. # use them for Circuit ORAM.
  12. if [ "$ORAM_NUMA_C" == "" -a "$DUORAM_NUMA_P0" != "" ]; then
  13. export ORAM_NUMA_C="$DUORAM_NUMA_P0"
  14. fi
  15. if [ "$ORAM_NUMA_D" == "" -a "$DUORAM_NUMA_P1" != "" ]; then
  16. export ORAM_NUMA_D="$DUORAM_NUMA_P1"
  17. fi
  18. if [ "$ORAM_NUMA_E" == "" -a "$DUORAM_NUMA_P2" != "" ]; then
  19. export ORAM_NUMA_E="$DUORAM_NUMA_P2"
  20. fi
  21. # Allow running only subsets of the experiment suite. Valid values are
  22. # "test", "small", "large", "all", "none". ("none" is useful if you
  23. # just want to re-parse the output of existing logs.) You can also say
  24. # "single" followed by all the arguments to "run" (below) to run a
  25. # single experiment; for example:
  26. # ./repro single 20 1us 100gbit 128
  27. if [ "$1" = "" ]; then
  28. whichexps="test"
  29. else
  30. whichexps="$1"
  31. fi
  32. # The number of operations per run; the graphs in the paper use 128
  33. if [ "$whichexps" = "single" -o "$2" = "" ]; then
  34. # If there's an explicit experiment on the command line, don't read
  35. # the next argument as the number of operations. $numops will be
  36. # ignored, anyway, since it will be specified as part of the
  37. # command.
  38. numops=128
  39. else
  40. numops="$2"
  41. fi
  42. # Run one experiment
  43. # Arguments:
  44. # $1: depth (the ORAM has 2^depth elements)
  45. # $2: latency (e.g., 30ms)
  46. # $3: bandwidth (e.g., 100mbit)
  47. # $4: number of operations (e.g., 128)
  48. run() {
  49. now=`date`
  50. echo "$now: Running $1 $2 $3 $4 ..."
  51. logfile="read_${2}_${3}_${4}.out${LOGSUFFIX}"
  52. ./set-networking $2 $3
  53. echo "Network setup: $2 $3" >> $logfile
  54. ./run-experiment $1 $4 >> $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 [ "$ORAM_PARSE_HOST" = "1" ]; then
  61. ./parse_logs $*
  62. else
  63. cat $* | docker exec -w /root/oram/docker -i oram_C ./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 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. # Figure 9(a)
  92. run 16 30ms 100mbit ${numops}
  93. run 18 30ms 100mbit ${numops}
  94. run 20 30ms 100mbit ${numops}
  95. run 22 30ms 100mbit ${numops}
  96. run 24 30ms 100mbit ${numops}
  97. run 26 30ms 100mbit ${numops}
  98. # Figures 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 one-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 16 1us 100gbit ${numops}
  104. run 18 1us 100gbit ${numops}
  105. run 20 1us 100gbit ${numops}
  106. run 22 1us 100gbit ${numops}
  107. run 24 1us 100gbit ${numops}
  108. run 26 1us 100gbit ${numops}
  109. fi
  110. if [ "$whichexps" = "large" -o "$whichexps" = "all" ]; then
  111. echo "Running large experiments..."
  112. # Figure 9(a)
  113. run 28 30ms 100mbit ${numops}
  114. run 30 30ms 100mbit ${numops}
  115. run 32 30ms 100mbit ${numops}
  116. # Figures 9(b) and 9(c)
  117. run 28 1us 100gbit ${numops}
  118. run 30 1us 100gbit ${numops}
  119. run 32 1us 100gbit ${numops}
  120. fi
  121. now=`date`
  122. echo "$now: Experiments complete"
  123. # If you specified a custom log suffix, you're going to be parsing the
  124. # outputs differently.
  125. if [ "$LOGSUFFIX" = "" ]; then
  126. parse *_${numops}.out > oram_${numops}.dat
  127. echo
  128. echo "# Figure 9(a)"
  129. egrep 'CircuitORAMOnln read .* 30ms 100mbit .* s$' oram_${numops}.dat | sort -k3 -n
  130. echo
  131. egrep 'CircuitORAMTotl read .* 30ms 100mbit .* s$' oram_${numops}.dat | sort -k3 -n
  132. echo
  133. echo "# Figure 9(b)"
  134. egrep 'CircuitORAMOnln read .* 1us 100gbit .* s$' oram_${numops}.dat | sort -k3 -n
  135. echo
  136. egrep 'CircuitORAMTotl read .* 1us 100gbit .* s$' oram_${numops}.dat | sort -k3 -n
  137. echo
  138. echo "# Figure 9(c)"
  139. egrep 'CircuitORAMOnln read .* 1us 100gbit .* KiB$' oram_${numops}.dat | sort -k3 -n
  140. echo
  141. egrep 'CircuitORAMTotl read .* 1us 100gbit .* KiB$' oram_${numops}.dat | sort -k3 -n
  142. echo
  143. echo "# End figures"
  144. fi