-
Notifications
You must be signed in to change notification settings - Fork 3
/
submit
executable file
·71 lines (60 loc) · 1.4 KB
/
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
#!/bin/sh
## Default parameters
MAX_DURATION="${MAX_DURATION:-20:00}"
MAX_MEMORY="${MAX_MEMORY:-16GB}"
OMP_NUM_THREADS="${OMP_NUM_THREADS:-1}"
MC_CORES="${MC_CORES:-1}"
## Additional parameters
QWAIT="${QWAIT:-0}"
## NOTIFICATION="${NOTIFICATION:-a}"
QUEUE="${QUEUE:-hpc}"
# Message
echo "Job parameters"
echo "=============="
echo
echo "MAX_DURATION = $MAX_DURATION (hh:mm)"
echo "MAX_MEMORY = $MAX_MEMORY"
echo "OMP_NUM_THREADS = $OMP_NUM_THREADS"
echo "MC_CORES = $MC_CORES"
echo
JOB_INFO=`
echo "
### -- embedded options to bsub - start with #BSUB
#BSUB -J Job
#BSUB -W $MAX_DURATION
### -- specify memory per core/slot (FIXME?)
#BSUB -R "rusage[mem=$MAX_MEMORY]"
#BSUB -n $(( $OMP_NUM_THREADS * $MC_CORES ))
#BSUB -R "span[hosts=1]"
### -- Deprecated #PBS -m $NOTIFICATION
#BSUB -q $QUEUE
### -- run in the current working (submission) directory --
### -- cd $PBS_O_WORKDIR <--- didn't work !
cd $PWD
## Reduce time spent in gc
export R_GC_MEM_GROW=3
# here follow the commands you want to execute
export OMP_NUM_THREADS=$OMP_NUM_THREADS
export MC_CORES=$MC_CORES
export QUEUE=$QUEUE
cat /proc/cpuinfo
env
$*
" | bsub
`
## echo $JOB_INFO
JOBID=`echo $JOB_INFO | sed 's/Job..//g' | sed 's/>.*//g'`
## echo $JOBID
if [ $QWAIT == 1 ]
then
echo "Waiting for $JOBID"
while true
do
if ! `bstat | grep -q $JOBID`
then
echo "completed $JOBID"
exit 0
fi
sleep 1
done
fi