-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcommon.sh
More file actions
89 lines (68 loc) · 1.79 KB
/
Copy pathcommon.sh
File metadata and controls
89 lines (68 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
if test -z "$1" -o -z "$2" -o -z "$3" -o -z "$4" -o -z "$5"; then
echo "Usage: $0 <model> <image> <protocol> <truncation> <n_threads>"
exit 1
fi
model=$1
image=$2
protocol=$3
trunc=$4
n_threads=$5
shift 5
args="conv2ds cisc$*"
out_dir=MP-SPDZ/Player-Data
test -e $out_dir || mkdir $out_dir
wget -nc -q https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_${model}_quant.tgz
tar --no-same-owner -xzf mobilenet_${model}_quant.tgz
source venv/bin/activate
./model.py --model_out $out_dir/Input-P0-0 mobilenet_${model}_quant.tflite
./image_to_numbers.py mobilenet_${model}_quant.tflite $image $out_dir/Input-P1-0 2> /dev/null
cd MP-SPDZ
case $protocol in
0) protocol=semi2k ;;
1) protocol=hemi ;;
2) protocol=ring ;;
3) protocol=rep-field ;;
4) protocol=spdz2k ;;
5) protocol=cowgear ;;
6) protocol=ps-rep-ring ;;
7) protocol=ps-rep-field ;;
esac
if [[ $protocol =~ ring || $protocol =~ 2k ]]; then
opt='-R 72'
run_opt="$opt"
fi
if [[ $protocol = spdz2k ]]; then
run_opt='-R 72 -S 48'
fi
if [[ $protocol = cowgear ]]; then
run_opt='-l 40'
fi
if [[ $trunc = prob ]]; then
trunc=0
elif [[ $trunc = exact ]]; then
trunc=2
else
echo Invalid argument for truncation, must be 'exact' or 'prob'
exit 1
fi
if [[ $protocol =~ ring ]]; then
args="$args split"
if [[ $trunc = 0 ]]; then
trunc=1
fi
fi
python ./compile.py -D $opt benchmark_mobilenet $model $trunc $n_threads $args | grep -v WARNING
touch ~/.rnd
Scripts/setup-ssl.sh
for i in $(seq 0 $[N-1]); do
echo $i
echo "${hosts[$i]}"
done
opts=${args// /-}
test $opts && opts=-$opts
prog=benchmark_mobilenet-$model-$trunc-$n_threads$opts
bin=$protocol-party.x
if [[ $protocol = ring ]]; then
bin=replicated-ring-party.x
fi