-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_multiple.sh
57 lines (50 loc) · 2.15 KB
/
start_multiple.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
#!/bin/bash
trap "kill 0" EXIT
help()
{
printf "Usage: start_multiple [ -b | --batch_size ] [ -e | --epochs ] [ -l | --learning_rate]"
exit 2
}
while [[ "$#" -gt 0 ]];
do
case "$1" in
-b | --batch_size )
BATCH_SIZE="$2"
shift
;;
-l | --learning_rate )
LEARNING_RATE="$2"
shift
;;
-e | --epochs )
EPOCHS="$2"
shift
;;
-* | --* )
shift
break
;;
* )
printf "Unexpected argument: $1"
help
;;
esac
shift
done
{
LOADED_GPUS="$(ls /proc/driver/nvidia/gpus/ | wc -l)";
} || {
LOADED_GPUS=0;
}
if [[ "$LOADED_GPUS" -eq 0 ]]; then
DEVICE=-1
fi
printf "\n##########################################################"
printf "\n## Found $LOADED_GPUS GPU(s) on this machine"
printf "\n## Batch size: $BATCH_SIZE | Learning rate: $LEARNING_RATE | Epochs: $EPOCHS"
printf "\n##########################################################\n"
python main.py --model_type vgg11 --batch_size "$BATCH_SIZE" --learning_rate "$LEARNING_RATE" --epochs "$EPOCHS" --gpu 0 && python main.py --model_type vgg11 --batch_size "$BATCH_SIZE" --learning_rate "$LEARNING_RATE" --epochs "$EPOCHS" --gpu 0 --depthwise && python main.py --model_type resnet34 --batch_size "$BATCH_SIZE" --learning_rate "$LEARNING_RATE" --epochs "$EPOCHS" --gpu 0 &
python main.py --model_type vgg13 --batch_size "$BATCH_SIZE" --learning_rate "$LEARNING_RATE" --epochs "$EPOCHS" --gpu 1 && python main.py --model_type vgg13 --batch_size "$BATCH_SIZE" --learning_rate "$LEARNING_RATE" --epochs "$EPOCHS" --gpu 1 --depthwise && python main.py --model_type resnet34 --batch_size "$BATCH_SIZE" --learning_rate "$LEARNING_RATE" --epochs "$EPOCHS" --gpu 1 --depthwise &
python main.py --model_type vgg16 --batch_size "$BATCH_SIZE" --learning_rate "$LEARNING_RATE" --epochs "$EPOCHS" --gpu 2 && python main.py --model_type vgg16 --batch_size "$BATCH_SIZE" --learning_rate "$LEARNING_RATE" --epochs "$EPOCHS" --gpu 2 --depthwise &
python main.py --model_type vgg19 --batch_size "$BATCH_SIZE" --learning_rate "$LEARNING_RATE" --epochs "$EPOCHS" --gpu 3 && python main.py --model_type vgg19 --batch_size "$BATCH_SIZE" --learning_rate "$LEARNING_RATE" --epochs "$EPOCHS" --gpu 3 --depthwise &
wait