repro-fig9-livenet 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #!/bin/bash
  2. # Reproduce the live network experiments for Figure 9 of the paper.
  3. # We need these environment variables set:
  4. # PRAC_SSH_P0_USERHOST: the user@host to ssh to for P0
  5. # PRAC_SSH_P0_SSHOPTS: any options to ssh you need to ssh to P0
  6. # PRAC_SSH_P0_IP: the IP address P0 can listen for connections on
  7. # PRAC_SSH_P0_DIR: the directory relative to the homedir where the prac
  8. # repo is checked out and built
  9. # PRAC_SSH_P1_USERHOST: the user@host to ssh to for P1
  10. # PRAC_SSH_P1_SSHOPTS: any options to ssh you need to ssh to P1
  11. # PRAC_SSH_P1_IP: the IP address P1 can listen for connections on
  12. # PRAC_SSH_P1_DIR: the directory relative to the homedir where the prac
  13. # repo is checked out and built
  14. # PRAC_SSH_P2_USERHOST: the user@host to ssh to for P2
  15. # PRAC_SSH_P2_SSHOPTS: any options to ssh you need to ssh to P2
  16. # PRAC_SSH_P2_IP: the IP address P2 can listen for connections on
  17. # PRAC_SSH_P2_DIR: the directory relative to the homedir where the prac
  18. # repo is checked out and built
  19. # Optional: PRAC_NUMA_P{0,1,2}
  20. # Add additional env vars
  21. export PRAC_USE_SSH=1
  22. export PRAC_PARSE_HOST=1
  23. # cd into the directory containing this script (from the bash faq 028)
  24. if [[ $BASH_SOURCE = */* ]]; then
  25. cd -- "${BASH_SOURCE%/*}/" || exit
  26. fi
  27. # The number of iterations to do
  28. if [ "$1" = "" ]; then
  29. niters=3
  30. else
  31. niters="$1"
  32. fi
  33. # Run the PRAC experiments
  34. echo "Running PRAC experiments..."
  35. echo
  36. ./repro fig9 $niters || exit 1
  37. # Set up the ORAM environment variables based on the PRAC ones
  38. export ORAM_SSH_C_USERHOST="$PRAC_SSH_P0_USERHOST"
  39. export ORAM_SSH_C_SSHOPTS="$PRAC_SSH_P0_SSHOPTS"
  40. export ORAM_SSH_C_IP="$PRAC_SSH_P0_IP"
  41. export ORAM_SSH_C_DIR="$PRAC_SSH_P0_DIR"/repro/comps/circuit-oram
  42. export ORAM_NUMA_C="$PRAC_NUMA_P0"
  43. export ORAM_SSH_D_USERHOST="$PRAC_SSH_P1_USERHOST"
  44. export ORAM_SSH_D_SSHOPTS="$PRAC_SSH_P1_SSHOPTS"
  45. export ORAM_SSH_D_IP="$PRAC_SSH_P1_IP"
  46. export ORAM_SSH_D_DIR="$PRAC_SSH_P1_DIR"/repro/comps/circuit-oram
  47. export ORAM_NUMA_D="$PRAC_NUMA_P1"
  48. export ORAM_SSH_E_USERHOST="$PRAC_SSH_P2_USERHOST"
  49. export ORAM_SSH_E_SSHOPTS="$PRAC_SSH_P2_SSHOPTS"
  50. export ORAM_SSH_E_IP="$PRAC_SSH_P2_IP"
  51. export ORAM_SSH_E_DIR="$PRAC_SSH_P2_DIR"/repro/comps/circuit-oram
  52. export ORAM_NUMA_E="$PRAC_NUMA_P2"
  53. export ORAM_USE_SSH=1
  54. export ORAM_PARSE_HOST=1
  55. echo
  56. echo "Running Circuit ORAM experiments..."
  57. echo
  58. ( cd comps/circuit-oram/prac && \
  59. ./generate_raw_data_reads_ssh.sh $niters && \
  60. ./parse_logs data/*.out > data/oram.dat ) || exit 1
  61. # Set up the Ramen environment variables based on the PRAC ones
  62. export RAMEN_SSH_P0_USERHOST="$PRAC_SSH_P0_USERHOST"
  63. export RAMEN_SSH_P0_SSHOPTS="$PRAC_SSH_P0_SSHOPTS"
  64. export RAMEN_SSH_P0_IP="$PRAC_SSH_P0_IP"
  65. export RAMEN_SSH_P0_DIR="$PRAC_SSH_P0_DIR"/repro/comps/ramen
  66. export RAMEN_NUMA_P0="$PRAC_NUMA_P0"
  67. export RAMEN_SSH_P1_USERHOST="$PRAC_SSH_P1_USERHOST"
  68. export RAMEN_SSH_P1_SSHOPTS="$PRAC_SSH_P1_SSHOPTS"
  69. export RAMEN_SSH_P1_IP="$PRAC_SSH_P1_IP"
  70. export RAMEN_SSH_P1_DIR="$PRAC_SSH_P1_DIR"/repro/comps/ramen
  71. export RAMEN_NUMA_P1="$PRAC_NUMA_P1"
  72. export RAMEN_SSH_P2_USERHOST="$PRAC_SSH_P2_USERHOST"
  73. export RAMEN_SSH_P2_SSHOPTS="$PRAC_SSH_P2_SSHOPTS"
  74. export RAMEN_SSH_P2_IP="$PRAC_SSH_P2_IP"
  75. export RAMEN_SSH_P2_DIR="$PRAC_SSH_P2_DIR"/repro/comps/ramen
  76. export RAMEN_NUMA_P2="$PRAC_NUMA_P2"
  77. export RAMEN_USE_SSH=1
  78. export RAMEN_PARSE_HOST=1
  79. echo
  80. echo "Running Ramen experiments..."
  81. echo
  82. ( cd comps/ramen/repro && \
  83. ./generate_raw_data_reads_ssh.sh $niters && \
  84. ./parse_logs data/*.out > data/ramen.dat ) || exit 1
  85. echo
  86. echo '# Figure 9'
  87. egrep 'PRACTotl heapsampler [0-9]+ [0-9]+ .* s' data/prac.dat | sort -k3,3n -k4,4n
  88. echo
  89. echo '# Last sentence of Section 8'
  90. prac_seconds=$(egrep 'PRACTotl heapsampler 300 2048 [0-9\.]+ .*s' data/prac.dat | cut -d' ' -f5)
  91. prac_hours=$(echo "$prac_seconds / 3600" | bc -l)
  92. echo 'PRAC '$prac_hours' hours'
  93. # The time to do 1 heap extract (48 ORAM reads)
  94. ramen_1_seconds=$(egrep 'Ramen read 9 48 [0-9\.]+ .*s' comps/ramen/repro/data/ramen.dat | cut -d' ' -f5)
  95. # The time to do 10 heap extracts (480 ORAM reads)
  96. ramen_10_seconds=$(egrep 'Ramen read 9 480 [0-9\.]+ .*s' comps/ramen/repro/data/ramen.dat | cut -d' ' -f5)
  97. # Extrapolate to 2048 heap extracts = 2048*48 = 98304 ORAM reads, noting there
  98. # may be constant overhead, so that the time for the first extract may be
  99. # different from subsequent ones. Therefore, compute the time for the 9
  100. # subsequent ones, scale up to 2047, and add the first one back in.
  101. ramen_2048_seconds=$(echo "($ramen_10_seconds - $ramen_1_seconds) / 9 * 2047 + $ramen_1_seconds" | bc -l)
  102. ramen_2048_hours=$(echo "$ramen_2048_seconds / 3600" | bc -l)
  103. echo 'Ramen '$ramen_2048_hours' hours'
  104. # The time to do 1 ORAM read (not 1 heap extract)
  105. oram_1_seconds=$(egrep 'CircuitORAMTotl read 9 1 [0-9\.]+ .*s' comps/circuit-oram/prac/data/oram.dat | cut -d' ' -f5)
  106. # The time to do 144 ORAM reads (3 heap extracts)
  107. oram_144_seconds=$(egrep 'CircuitORAMTotl read 9 144 [0-9\.]+ .*s' comps/circuit-oram/prac/data/oram.dat | cut -d' ' -f5)
  108. # Extrapolate to 2048 heap extracts = 2048*48 = 98304 ORAM reads as above
  109. oram_98304_seconds=$(echo "($oram_144_seconds - $oram_1_seconds) / 143 * 98303 + $oram_1_seconds" | bc -l)
  110. oram_98304_days=$(echo "$oram_98304_seconds / 3600 / 24" | bc -l)
  111. echo 'CircuitORAM '$oram_98304_days' days'