repro 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #!/bin/bash
  2. # Reproduce the Ramen 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 Ramen-specific ones are not,
  10. # use them for Ramen.
  11. if [ "$RAMEN_NUMA_P0" == "" -a "$PRAC_NUMA_P0" != "" ]; then
  12. export RAMEN_NUMA_P0="$PRAC_NUMA_P0"
  13. fi
  14. if [ "$RAMEN_NUMA_P1" == "" -a "$PRAC_NUMA_P1" != "" ]; then
  15. export RAMEN_NUMA_P1="$PRAC_NUMA_P1"
  16. fi
  17. if [ "$RAMEN_NUMA_P2" == "" -a "$PRAC_NUMA_P2" != "" ]; then
  18. export RAMEN_NUMA_P2="$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="ramen_${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 [ "$RAMEN_PARSE_HOST" = "1" ]; then
  57. ./parse_logs $*
  58. else
  59. cat $* | docker exec -w /root/ramen/repro -i ramen_p0 ./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/ramen_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" = "fig6" -o "$whichexps" = "all" ]; then
  86. echo "Running Figure 6 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. fi
  92. if [ "$whichexps" = "fig7" -o "$whichexps" = "all" ]; then
  93. echo "Running Figure 7 experiments..."
  94. # Figure 7(a)
  95. ./generate_raw_data_bs_const_db.sh ${numiters}
  96. # Figures 7(b) and 7(c)
  97. ./generate_raw_data_bs.sh ${numiters}
  98. fi
  99. if [ "$whichexps" = "fig8" -o "$whichexps" = "all" ]; then
  100. echo "Running Figure 8 experiments..."
  101. # Figure 8(a)
  102. ./generate_raw_data_heap_const_db.sh ${numiters}
  103. # Figures 8(b) and 8(c)
  104. ./generate_raw_data_heap.sh ${numiters}
  105. fi
  106. now=`date`
  107. echo "$now: Experiments complete"
  108. # If you specified a custom log suffix, you're going to be parsing the
  109. # outputs differently.
  110. if [ "$LOGSUFFIX" = "" ]; then
  111. parse data/*.out > data/ramen.dat
  112. echo
  113. echo "# Figure 6(a)"
  114. egrep 'Ramen read 20 (16|32|64|128|256|512|1024|2048) .* s$' data/ramen.dat | sort -k4 -n
  115. echo
  116. echo "# Figure 6(b)"
  117. egrep 'Ramen read ([0-9]+) 10 .* s$' data/ramen.dat | sort -k3 -n
  118. echo
  119. echo "# Figure 6(c)"
  120. egrep 'Ramen read ([0-9]+) 10 .* KiB$' data/ramen.dat | sort -k3 -n
  121. echo
  122. echo "# Figure 7(a)"
  123. egrep 'Ramen read 20 (80|160|320|640|1280) .* s$' data/ramen.dat | sort -k4 -n
  124. echo
  125. echo "# Figure 7(b)"
  126. egrep 'Ramen read ([0-9]+) \1 .* s$' data/ramen.dat | sort -k3 -n
  127. echo
  128. echo "# Figure 7(c)"
  129. egrep 'Ramen read ([0-9]+) \1 .* KiB$' data/ramen.dat | sort -k3 -n
  130. echo
  131. echo "# Figure 8(a)"
  132. egrep 'Ramen read 20 (456|912|1824|3648) .* s$' data/ramen.dat | sort -k4 -n
  133. echo
  134. echo "# Figure 8(b)"
  135. egrep 'Ramen read (16 90|18 102|20 114|22 126|24 138|26 150|28 162|30 174) .* s$' data/ramen.dat | sort -k3 -n
  136. echo
  137. echo "# Figure 8(c)"
  138. egrep 'Ramen read (16 90|18 102|20 114|22 126|24 138|26 150|28 162|30 174) .* KiB$' data/ramen.dat | sort -k3 -n
  139. echo
  140. echo "# End figures"
  141. fi