-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcommon.sh
93 lines (74 loc) · 1.97 KB
/
common.sh
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
90
91
92
93
#!/bin/bash
if test -z "$6"; then
echo "Usage: $0 <protocol> <net> <rounding> <n_threads> <n_epochs> <precision> [<further...>]"
exit 1
fi
protocol=$1
net=$2
round=$3
n_threads=$4
n_epochs=$5
f=$6
shift 6
cd MP-SPDZ
test -e logs || mkdir logs
case $protocol in
sh2) protocol=hemi; PLAYERS=2; run_opt="-b 100 $run_opt" ;;
sh3) protocol=ring; PLAYERS=3 ;;
dm3) protocol=temi; PLAYERS=3; run_opt="-b 100 -lgp 111 -N 3 $run_opt" ;;
mal3) protocol=sy-rep-ring; PLAYERS=3 ;;
mal4) protocol=rep4-ring; PLAYERS=4 ;;
sh10) protocol=atlas; PLAYERS=10 run_opt="-N 10 $run_opt" ;;
dm10) protocol=temi; PLAYERS=10; run_opt="-b 100 -lgp 111 -N 10 $run_opt" ;;
emul) protocol=emulate; compile_args="-K ''" ;;
esac
export PLAYERS
args="$*"
if [[ $net = D ]]; then
args="2dense $args"
fi
if [[ $protocol =~ ring || $protocol == emulate ]]; then
ring=1
compile_args="-R 64 $compile_args"
if [[ $protocol == rep4-ring ]]; then
args="split4 $args"
elif [[ $protocol != emulate ]]; then
args="split3 $args"
fi
else
ring=0
args="edabit $args"
fi
k=$[2 * f - 1]
args="f$f k$k $args"
if [[ $round = near ]]; then
args="nearest $args"
elif [[ $protocol != sy-rep-ring && $round = prob &&
($ring = 1 || $protocol = hemi) ]]; then
args="trunc_pr $args"
fi
if [[ $net = alex ]]; then
args="falcon_alex $n_epochs 128 $n_threads $args"
run_opt="-IF /tmp/cifar10-Input $run_opt"
elif [[ $net = new_alex ]]; then
args="alex $n_epochs 128 $n_threads $args"
run_opt="-IF /tmp/cifar10-Input $run_opt"
else
args="mnist_full_$net $n_epochs 128 $n_threads $args"
fi
python3 ./compile.py $compile_args -b 100000 -CD $args | grep -v WARNING
touch ~/.rnd
Scripts/setup-ssl.sh 10
N=$PLAYERS
for i in $(seq 0 $[N-1]); do
echo $i
echo "${hosts[$i]}"
done
args=${args% }
prog=${args// /-}
bin=$protocol-party.x
if [[ $protocol = ring ]]; then
bin=replicated-ring-party.x
elif [[ $protocol = emulate ]]; then
bin=emulate.x
fi