123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- #!/bin/bash
- # Get the IP addresses
- p0addr=$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' duoram_p0)
- p1addr=$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' duoram_p1)
- p2addr=$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' duoram_p2)
- # The Duoram parameters
- #
- # mode is read, write, or readwrite
- mode=read
- # size is log_2 of the number of elements of the ORAM
- size=20
- # iters is the number of operations to do
- iters=128
- # phase is preproc or online
- phase=online
- # duoramtype is 3P or 2P (3-party or 2-party)
- duoramtype=3P
- # ramgb is the maximum amount of RAM to use in GB
- # (do not set it below 16)
- ramgb=16
- if [ "$1" != "" ]; then
- mode="$1"
- fi
- if [ "$2" != "" ]; then
- size="$2"
- fi
- if [ "$3" != "" ]; then
- iters="$3"
- fi
- if [ "$4" != "" ]; then
- phase="$4"
- fi
- if [ "$5" != "" ]; then
- duoramtype="$5"
- fi
- if [ "$6" != "" ]; then
- ramgb="$6"
- fi
- if [ "$duoramtype" = "3P" -a "$phase" = "preproc" ]; then
- numdpfs=$iters
- if [ "$mode" = "read" -o "$mode" = "write" ]; then
- numdpfs=$((3*iters))
- fi
- if [ "$mode" = "readwrite" ]; then
- numdpfs=$((6*iters))
- fi
- fi
- echo ===== Running duoram $mode $size $iters $phase $duoramtype $ramgb
- date "+===== Start %s %F %T"
- if [ "$4" = "online" -a "$5" = "3P" ]; then
- # Run, saving the output
- savefilep0=$$.p0.out
- savefilep1=$$.p1.out
- savefilep2=$$.p2.out
- docker exec -w /root/duoram/duoram-online duoram_p2 bash -c "$DUORAM_NUMA_P2 stdbuf -o 0 ./p2 $p0addr $p1addr $size $iters 0 $iters 1 > $savefilep2 2>&1" &
- sleep 4
- docker exec -w /root/duoram/duoram-online duoram_p1 bash -c "$DUORAM_NUMA_P1 stdbuf -o 0 ./duoram1 $p0addr $p2addr $size $iters 0 $iters 1 > $savefilep1 2>&1" &
- sleep 2
- docker exec -w /root/duoram/duoram-online duoram_p0 bash -c "$DUORAM_NUMA_P0 stdbuf -o 0 ./duoram0 $p1addr $p2addr $size $iters 0 $iters 1 > $savefilep0 2>&1" &
- wait
- echo ===== P0 output
- docker exec -w /root/duoram/duoram-online duoram_p0 cat $savefilep0
- docker exec -w /root/duoram/duoram-online duoram_p0 rm -f $savefilep0
- echo ===== P1 output
- docker exec -w /root/duoram/duoram-online duoram_p1 cat $savefilep1
- docker exec -w /root/duoram/duoram-online duoram_p1 rm -f $savefilep1
- echo ===== P2 output
- docker exec -w /root/duoram/duoram-online duoram_p2 cat $savefilep2
- docker exec -w /root/duoram/duoram-online duoram_p2 rm -f $savefilep2
- date "+===== End %s %F %T"
- fi
- if [ "$4" = "preproc" -a "$5" = "3P" ]; then
- # Run, saving the output
- savefilep0=$$.p0.out
- savefilep1=$$.p1.out
- savefilep2=$$.p2.out
- docker exec -w /root/duoram/duoram-online/preprocflags duoram_p0 bash -c "rm -f *" &
- docker exec -w /root/duoram/duoram-online/preprocflags duoram_p1 bash -c "rm -f *" &
- docker exec -w /root/duoram/duoram-online/preprocflags duoram_p2 bash -c "rm -f *" &
- wait
- docker exec -w /root/duoram/preprocessing duoram_p2 bash -c "$DUORAM_NUMA_P2 stdbuf -o 0 ./p2preprocessing $p0addr $p1addr $numdpfs $size $ramgb > $savefilep2 2>&1" &
- sleep 4
- docker exec -w /root/duoram/preprocessing duoram_p1 bash -c "$DUORAM_NUMA_P1 stdbuf -o 0 ./preprocessing1 $p0addr $p2addr $numdpfs $size $ramgb > $savefilep1 2>&1" &
- sleep 2
- docker exec -w /root/duoram/preprocessing duoram_p0 bash -c "$DUORAM_NUMA_P0 stdbuf -o 0 ./preprocessing0 $p1addr $p2addr $numdpfs $size $ramgb > $savefilep0 2>&1" &
- wait
- echo ===== P0 output
- docker exec -w /root/duoram/preprocessing duoram_p0 cat $savefilep0
- docker exec -w /root/duoram/preprocessing duoram_p0 rm -f $savefilep0
- echo ===== P1 output
- docker exec -w /root/duoram/preprocessing duoram_p1 cat $savefilep1
- docker exec -w /root/duoram/preprocessing duoram_p1 rm -f $savefilep1
- echo ===== P2 output
- docker exec -w /root/duoram/preprocessing duoram_p2 cat $savefilep2
- docker exec -w /root/duoram/preprocessing duoram_p2 rm -f $savefilep2
- date "+===== End %s %F %T"
- fi
- if [ "$1" = "read" -a "$5" = "2P" ]; then
- # Run, saving the output
- savefilep0=$$.p0.out
- savefilep1=$$.p1.out
- nproc0=$(docker exec -w /root/duoram/cpir-read/cxx duoram_p0 bash -c "$DUORAM_NUMA_P0 nproc 2>/dev/null")
- nproc1=$(docker exec -w /root/duoram/cpir-read/cxx duoram_p1 bash -c "$DUORAM_NUMA_P1 nproc 2>/dev/null")
- docker exec -w /root/duoram/cpir-read/cxx duoram_p1 bash -c "$DUORAM_NUMA_P1 stdbuf -o 0 ./spir_test1 $p0addr $size $nproc1 $iters $iters > $savefilep1 2>&1" &
- echo "P1 launched"
- sleep 4
- docker exec -w /root/duoram/cpir-read/cxx duoram_p0 bash -c "$DUORAM_NUMA_P0 stdbuf -o 0 ./spir_test0 $p1addr $size $nproc0 $iters $iters > $savefilep0 2>&1" &
- echo "P0 launched"
- wait
- echo ===== P0 output
- docker exec -w /root/duoram/cpir-read/cxx duoram_p0 cat $savefilep0
- docker exec -w /root/duoram/cpir-read/cxx duoram_p0 rm -f $savefilep0
- echo ===== P1 output
- docker exec -w /root/duoram/cpir-read/cxx duoram_p1 cat $savefilep1
- docker exec -w /root/duoram/cpir-read/cxx duoram_p1 rm -f $savefilep1
- date "+===== End %s %F %T"
- fi
- if [ "$1" = "write" -a "$5" = "2P" -a "$4" = "preproc" ]; then
- # Run, saving the output
- savefilep0=$$.p0.out
- savefilep1=$$.p1.out
- docker exec -w /root/duoram/duoram-online/preprocflags duoram_p0 bash -c "rm -f *" &
- docker exec -w /root/duoram/duoram-online/preprocflags duoram_p1 bash -c "rm -f *" &
- wait
- docker exec -w /root/duoram/2p-preprocessing duoram_p1 bash -c "$DUORAM_NUMA_P1 stdbuf -o 0 ./OT $p0addr $p1addr 1 $((128*iters*size)) > $savefilep1 2>&1" &
- echo "P1 launched"
- sleep 1
- docker exec -w /root/duoram/2p-preprocessing duoram_p0 bash -c "$DUORAM_NUMA_P0 stdbuf -o 0 ./OT $p0addr $p1addr 0 $((128*iters*size)) > $savefilep0 2>&1" &
- echo "P0 launched"
- sleep 2
- wait
- docker exec -w /root/duoram/2p-preprocessing duoram_p1 bash -c "$DUORAM_NUMA_P1 stdbuf -o 0 ./preprocessing1 $p0addr $iters $size $ramgb >> $savefilep1 2>&1" &
- echo "P1 launched"
- sleep 4
- docker exec -w /root/duoram/2p-preprocessing duoram_p0 bash -c "$DUORAM_NUMA_P0 stdbuf -o 0 ./preprocessing0 $p1addr $iters $size $ramgb >> $savefilep0 2>&1" &
- echo "P0 launched"
- wait
- echo ===== P0 output
- docker exec -w /root/duoram/2p-preprocessing duoram_p0 cat $savefilep0
- docker exec -w /root/duoram/2p-preprocessing duoram_p0 rm -f $savefilep0
- echo ===== P1 output
- docker exec -w /root/duoram/2p-preprocessing duoram_p1 cat $savefilep1
- docker exec -w /root/duoram/2p-preprocessing duoram_p1 rm -f $savefilep1
- date "+===== End %s %F %T"
- fi
- if [ "$1" = "write" -a "$5" = "2P" -a "$4" = "online" ]; then
- # Run, saving the output
- savefilep0=$$.p0.out
- savefilep1=$$.p1.out
- docker exec -w /root/duoram/duoram-online duoram_p1 bash -c "$DUORAM_NUMA_P1 stdbuf -o 0 ./2Pduoram1 $p0addr $p2addr $size $iters $iters $iters 1 > $savefilep1 2>&1" &
- echo "P1 launched"
- sleep 4
- docker exec -w /root/duoram/duoram-online duoram_p0 bash -c "$DUORAM_NUMA_P0 stdbuf -o 0 ./2Pduoram0 $p1addr $p2addr $size $iters $iters $iters 1 > $savefilep0 2>&1" &
- echo "P0 launched"
- wait
- echo ===== P0 output
- docker exec -w /root/duoram/duoram-online duoram_p0 cat $savefilep0
- docker exec -w /root/duoram/duoram-online duoram_p0 rm -f $savefilep0
- echo ===== P1 output
- docker exec -w /root/duoram/duoram-online duoram_p1 cat $savefilep1
- docker exec -w /root/duoram/duoram-online duoram_p1 rm -f $savefilep1
- date "+===== End %s %F %T"
- fi
|