-
Notifications
You must be signed in to change notification settings - Fork 165
/
run_secure.sh
executable file
·48 lines (40 loc) · 1.32 KB
/
run_secure.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
#!/usr/bin/env bash
# add current folder to PYTHONPATH
export PYTHONPATH="${PWD}"
echo "PYTHONPATH is ${PYTHONPATH}"
algorithms_dir="${PWD}/configs"
servername="localhost"
workspace="workspaces/secure_workspace"
admin_username="admin@nvidia.com"
site_pre="site-"
n_clients=$1
config=$2
run=$3
alpha=$4
if test -z "${n_clients}" || test -z "${config}" || test -z "${run}" || test -z "${alpha}"
then
echo "Usage: ./run_secure.sh [n_clients] [config] [run] [alpha], e.g. ./run_secure.sh 8 cifar10_fedavg 1 0.1"
exit 1
fi
# start server
echo "STARTING SERVER"
export CUDA_VISIBLE_DEVICES=0
./${workspace}/${servername}/startup/start.sh &
sleep 10
# start clients
echo "STARTING ${n_clients} CLIENTS"
for id in $(eval echo "{1..$n_clients}")
do
export CUDA_VISIBLE_DEVICES=0
./${workspace}/"${site_pre}${id}"/startup/start.sh &
done
sleep 10
# download and split data
echo "PREPARING DATA"
python3 ./pt/utils/prepare_data.py --data_dir="/tmp/cifar10_data" --num_sites="${n_clients}" --alpha="${alpha}"
# start training
echo "STARTING TRAINING"
python3 ./run_fl.py --port=8003 --admin_dir="./${workspace}/${admin_username}" \
--username="${admin_username}" --run_number="${run}" --app="${algorithms_dir}/${config}" --min_clients="${n_clients}"
# sleep for FL system to shut down, so a new run can be started automatically
sleep 30