-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpbs_template
30 lines (25 loc) · 850 Bytes
/
pbs_template
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
#!/bin/sh
#PBS -N {task_name}
#PBS -l nodes={node}:ppn={ppn}
#PBS -l walltime={task_time}:00:00
#PBS -S /bin/bash
#PBS -q {queue_name}
#PBS -o {out}
#PBS -e {error}
timer(){{
timer_start=$*
timer_end=`date "+%Y-%m-%d %H:%M:%S"`
duration=`echo $(($(date +%s -d "${{timer_end}}") - $(date +%s -d "${{timer_start}}"))) | awk '{{t=split("60 s 60 m 24 h 999 d",a);for(n=1;n<t;n+=2){{if($1==0)break;s=$1%a[n]a[n+1]s;$1=int($1/a[n])}}print s}}'`
echo "time used "${{duration}}
}}
timer_start=`date "+%Y-%m-%d %H:%M:%S"`
start='------------START------------'${{timer_start}}'------------START------------'
echo $start
echo $start >&2
{command}
timer_end=`date "+%Y-%m-%d %H:%M:%S"`
end='-------------END-------------'${{timer_end}}'-------------END-------------'
echo $end
echo $end >&2
timer ${{timer_start}}
timer ${{timer_start}} >&2