-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·65 lines (47 loc) · 1.41 KB
/
start.sh
File metadata and controls
executable file
·65 lines (47 loc) · 1.41 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
#!/bin/bash
# start.sh:
# Starts the main program using given settings
#
# Clean Last Usage
# Removing Client Logs
rm client_log_?.log
# Removing Hostfile
rm hostfile
RED="\033[1;31m"
GREEN="\033[1;32m"
NOCOLOR="\033[0m"
BOLD="\033[1m"
echo -e "#$BOLD$GREEN Pyraft $NOCOLOR\n"
echo -e "## Authors\n\n* Victor Guichard\n* Guillaume Valente\n"
# Asking for settings
echo -e "### Settings:\n"
echo -ne "Number of$BOLD$RED Clients$NOCOLOR (default 2): "
read clientNumber
echo -n "Client mean log size (default 5): "
read logSize
echo -ne "Number of$BOLD$RED Servers$NOCOLOR (default 3): "
read serverNumber
# Generating client logs
echo -ne "\n--> Generating client logs... "
if [ -z "$clientNumber" ]; then
clientNumber="2"
fi
if [ -z "$serverNumber" ]; then
serverNumber="3"
fi
if [ -z "$logSize" ]; then
python3 client_datagen.py --nb_client $clientNumber
else
python3 client_datagen.py --nb_client $clientNumber --mean_log_size $logSize
fi
echo "Done. <--"
# Generating MPI hostfile
totalProcess=$(( clientNumber + serverNumber + 1 )) # +1 For REPL
echo -n "--> Generating Hostfile... "
echo -n "localhost slots=$totalProcess" > hostfile
echo "Done. <--"
echo "--> Starting Raft <--"
echo "To stop the program: CTRL+C or STOP then EXIT"
# Start MPI processes
echo "mpirun -n $totalProcess -hostfile hostfile python3 main.py $clientNumber"
mpirun -n $totalProcess -hostfile hostfile python3 main.py $clientNumber