forked from andyras/hoagie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hoagie.sh
executable file
·61 lines (50 loc) · 1.26 KB
/
hoagie.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
#!/bin/bash
#$ -S /bin/bash
#$ -cwd
#$ -V
#$ -N hoagie_hoagie
#$ -m bae -M [email protected]
#$ -o /dev/null
#$ -e /dev/null
#$ -pe ortePE 1
function onKill {
echo "DANGER!"
echo "DANGER!"
echo "Job terminated unexpectedly!"
echo "JOB END TIME: $(date +"%F %T")"
echo "JOB DURATION: $(($(date +%s) - ${startTime})) s"
cd ${SGE_CWD_PATH}
exit
}
trap onKill 2 9 15
# Print debug info about job
echo "# Job information"
echo "HOSTNAME: $(hostname)"
echo "DIRECTORY: $(pwd)"
echo "JOB START TIME: $(date +"%F %T")"
startTime=$(date +%s)
echo ""
# create scratch directory
echo "create scratch directory"
SCRATCH_JOB_DIR=${TMPDIR}/$(basename ${SGE_CWD_PATH})
cp -rf ${SGE_CWD_PATH} ${SCRATCH_JOB_DIR}
# Go to SGE working directory
echo "Going to SGE working directory: ${SCRATCH_JOB_DIR}"
cd ${SCRATCH_JOB_DIR}
# Run program
echo "Running program"
echo ""
export OMP_NUM_THREADS=1
export MKL_NUM_THREADS=1
./total_dynamix
echo ""
echo "JOB END TIME: $(date +"%F %T")"
echo "JOB DURATION: $(($(date +%s) - ${startTime})) s"
cd ${OWD}
# copy job dir contents back to where they started
echo "copying from scratch to original directory"
cp -rf ${SCRATCH_JOB_DIR}/* ${SGE_CWD_PATH}/
cd $SGE_CWD_PATH
# deleting run script
echo "deleting run script"
rm -f /home/tap620/git/hoagie/hoagie.sh