repro 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #!/bin/bash
  2. # Reproduce the Floram 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 Duoram NUMA commands are set, but Floram-specific ones are not,
  10. # use them for Floram
  11. if [ "$FLORAM_NUMA_P0" == "" -a "$DUORAM_NUMA_P0" != "" ]; then
  12. export FLORAM_NUMA_P0="$DUORAM_NUMA_P0"
  13. fi
  14. if [ "$FLORAM_NUMA_P1" == "" -a "$DUORAM_NUMA_P1" != "" ]; then
  15. export FLORAM_NUMA_P1="$DUORAM_NUMA_P1"
  16. fi
  17. # Allow running only subsets of the experiment suite. Valid values are
  18. # "test", "all", "none". ("none" is useful if you just want to re-parse
  19. # the output of existing logs.) You can also say "single" followed by
  20. # all the arguments to "run" (below) to run a single experiment; for
  21. # example:
  22. # ./repro single read 20 1
  23. if [ "$1" = "" ]; then
  24. whichexps="test"
  25. else
  26. whichexps="$1"
  27. fi
  28. # The number of operations per run; the graphs in the paper use 3
  29. if [ "$whichexps" = "single" -o "$2" = "" ]; then
  30. # If there's an explicit experiment on the command line, don't read
  31. # the next argument as the number of operations. $numops will be
  32. # ignored, anyway, since it will be specified as part of the
  33. # command.
  34. numiters=3
  35. else
  36. numiters="$2"
  37. fi
  38. # Run one experiment
  39. # Arguments:
  40. # $1: mode (read, bs)
  41. # $2: depth (the ORAM has 2^depth elements)
  42. # $3: number of operations (e.g., 20)
  43. run() {
  44. now=`date`
  45. echo "$now: Running $1 $2 $3 ..."
  46. logfile="${1}_${3}.out${LOGSUFFIX}"
  47. mkdir -p data
  48. ../run-experiment $1 $2 $3 >> data/$logfile
  49. }
  50. # Parse the output logs. We run this in the docker in case you don't
  51. # have perl installed on the host.
  52. # Arguments: a list of logfiles
  53. parse() {
  54. if [ "$FLORAM_PARSE_HOST" = "1" ]; then
  55. ../parse_logs $*
  56. else
  57. cat $* | docker exec -w /root -i floram_p0 ./parse_logs
  58. fi
  59. }
  60. # A very small kick-the-tires test to ensure everything compiled and
  61. # built properly
  62. if [ "$whichexps" = "test" ]; then
  63. echo "Running test experiment..."
  64. run read 16 1
  65. echo
  66. echo "# Test output"
  67. echo
  68. parse data/read_1.out${LOGSUFFIX}
  69. echo
  70. echo "# End test output"
  71. echo
  72. exit
  73. fi
  74. # Be able to run a single experiment specified on the command line
  75. if [ "$whichexps" = "single" ]; then
  76. echo "Running single experiment..."
  77. shift
  78. run $*
  79. exit
  80. fi
  81. now=`date`
  82. echo "$now: Starting experiments"
  83. if [ "$whichexps" = "all" ]; then
  84. echo "Running experiments..."
  85. # Figure 6(a)
  86. ./repro-reads-const-db.sh ${numiters}
  87. # Figures 6(b) and 6(c)
  88. ./repro-reads.sh ${numiters}
  89. # Figure 7(a)
  90. ./repro-bs-const-db.sh ${numiters}
  91. # Figures 7(b) and 7(c)
  92. ./repro-bs.sh ${numiters}
  93. fi
  94. now=`date`
  95. echo "$now: Experiments complete"
  96. # If you specified a custom log suffix, you're going to be parsing the
  97. # outputs differently.
  98. if [ "$LOGSUFFIX" = "" ]; then
  99. parse data/*.out > data/floram.dat
  100. echo
  101. echo "# Figure 6(a)"
  102. egrep 'Floram read 20 (16|32|64|128|256|512|1024|2048) .* s$' data/floram.dat | sort -k4 -n
  103. echo
  104. echo "# Figure 6(b)"
  105. egrep 'Floram read ([0-9]+) 10 .* s$' data/floram.dat | sort -k3 -n
  106. echo
  107. echo "# Figure 6(c)"
  108. egrep 'Floram read ([0-9]+) 10 .* KiB$' data/floram.dat | sort -k3 -n
  109. echo
  110. echo "# Figure 7(a)"
  111. egrep 'Floram bs 20 (4|8|16|32|64) .* s$' data/floram.dat | sort -k4 -n
  112. echo
  113. echo "# Figure 7(b)"
  114. egrep 'Floram bs ([0-9]+) 1 .* s$' data/floram.dat | sort -k3 -n
  115. echo
  116. echo "# Figure 7(c)"
  117. egrep 'Floram bs ([0-9]+) 1 .* KiB$' data/floram.dat | sort -k3 -n
  118. echo
  119. echo "# End figures"
  120. echo
  121. fi