repro 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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 5
  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=5
  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 7(a)
  88. ./generate_raw_data_bs_const_db.sh ${numiters}
  89. # Figures 7(b) and 7(c)
  90. ./generate_raw_data_bs.sh ${numiters}
  91. # Figure 8(a)
  92. ./generate_raw_data_heap_const_db.sh ${numiters}
  93. # Figures 8(b) and 8(c)
  94. ./generate_raw_data_heap.sh ${numiters}
  95. fi
  96. now=`date`
  97. echo "$now: Experiments complete"
  98. # If you specified a custom log suffix, you're going to be parsing the
  99. # outputs differently.
  100. if [ "$LOGSUFFIX" = "" ]; then
  101. parse data/*.out > data/oram.dat
  102. echo
  103. echo "# Figure 7(a)"
  104. egrep 'CircuitORAMOnln read 20 (80|160|320|640|1280) .* s$' data/oram.dat | sort -k4 -n
  105. echo
  106. egrep 'CircuitORAMTotl read 20 (80|160|320|640|1280) .* s$' data/oram.dat | sort -k4 -n
  107. echo
  108. echo "# Figure 7(b)"
  109. egrep 'CircuitORAMOnln read ([0-9]+) \1 .* s$' data/oram.dat | sort -k3 -n
  110. echo
  111. egrep 'CircuitORAMTotl read ([0-9]+) \1 .* s$' data/oram.dat | sort -k3 -n
  112. echo
  113. echo "# Figure 7(c)"
  114. egrep 'CircuitORAMOnln read ([0-9]+) \1 .* KiB$' data/oram.dat | sort -k3 -n
  115. echo
  116. egrep 'CircuitORAMTotl read ([0-9]+) \1 .* KiB$' data/oram.dat | sort -k3 -n
  117. echo
  118. echo "# Figure 8(a)"
  119. egrep 'CircuitORAMOnln read 20 (480|960|1920|3840) .* s$' data/oram.dat | sort -k4 -n
  120. echo
  121. egrep 'CircuitORAMTotl read 20 (480|960|1920|3840) .* s$' data/oram.dat | sort -k4 -n
  122. echo
  123. echo "# Figure 8(b)"
  124. 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
  125. echo
  126. 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
  127. echo
  128. echo "# Figure 8(c)"
  129. 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
  130. echo
  131. 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
  132. echo
  133. echo "# End figures"
  134. fi