repro 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. #!/bin/bash
  2. # Reproduce the 3-party Circuit ORAM experiments from our paper:
  3. # Sajin Sasy, Adithya Vadapalli, Ian Goldberg. PRAC: Round-Efficient
  4. # 3-Party MPC for Dynamic Data Structures
  5. # cd into the directory containing this script (from the bash faq 028)
  6. if [[ $BASH_SOURCE = */* ]]; then
  7. cd -- "${BASH_SOURCE%/*}/" || exit
  8. fi
  9. # If the PRAC NUMA commands are set, but Circuit-ORAM-specific ones are not,
  10. # use them for Circuit ORAM.
  11. if [ "$ORAM_NUMA_C" == "" -a "$PRAC_NUMA_P0" != "" ]; then
  12. export ORAM_NUMA_C="$PRAC_NUMA_P0"
  13. fi
  14. if [ "$ORAM_NUMA_D" == "" -a "$PRAC_NUMA_P1" != "" ]; then
  15. export ORAM_NUMA_D="$PRAC_NUMA_P1"
  16. fi
  17. if [ "$ORAM_NUMA_E" == "" -a "$PRAC_NUMA_P2" != "" ]; then
  18. export ORAM_NUMA_E="$PRAC_NUMA_P2"
  19. fi
  20. # Allow running only subsets of the experiment suite. Valid values are
  21. # "test", "all", "none". ("none" is useful if you just want to re-parse
  22. # the output of existing logs.) You can also say "single" followed by
  23. # all the arguments to "run" (below) to run a single experiment; for
  24. # example:
  25. # ./repro single 20 1
  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 3
  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. numiters=3
  38. else
  39. numiters="$2"
  40. fi
  41. # Run one experiment
  42. # Arguments:
  43. # $1: depth (the ORAM has 2^depth elements)
  44. # $2: number of operations (e.g., 20)
  45. run() {
  46. now=`date`
  47. echo "$now: Running $1 $2 ..."
  48. logfile="oram_${1}_${2}.out${LOGSUFFIX}"
  49. mkdir -p data
  50. ../docker/run-experiment $1 $2 >> data/$logfile
  51. }
  52. # Parse the output logs. We run this in the docker in case you don't
  53. # have perl installed on the host.
  54. # Arguments: a list of logfiles
  55. parse() {
  56. if [ "$ORAM_PARSE_HOST" = "1" ]; then
  57. ./parse_logs $*
  58. else
  59. cat $* | docker exec -w /root/oram/docker -i oram_C ./parse_logs
  60. fi
  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 16 1
  67. echo
  68. echo "# Test output"
  69. echo
  70. parse data/oram_16_1.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" = "all" ]; then
  86. echo "Running experiments..."
  87. # Figure 6(a)
  88. ./generate_raw_data_reads_const_db.sh ${numiters}
  89. # Figures 6(b) and 6(c)
  90. ./generate_raw_data_reads.sh ${numiters}
  91. # Figure 7(a)
  92. ./generate_raw_data_bs_const_db.sh ${numiters}
  93. # Figures 7(b) and 7(c)
  94. ./generate_raw_data_bs.sh ${numiters}
  95. # Figure 8(a)
  96. ./generate_raw_data_heap_const_db.sh ${numiters}
  97. # Figures 8(b) and 8(c)
  98. ./generate_raw_data_heap.sh ${numiters}
  99. fi
  100. now=`date`
  101. echo "$now: Experiments complete"
  102. # If you specified a custom log suffix, you're going to be parsing the
  103. # outputs differently.
  104. if [ "$LOGSUFFIX" = "" ]; then
  105. parse data/*.out > data/oram.dat
  106. echo
  107. echo "# Figure 6(a)"
  108. egrep 'CircuitORAMOnln read 20 (16|32|64|128|256|512|1024|2048) .* s$' data/oram.dat | sort -k4 -n
  109. echo
  110. egrep 'CircuitORAMTotl read 20 (16|32|64|128|256|512|1024|2048) .* s$' data/oram.dat | sort -k4 -n
  111. echo
  112. echo "# Figure 6(b)"
  113. egrep 'CircuitORAMOnln read ([0-9]+) 10 .* s$' data/oram.dat | sort -k3 -n
  114. echo
  115. egrep 'CircuitORAMTotl read ([0-9]+) 10 .* s$' data/oram.dat | sort -k3 -n
  116. echo
  117. echo "# Figure 6(c)"
  118. egrep 'CircuitORAMOnln read ([0-9]+) 10 .* KiB$' data/oram.dat | sort -k3 -n
  119. echo
  120. egrep 'CircuitORAMTotl read ([0-9]+) 10 .* KiB$' data/oram.dat | sort -k3 -n
  121. echo
  122. echo "# Figure 7(a)"
  123. egrep 'CircuitORAMOnln read 20 (80|160|320|640|1280) .* s$' data/oram.dat | sort -k4 -n
  124. echo
  125. egrep 'CircuitORAMTotl read 20 (80|160|320|640|1280) .* s$' data/oram.dat | sort -k4 -n
  126. echo
  127. echo "# Figure 7(b)"
  128. egrep 'CircuitORAMOnln read ([0-9]+) \1 .* s$' data/oram.dat | sort -k3 -n
  129. echo
  130. egrep 'CircuitORAMTotl read ([0-9]+) \1 .* s$' data/oram.dat | sort -k3 -n
  131. echo
  132. echo "# Figure 7(c)"
  133. egrep 'CircuitORAMOnln read ([0-9]+) \1 .* KiB$' data/oram.dat | sort -k3 -n
  134. echo
  135. egrep 'CircuitORAMTotl read ([0-9]+) \1 .* KiB$' data/oram.dat | sort -k3 -n
  136. echo
  137. echo "# Figure 8(a)"
  138. egrep 'CircuitORAMOnln read 20 (480|960|1920|3840) .* s$' data/oram.dat | sort -k4 -n
  139. echo
  140. egrep 'CircuitORAMTotl read 20 (480|960|1920|3840) .* s$' data/oram.dat | sort -k4 -n
  141. echo
  142. echo "# Figure 8(b)"
  143. egrep 'CircuitORAMOnln read (16 96|18 108|20 120|22 132|24 144|26 156|28 168|30 180) .* s$' data/oram.dat | sort -k3 -n
  144. echo
  145. egrep 'CircuitORAMTotl read (16 96|18 108|20 120|22 132|24 144|26 156|28 168|30 180) .* s$' data/oram.dat | sort -k3 -n
  146. echo
  147. echo "# Figure 8(c)"
  148. egrep 'CircuitORAMOnln read (16 96|18 108|20 120|22 132|24 144|26 156|28 168|30 180) .* KiB$' data/oram.dat | sort -k3 -n
  149. echo
  150. egrep 'CircuitORAMTotl read (16 96|18 108|20 120|22 132|24 144|26 156|28 168|30 180) .* KiB$' data/oram.dat | sort -k3 -n
  151. echo
  152. echo "# End figures"
  153. fi