repro 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 master NUMA commands are set, use them for Circuit ORAM
  11. if [ "$NUMA_P0" != "" ]; then
  12. export ORAM_NUMA_C="$NUMA_P0"
  13. fi
  14. if [ "$NUMA_P1" != "" ]; then
  15. export ORAM_NUMA_D="$NUMA_P1"
  16. fi
  17. if [ "$NUMA_P2" != "" ]; then
  18. export ORAM_NUMA_E="$NUMA_P2"
  19. fi
  20. # Allow running only subsets of the experiment suite. Valid values are
  21. # "test", "small", "large", "all", "none". ("none" is useful if you
  22. # just want to re-parse the output of existing logs.) You can also say
  23. # "single" followed by all the arguments to "run" (below) to run a
  24. # single experiment; for example:
  25. # ./repro single 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: depth (the ORAM has 2^depth elements)
  44. # $2: latency (e.g., 30ms)
  45. # $3: bandwidth (e.g., 100mbit)
  46. # $4: number of operations (e.g., 128)
  47. run() {
  48. now=`date`
  49. echo "$now: Running $1 $2 $3 $4 ..."
  50. logfile="read_${2}_${3}_${4}.out${LOGSUFFIX}"
  51. ./set-networking $2 $3
  52. echo "Network setup: $2 $3" >> $logfile
  53. ./run-experiment $1 $4 >> $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/oram/docker -i oram_C ./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 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 9(a)
  81. run 16 30ms 100mbit ${numops}
  82. run 18 30ms 100mbit ${numops}
  83. run 20 30ms 100mbit ${numops}
  84. run 22 30ms 100mbit ${numops}
  85. run 24 30ms 100mbit ${numops}
  86. run 26 30ms 100mbit ${numops}
  87. # Figures 9(b) and 9(c)
  88. # Note that we set the latency to 1us, which really means "don't add
  89. # artificial latency", but we measure the one-way latency to
  90. # actually be 30us, which is what we report in the paper. (pings
  91. # from one docker to the other take about 60us round trip.)
  92. run 16 1us 100gbit ${numops}
  93. run 18 1us 100gbit ${numops}
  94. run 20 1us 100gbit ${numops}
  95. run 22 1us 100gbit ${numops}
  96. run 24 1us 100gbit ${numops}
  97. run 26 1us 100gbit ${numops}
  98. fi
  99. if [ "$whichexps" == "large" -o "$whichexps" == "all" ]; then
  100. echo "Running large experiments..."
  101. # Figure 9(a)
  102. run 28 30ms 100mbit ${numops}
  103. run 30 30ms 100mbit ${numops}
  104. run 32 30ms 100mbit ${numops}
  105. # Figures 9(b) and 9(c)
  106. run 28 1us 100gbit ${numops}
  107. run 30 1us 100gbit ${numops}
  108. run 32 1us 100gbit ${numops}
  109. fi
  110. now=`date`
  111. echo "$now: Experiments complete"
  112. # If you specified a custom log suffix, you're going to be parsing the
  113. # outputs differently.
  114. if [ "$LOGSUFFIX" == "" ]; then
  115. parse *_${numops}.out > oram_${numops}.dat
  116. echo
  117. echo "# Figure 9(a)"
  118. egrep 'Floram read .* 30ms 100mbit .* s$' oram_${numops}.dat | sort -k3 -n
  119. echo
  120. echo "# Figure 9(b)"
  121. egrep 'Floram read .* 1us 100gbit .* s$' oram_${numops}.dat | sort -k3 -n
  122. echo
  123. echo "# Figure 9(c)"
  124. egrep 'Floram read .* 1us 100gbit .* KiB$' oram_${numops}.dat | sort -k3 -n
  125. fi