-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.sh
executable file
·93 lines (85 loc) · 2.53 KB
/
config.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
PROJ_DIR='spn_asi'
set -o noglob
case `hostname` in
"stink") echo "Running on `hostname`."
DATA_PATH='/home/aaron/mnt/fist/data/'$PROJ_DIR
SET_PATH='/home/aaron/mnt/aaron_root/mnt/hdd1/set/timit_wav/timit'
NOISY_SPEECH_PATH='/home/aaron/mnt/aaron/set/spn_asi_20/noisy_speech'
XI_HAT_PATH='/home/aaron/mnt/aaron/set/spn_asi_20/xi_hat_deep_xi_3e_e150'
MODEL_PATH='/home/aaron/mnt/fist/model/'$PROJ_DIR
;;
"pinky-jnr") echo "Running on `hostname`."
DATA_PATH='/home/aaron/mnt/fist/data/'$PROJ_DIR
SET_PATH='/home/aaron/mnt/aaron_root/mnt/hdd1/set/timit_wav/timit'
NOISY_SPEECH_PATH='/home/aaron/mnt/aaron/set/spn_asi_20/noisy_speech'
XI_HAT_PATH='/home/aaron/mnt/aaron/set/spn_asi_20/xi_hat_deep_xi_3e_e150'
MODEL_PATH='/home/aaron/mnt/fist/model/'$PROJ_DIR
;;
"kuldip") echo "Running on `hostname`."
DATA_PATH='/home/aaron/mnt/fist/data/'$PROJ_DIR
SET_PATH='/home/aaron/mnt/aaron_root/mnt/hdd1/set/timit_wav/timit'
NOISY_SPEECH_PATH='/home/aaron/mnt/aaron/set/spn_asi_20/noisy_speech'
XI_HAT_PATH='/home/aaron/mnt/aaron/set/spn_asi_20/xi_hat_deep_xi_3e_e150'
MODEL_PATH='/home/aaron/mnt/fist/model/'$PROJ_DIR
;;
*) echo "`hostname` is not a known workstation. Using default paths."
DATA_PATH='data'
SET_PATH='timit'
NOISY_SPEECH_PATH='spn_asi_20/noisy_speech'
XI_HAT_PATH='spn_asi_20/xi_hat_deep_xi_3e_e150'
MODEL_PATH='model'
;;
esac
get_free_gpu () {
if ! command -v nvidia-smi &> /dev/null
then
echo "No CUDA devices available, using CPU."
return 9999
else
NUM_GPU=$( nvidia-smi --query-gpu=pci.bus_id --format=csv,noheader | wc -l )
echo "$NUM_GPU total GPU/s."
if [ $1 -eq 1 ]
then
echo 'Sleeping'
sleep 1m
fi
while true
do
for (( gpu=0; gpu<$NUM_GPU; gpu++ ))
do
VAR1=$( nvidia-smi -i $gpu --query-gpu=pci.bus_id --format=csv,noheader )
VAR2=$( nvidia-smi -i $gpu --query-compute-apps=gpu_bus_id --format=csv,noheader | head -n 1)
if [ "$VAR1" != "$VAR2" ]
then
return $gpu
fi
done
echo 'Waiting for free GPU.'
sleep 1m
done
fi
}
TRAIN=0
IDENTIFICATION=0
MARG=0
BOUNDS=0
for ARGUMENT in "$@"
do
KEY=$(echo $ARGUMENT | cut -f1 -d=)
VALUE=$(echo $ARGUMENT | cut -f2 -d=)
case "$KEY" in
GPU) GPU=${VALUE} ;;
TRAIN) TRAIN=${VALUE} ;;
IDENTIFICATION) IDENTIFICATION=${VALUE} ;;
MARG) MARG=${VALUE} ;;
BOUNDS) BOUNDS=${VALUE} ;;
*)
esac
done
WAIT=0
if [ -z $GPU ]
then
get_free_gpu $WAIT
GPU=$?
fi