-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_ucihar.sh
More file actions
72 lines (58 loc) · 2.15 KB
/
run_ucihar.sh
File metadata and controls
72 lines (58 loc) · 2.15 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
#!/bin/bash
set -e
cd ../blossom
BASE_CMD="python3 main.py"
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m'
TOTAL_EXPERIMENTS=18
CURRENT_EXPERIMENT=0
run_experiment() {
local partitioner=$1
local aggregation=$2
local acc_clients=$3
local gyro_clients=$4
local both_clients=$5
CURRENT_EXPERIMENT=$((CURRENT_EXPERIMENT + 1))
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}Experiment ${CURRENT_EXPERIMENT}/${TOTAL_EXPERIMENTS}${NC}"
echo -e "${BLUE}Partitioner: ${partitioner}${NC}"
echo -e "${BLUE}Aggregation: ${aggregation}${NC}"
echo -e "${BLUE}Clients: acc=${acc_clients}, gyro=${gyro_clients}, both=${both_clients}${NC}"
echo -e "${BLUE}========================================${NC}"
CMD="${BASE_CMD} \
dataset=ucihar \
partitioner=${partitioner} \
aggregation=${aggregation} \
experiment.clients.acc=${acc_clients} \
experiment.clients.gyro=${gyro_clients} \
experiment.clients.acc_gyro=${both_clients}"
if eval ${CMD}; then
echo -e "${GREEN}✓ Experiment ${CURRENT_EXPERIMENT}/${TOTAL_EXPERIMENTS} completed successfully${NC}"
else
echo -e "${RED}✗ Experiment ${CURRENT_EXPERIMENT}/${TOTAL_EXPERIMENTS} failed${NC}"
exit 1
fi
echo ""
}
START_TIME=$(date +%s)
echo -e "${GREEN}Starting all experiments at $(date)${NC}"
echo ""
for partitioner in iid niid; do
for aggregation in full-model private-head private-head-fusion; do
run_experiment ${partitioner} ${aggregation} 0 0 10
run_experiment ${partitioner} ${aggregation} 3 3 4
run_experiment ${partitioner} ${aggregation} 5 5 0
done
done
END_TIME=$(date +%s)
DURATION=$((END_TIME - START_TIME))
HOURS=$((DURATION / 3600))
MINUTES=$(((DURATION % 3600) / 60))
SECONDS=$((DURATION % 60))
echo -e "${GREEN}========================================${NC}"
echo -e "${GREEN}All experiments completed successfully!${NC}"
echo -e "${GREEN}Total time: ${HOURS}h ${MINUTES}m ${SECONDS}s${NC}"
echo -e "${GREEN}Finished at $(date)${NC}"
echo -e "${GREEN}========================================${NC}"