forked from llaniewski/TCLB-Magnus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun
executable file
·85 lines (72 loc) · 1.23 KB
/
run
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
#!/bin/bash
PP=$(dirname $0)
[ -f $PP/conf.ini ] || $PP/config
[ -f $PP/conf.ini ] || exit -1
. $PP/conf.ini
if [ -z "$1" ] || [ -z "$2" ]
then
echo Usage: ./run MODEL CASE.xml [cores]
exit -1
fi
MODEL=$1
shift
CASE=$1
shift
CPUS=$1
shift
if [ -z "$CPUS" ]
then
CPUS=1
fi
echo Trying to run $CASE with $MODEL model on $CPUS cores...
if [ $CPUS -gt 24 ]
then
PPN=24
NODES=$[$CPUS/24]
else
PPN=$CPUS
NODES=1
fi
if [ $CPUS -ne $[$NODES*$PPN] ]
then
echo Requested number of CPUS \($CPUS\) is not $NODES x $PPN
exit -1
fi
if [ ! -f "$CASE" ]
then
echo No case file: $CASE
exit -1
fi
NAME=CLB:$CASE
NCPU=$CPUS
SOLVER=$TCLB/CLB/$MODEL/main
if [ ! -f "$SOLVER" ]
then
echo No such model: $MODEL
echo File not found: $SOLVER
exit -1
fi
sbatch "$@" <<EOF
#!/bin/bash -l
#SBATCH -J $NAME
#SBATCH -N $NODES
#SBATCH -n $NCPU
#SBATCH --ntasks-per-node=$PPN
#SBATCH --time=01:00:00
#SBATCH -A $GRANT
#SBATCH -p workq
cd \$SLURM_SUBMIT_DIR
echo "###### Nodes: #######"
srun /bin/hostname
echo "###### Loading modules #######"
. $PP/mods.ini
echo "###### --------------- #######"
echo ""
trap "say Errored" ERR
trap "say Terminated" TERM
trap "say Killed" KILL
set -e
say Started
srun $SOLVER $CASE
say Finished
EOF