Переглянути джерело

Repro for Figures 7 and 8 of the PRAC paper for 3P Circuit ORAM

Ian Goldberg 6 місяців тому
батько
коміт
6f326cb5bb

+ 32 - 27
prac/README.md

@@ -1,44 +1,49 @@
-#Generating the PRAC data for 3P-Circuit ORAM
+# Generating the data for 3P-Circuit ORAM for the PRAC paper
 
 ## Building the docker
 
-cd docker
-Build the docker image with ./build-docker
-Start the dockers with ./start-docker
-This will start three dockers, each running one of the parties.
+  - `cd ../docker`
+  - Build the docker image with `./build-docker`
+  - Start the dockers with `./start-docker` (This will start three dockers, each running one of the parties.)
 
 ## Setting the network parameters
 
-./set-networking 30ms 100mbit
+  - `./set-networking 30ms 100mbit`
 
 ## Generating raw data for the binary search experiments
 
-### Generating data for Figure 7 a)
-cd prac
-Open the file `generate_raw_data_bs_const_db.sh`
-Change the variable `nitrs` to the number of times you would like run each experiment
-Generate the raw data for Figure 7a) using `sh generate_raw_data_bs_const_db.sh`
+  - `cd ../prac`
+  - Run the reproduction script `./repro` with one of the following arguments:
+    - <code>./repro test</code>: Run a short (about 30 seconds) "kick-the-tires" test.
+      You should see output like the following:
 
-### Generating data for Figures 7 b) and 7 c)
-cd prac
-Open the file `generate_raw_data_bs_const_db.sh`
-Change the variable `nitrs` to the number of times you would like run each experiment
-Generate the raw data for Figure 7b) and 7c) using `sh generate_raw_data_bs.sh`
+            Running test experiment...
+            Wed Nov  1 03:59:19 PM EDT 2023: Running 16 1 ...
 
+            # Test output
 
-## Generate the raw data for heap experiments
+            CircuitORAMOnln read 16 1 6.289 s
+            CircuitORAMOnln read 16 1 355.3125 KiB
+            CircuitORAMTotl read 16 1 7.145 s
+            CircuitORAMTotl read 16 1 2478.5 KiB  
 
-### Generating data for Figure 8a)
-cd prac
-Open the file `generate_raw_data_heap_const_db.sh`
-Change the variable `nitrs` to the number of times you would like run each experiment
-Generate the raw data for the heap experiments using `sh generate_raw_data_heap_const_db.sh`
+            # End test output
 
-### Generating data Figures 8b) and 8 c)
-cd prac
-Open the file `generate_raw_data_heap.sh`
-Change the variable `nitrs` to the number of times you would like run each experiment
-Generate the raw data for the heap experiments using `sh generate_raw_data_heap.sh` 
+      The last four lines are the output data points, telling you that a
+      Circuit ORAM read test on an ORAM of size 2<sup>16</sup>, with a network
+      configuration of 1us latency and 100gbit bandwidth, performing 1
+      read operation, took 6.289 s of online time and 7.145 s of total
+      (precomputation plus online) time, and 355.3125 KiB of
+      online bandwidth and 2478.5 KiB of total bandwidth.  If you've run
+      the test before, you will see means and stddevs of all of the output
+      data points.  When you run it, the time of course will depend on
+      the particulars of your hardware, but the bandwidths used should be
+      exactly the values quoted above.
 
+    - <code>./repro all _numiters_</code>: Run all of the tests, doing <code>_numiters_</code> iterations of each.
 
+## When you're done
 
+Stop the docker:
+
+  - `../docker/stop-docker`

+ 24 - 17
prac/generate_raw_data_bs.sh

@@ -1,20 +1,27 @@
-nitrs=2
+#!/bin/bash
+
+# Usage: ./generate_raw_data_bs.sh [niters]
+
+nitrs=1
+if [ "$1" != "" ]; then
+    nitrs="$1"
+fi
+
 cd ..
+mkdir -p prac/data
 for itr in $(seq 1 $nitrs); do
-        ./docker/run-experiment 16 16> "prac/data/log_16_1_bs_itr_$itr"
-        echo "1 search on DB on size 2^16"
-        ./docker/run-experiment 18 18 > "prac/data/log_18_1_bs_itr_$itr"
-        echo "1 search on DB on size 2^18"
-        ./docker/run-experiment 20 20 > "prac/data/log_20_1_bs_itr_$itr"
-        echo "1 search on DB on size 2^20"
-        ./docker/run-experiment 22 22 > "prac/data/log_22_1_bs_itr_$itr"
-        echo "1 search on DB on size 2^22"
-        ./docker/run-experiment 24 24 > "prac/data/log_24_1_bs_itr_$itr"
-        echo "1 search on DB on size 2^24 "
-        ./docker/run-experiment 26 26 > "prac/data/log_26_1_bs_itr_$itr"
-        echo "1 search on DB on size 2^26"
-	./docker/run-experiment 28 28 > "prac/data/log_28_1_bs_itr_$itr"
-        echo "1 search on DB on size 2^28"
-	./docker/run-experiment 30 30 > "prac/data/log_30_1_bs_itr_$itr"
-        echo "1 search on DB on size 2^30"
+    now=`date`; echo "$now: Running 1 search on DB of size 2^16 ..."
+    ./docker/run-experiment 16 16 >> "prac/data/log_16_1_b.out"
+    now=`date`; echo "$now: Running 1 search on DB of size 2^18 ..."
+    ./docker/run-experiment 18 18 >> "prac/data/log_18_1_bs.out"
+    now=`date`; echo "$now: Running 1 search on DB of size 2^20 ..."
+    ./docker/run-experiment 20 20 >> "prac/data/log_20_1_bs.out"
+    now=`date`; echo "$now: Running 1 search on DB of size 2^22 ..."
+    ./docker/run-experiment 22 22 >> "prac/data/log_22_1_bs.out"
+    now=`date`; echo "$now: Running 1 search on DB of size 2^24 ..."
+    ./docker/run-experiment 24 24 >> "prac/data/log_24_1_bs.out"
+    now=`date`; echo "$now: Running 1 search on DB of size 2^26 ..."
+    ./docker/run-experiment 26 26 >> "prac/data/log_26_1_bs.out"
+    now=`date`; echo "$now: Running 1 search on DB of size 2^28 ..."
+    ./docker/run-experiment 28 28 >> "prac/data/log_28_1_bs.out"
 done

+ 19 - 11
prac/generate_raw_data_bs_const_db.sh

@@ -1,15 +1,23 @@
+#!/bin/bash
+
+# Usage: ./generate_raw_data_bs_const_db.sh [niters]
+
 nitrs=1
+if [ "$1" != "" ]; then
+    nitrs="$1"
+fi
+
 cd ..
+mkdir -p prac/data
 for itr in $(seq 1 $nitrs); do
-  ./docker/run-experiment 20 80 > "prac/data/log_20_4_bs_itr_$itr"
-  echo "4 Binary Searches done" 
-  ./docker/run-experiment 20 160 > "prac/data/log_20_8_bs_itr_$itr"
-  echo "8 Binary Searches done"
-  ./docker/run-experiment 20 320 > "prac/data/log_20_16_bs_itr_$itr"
-  echo "16 Binary Searches done"
-  ./docker/run-experiment 20 640 > "prac/data/log_20_32_bs_itr_$itr"
-  echo "32 Binary Searches done"
-  ./docker/run-experiment 20 1280 > "prac/data/log_20_64_bs_itr_$itr"
-  echo "64 Binary Searches done"
+    now=`date`; echo "$now: Running 4 Binary Searches ..."
+    ./docker/run-experiment 20 80 >> "prac/data/log_20_4_bs.out"
+    now=`date`; echo "$now: Running 8 Binary Searches ..."
+    ./docker/run-experiment 20 160 >> "prac/data/log_20_8_bs.out"
+    now=`date`; echo "$now: Running 16 Binary Searches ..."
+    ./docker/run-experiment 20 320 >> "prac/data/log_20_16_bs.out"
+    now=`date`; echo "$now: Running 32 Binary Searches ..."
+    ./docker/run-experiment 20 640 >> "prac/data/log_20_32_bs.out"
+    now=`date`; echo "$now: Running 64 Binary Searches ..."
+    ./docker/run-experiment 20 1280 >> "prac/data/log_20_64_bs.out"
 done
-

+ 26 - 20
prac/generate_raw_data_heap.sh

@@ -1,23 +1,29 @@
-nitrs=2
-cd ..
-for itr in $(seq 1 $nitrs); do
-      ./docker/run-experiment 16 96 > "prac/data/log_16_1_heap_itr_$itr"
-        echo "one heap extract on heapsize of 2^16"
-        ./docker/run-experiment 18 108 > "prac/data/log_18_1_heap_itr_$itr"
-        echo "one heap extract on heapsize of 2^18"
-        ./docker/run-experiment 20 120 > "prac/data/log_20_1_heap_itr_$itr"
-        echo "one heap extract on heapsize of 2^20"
-        ./docker/run-experiment 22 132 > "prac/data/log_22_1_heap_itr_$itr"
-        echo "one heap extract on heapsize of 2^22"
-        ./docker/run-experiment 24 144 > "prac/data/log_24_1_heap_itr_$itr"
-        echo "one heap extract on heapsize of 2^24"
-        ./docker/run-experiment 26 156 > "prac/data/log_26_1_heap_itr_$itr"
-        echo "one heap extract on heapsize of 2^26"
-	./docker/run-experiment 28 168 > "prac/data/log_28_1_heap_itr_$itr"
-        echo "one heap extract on heapsize of 2^28"
-	./docker/run-experiment 30 180 > "prac/data/log_30_1_heap_itr_$itr"
-        echo "one heap extract on heapsize of 2^30"
-done
+#!/bin/bash
 
+# Usage: ./generate_raw_data_heap.sh [niters]
 
+nitrs=1
+if [ "$1" != "" ]; then
+    nitrs="$1"
+fi
 
+cd ..
+mkdir -p prac/data
+for itr in $(seq 1 $nitrs); do
+    now=`date`; echo "$now: Running sheap extract on heapsize of 2^16 ..."
+    ./docker/run-experiment 16 96 >> "prac/data/log_16_1_heap.out"
+    now=`date`; echo "$now: Running sheap extract on heapsize of 2^18 ..."
+    ./docker/run-experiment 18 108 >> "prac/data/log_18_1_heap.out"
+    now=`date`; echo "$now: Running sheap extract on heapsize of 2^20 ..."
+    ./docker/run-experiment 20 120 >> "prac/data/log_20_1_heap.out"
+    now=`date`; echo "$now: Running sheap extract on heapsize of 2^22 ..."
+    ./docker/run-experiment 22 132 >> "prac/data/log_22_1_heap.out"
+    now=`date`; echo "$now: Running sheap extract on heapsize of 2^24 ..."
+    ./docker/run-experiment 24 144 >> "prac/data/log_24_1_heap.out"
+    now=`date`; echo "$now: Running sheap extract on heapsize of 2^26 ..."
+    ./docker/run-experiment 26 156 >> "prac/data/log_26_1_heap.out"
+    now=`date`; echo "$now: Running sheap extract on heapsize of 2^28 ..."
+    ./docker/run-experiment 28 168 >> "prac/data/log_28_1_heap.out"
+    now=`date`; echo "$now: Running sheap extract on heapsize of 2^30 ..."
+    ./docker/run-experiment 30 180 >> "prac/data/log_30_1_heap.out"
+done

+ 18 - 9
prac/generate_raw_data_heap_const_db.sh

@@ -1,12 +1,21 @@
-nitrs=2
+#!/bin/bash
+
+# Usage: ./generate_raw_data_heap_const_db.sh [niters]
+
+nitrs=1
+if [ "$1" != "" ]; then
+    nitrs="$1"
+fi
+
 cd ..
+mkdir -p prac/data
 for itr in $(seq 1 $nitrs); do
-   ./docker/run-experiment 20 480 > "prac/data/log_20_4_heap_itr_$itr"
-   echo "4 Heap Extracts done"
-   ./docker/run-experiment 20 960 > "prac/data/log_20_8_heap_itr_$itr"
-   echo "8 Heap Extracts done"
-   ./docker/run-experiment 20 1920 > "prac/data/log_20_16_heap_itr_$itr"
-   echo "16 Heap Extracts done"
-   ./docker/run-experiment 20 3840 > "prac/data/log_20_32_heap_itr_$itr"
-   echo "32 Heap Extracts done"
+    now=`date`; echo "$now: Running 4 Heap Extracts ..."
+    ./docker/run-experiment 20 480 >> "prac/data/log_20_4_heap.out"
+    now=`date`; echo "$now: Running 8 Heap Extracts ..."
+    ./docker/run-experiment 20 960 >> "prac/data/log_20_8_heap.out"
+    now=`date`; echo "$now: Running 16 Heap Extracts ..."
+    ./docker/run-experiment 20 1920 >> "prac/data/log_20_16_heap.out"
+    now=`date`; echo "$now: Running 32 Heap Extracts ..."
+    ./docker/run-experiment 20 3840 >> "prac/data/log_20_32_heap.out"
 done 

+ 151 - 0
prac/repro

@@ -0,0 +1,151 @@
+#!/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 5
+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=5
+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" = "all" ]; then
+    echo "Running experiments..."
+    # Figure 7(a)
+    ./generate_raw_data_bs_const_db.sh ${numiters}
+    # Figures 7(b) and 7(c)
+    ./generate_raw_data_bs.sh ${numiters}
+    # 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 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 (480|960|1920|3840) .* s$' data/oram.dat | sort -k4 -n
+echo
+egrep 'CircuitORAMTotl read 20 (480|960|1920|3840) .* s$' data/oram.dat | sort -k4 -n
+echo
+echo "# Figure 8(b)"
+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
+echo
+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
+echo
+echo "# Figure 8(c)"
+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
+echo
+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
+echo
+echo "# End figures"
+
+fi