-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslurm_submit
executable file
·102 lines (92 loc) · 1.62 KB
/
slurm_submit
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
94
95
96
97
98
99
100
101
102
#!/bin/bash
# default instance parameters
seed=$RANDOM
instance=""
# default job parameters
out=""
err="/dev/null"
time="1:00:00"
cpus="16"
memory="32GB"
args=""
while [[ $# > 0 ]]
do
key="$1"
case $key in
-f|--file)
shift
instance="$1"
shift
;;
-s|--seed)
shift
seed="$1"
shift
;;
--output)
shift
out="$1"
shift
;;
--error)
shift
err="$1"
shift
;;
--time)
shift
time="$1"
shift
;;
--cpus)
shift
cpus="$1"
shift
;;
--memory)
shift
memory="$1"
shift
;;
*)
args="$args$key "
shift
;;
esac
done
if [ -z "$instance" ]
then
echo "Required instance option (-f) missing!"
exit 1
fi
if [ ! -f "$instance" ]
then
echo "$instance does not exists!"
exit 1
fi
if [ -z "$out" ]
then
out=${instance##*/}-$seed.out
fi
if hash sbatch 2>/dev/null
then
tmpfile=$(mktemp)
sbatch 1> $tmpfile <<EOF
#!/bin/bash
#SBATCH --job-name=fabe-${instance##*/}-$seed
#SBATCH --time=$time
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=$cpus
#SBATCH --mem=$memory
#SBATCH --output=$out
#SBATCH --error=$err
#SBATCH --mail-type=begin
#SBATCH --mail-type=end
#SBATCH --mail-type=fail
#SBATCH --mail-user=email@domain
echo srun $HOME/fabe/fabe -f $instance -s $seed $args
srun $HOME/fabe/fabe -f $instance -s $seed $args
EOF
else
echo "Unknown cluster"
fi