#!/bin/bash # Reproduce the 3-party Circuit ORAM experiments from our paper: # Sajin Sasy, Adithya Vadapalli, Ian Goldberg. PRAC: Round-Efficient # 3-Party MPC for Dynamic Data Structures # cd into the directory containing this script (from the bash faq 028) if [[ $BASH_SOURCE = */* ]]; then cd -- "${BASH_SOURCE%/*}/" || exit fi # If the PRAC NUMA commands are set, but Circuit-ORAM-specific ones are not, # use them for Circuit ORAM. if [ "$ORAM_NUMA_C" == "" -a "$PRAC_NUMA_P0" != "" ]; then export ORAM_NUMA_C="$PRAC_NUMA_P0" fi if [ "$ORAM_NUMA_D" == "" -a "$PRAC_NUMA_P1" != "" ]; then export ORAM_NUMA_D="$PRAC_NUMA_P1" fi if [ "$ORAM_NUMA_E" == "" -a "$PRAC_NUMA_P2" != "" ]; then export ORAM_NUMA_E="$PRAC_NUMA_P2" fi # Allow running only subsets of the experiment suite. Valid values are # "test", "all", "none". ("none" is useful if you just want to re-parse # the output of existing logs.) You can also say "single" followed by # all the arguments to "run" (below) to run a single experiment; for # example: # ./repro single 20 1 if [ "$1" = "" ]; then whichexps="test" else whichexps="$1" fi # The number of operations per run; the graphs in the paper use 3 if [ "$whichexps" = "single" -o "$2" = "" ]; then # If there's an explicit experiment on the command line, don't read # the next argument as the number of operations. $numops will be # ignored, anyway, since it will be specified as part of the # command. numiters=3 else numiters="$2" fi # Run one experiment # Arguments: # $1: depth (the ORAM has 2^depth elements) # $2: number of operations (e.g., 20) run() { now=`date` echo "$now: Running $1 $2 ..." logfile="oram_${1}_${2}.out${LOGSUFFIX}" mkdir -p data ../docker/run-experiment $1 $2 >> data/$logfile } # Parse the output logs. We run this in the docker in case you don't # have perl installed on the host. # Arguments: a list of logfiles parse() { if [ "$ORAM_PARSE_HOST" = "1" ]; then ./parse_logs $* else cat $* | docker exec -w /root/oram/docker -i oram_C ./parse_logs fi } # A very small kick-the-tires test to ensure everything compiled and # built properly if [ "$whichexps" = "test" ]; then echo "Running test experiment..." run 16 1 echo echo "# Test output" echo parse data/oram_16_1.out${LOGSUFFIX} echo echo "# End test output" echo exit fi # Be able to run a single experiment specified on the command line if [ "$whichexps" = "single" ]; then echo "Running single experiment..." shift run $* exit fi now=`date` echo "$now: Starting experiments" if [ "$whichexps" = "fig6" -o "$whichexps" = "all" ]; then echo "Running Figure 6 experiments..." # Figure 6(a) ./generate_raw_data_reads_const_db.sh ${numiters} # Figures 6(b) and 6(c) ./generate_raw_data_reads.sh ${numiters} fi if [ "$whichexps" = "fig7" -o "$whichexps" = "all" ]; then echo "Running Figure 7 experiments..." # Figure 7(a) ./generate_raw_data_bs_const_db.sh ${numiters} # Figures 7(b) and 7(c) ./generate_raw_data_bs.sh ${numiters} fi if [ "$whichexps" = "fig8" -o "$whichexps" = "all" ]; then echo "Running Figure 8 experiments..." # Figure 8(a) ./generate_raw_data_heap_const_db.sh ${numiters} # Figures 8(b) and 8(c) ./generate_raw_data_heap.sh ${numiters} fi now=`date` echo "$now: Experiments complete" # If you specified a custom log suffix, you're going to be parsing the # outputs differently. if [ "$LOGSUFFIX" = "" ]; then parse data/*.out > data/oram.dat echo echo "# Figure 6(a)" egrep 'CircuitORAMOnln read 20 (16|32|64|128|256|512|1024|2048) .* s$' data/oram.dat | sort -k4 -n echo egrep 'CircuitORAMTotl read 20 (16|32|64|128|256|512|1024|2048) .* s$' data/oram.dat | sort -k4 -n echo echo "# Figure 6(b)" egrep 'CircuitORAMOnln read ([0-9]+) 10 .* s$' data/oram.dat | sort -k3 -n echo egrep 'CircuitORAMTotl read ([0-9]+) 10 .* s$' data/oram.dat | sort -k3 -n echo echo "# Figure 6(c)" egrep 'CircuitORAMOnln read ([0-9]+) 10 .* KiB$' data/oram.dat | sort -k3 -n echo egrep 'CircuitORAMTotl read ([0-9]+) 10 .* KiB$' data/oram.dat | sort -k3 -n echo echo "# Figure 7(a)" egrep 'CircuitORAMOnln read 20 (80|160|320|640|1280) .* s$' data/oram.dat | sort -k4 -n echo egrep 'CircuitORAMTotl read 20 (80|160|320|640|1280) .* s$' data/oram.dat | sort -k4 -n echo echo "# Figure 7(b)" egrep 'CircuitORAMOnln read ([0-9]+) \1 .* s$' data/oram.dat | sort -k3 -n echo egrep 'CircuitORAMTotl read ([0-9]+) \1 .* s$' data/oram.dat | sort -k3 -n echo echo "# Figure 7(c)" egrep 'CircuitORAMOnln read ([0-9]+) \1 .* KiB$' data/oram.dat | sort -k3 -n echo egrep 'CircuitORAMTotl read ([0-9]+) \1 .* KiB$' data/oram.dat | sort -k3 -n echo echo "# Figure 8(a)" egrep 'CircuitORAMOnln read 20 (456|912|1824|3648) .* s$' data/oram.dat | sort -k4 -n echo egrep 'CircuitORAMTotl read 20 (456|912|1824|3648) .* s$' data/oram.dat | sort -k4 -n echo echo "# Figure 8(b)" egrep 'CircuitORAMOnln read (16 90|18 102|20 114|22 126|24 138|26 150|28 162|30 174) .* s$' data/oram.dat | sort -k3 -n echo egrep 'CircuitORAMTotl read (16 90|18 102|20 114|22 126|24 138|26 150|28 162|30 174) .* s$' data/oram.dat | sort -k3 -n echo echo "# Figure 8(c)" egrep 'CircuitORAMOnln read (16 90|18 102|20 114|22 126|24 138|26 150|28 162|30 174) .* KiB$' data/oram.dat | sort -k3 -n echo egrep 'CircuitORAMTotl read (16 90|18 102|20 114|22 126|24 138|26 150|28 162|30 174) .* KiB$' data/oram.dat | sort -k3 -n echo echo "# End figures" fi