forked from bristolcrypto/SPDZ-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-common.sh
41 lines (34 loc) · 1.05 KB
/
run-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
# (C) 2017 University of Bristol. See License.txt
run_player() {
port=$((RANDOM%10000+10000))
bin=$1
shift
if ! test -e $SPDZROOT/logs; then
mkdir $SPDZROOT/logs
fi
if test $bin = Player-Online.x; then
params="$* -pn $port -h localhost"
else
params="$port localhost $*"
fi
if test $bin = Player-KeyGen.x -a ! -e Player-Data/Params-Data; then
./Setup.x $players $size 40
fi
>&2 echo Running $SPDZROOT/Server.x $players $port
$SPDZROOT/Server.x $players $port &
rem=$(($players - 2))
for i in $(seq 0 $rem); do
echo "trying with player $i"
>&2 echo Running $prefix $SPDZROOT/$bin $i $params
$prefix $SPDZROOT/$bin $i $params 2>&1 | tee $SPDZROOT/logs/$i &
done
last_player=$(($players - 1))
>&2 echo Running $prefix $SPDZROOT/$bin $last_player $params
$prefix $SPDZROOT/$bin $last_player $params > $SPDZROOT/logs/$last_player 2>&1 || return 1
}
killall Player-Online.x Server.x
sleep 0.5
#mkdir /dev/shm/Player-Data
players=${PLAYERS:-2}
#. Scripts/setup.sh
mkdir logs