Newer
Older
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
#!/bin/ksh
############################## standard interface to /sw tools
# Input:
# Environment variables
# SW_BLDDIR current directory (PWD) minus /autofs/na1_ stuff
# SW_ENVFILE file to be sourced which has alternate prog environment
# only to be used in special circumstances
# SW_WORKDIR work dir that local script can use
# Output:
# Return code of 0=success or 1=failure or 2=job submitted
#
# Notes:
# If this script is called from swtest, then swtest requires
# SW_WORKDIR to be set. Then swtest adds a unique path to what
# user gave swtest (action+timestamp+build) and provides this
# script with a uniquely valued SW_WORKDIR. swtest will
# automatically remove this unique workspace when retest is done.
##################################################################
if [ -z $SW_BLDDIR ]; then
echo "Error: SW_BLDDIR not set!"
exit 1
else
cd $SW_BLDDIR
fi
if [ -z $SW_ENVFILE ]; then
### Set Environment (do not remove this line only change what is in between)
. ${MODULESHOME}/init/ksh
. ${SW_BLDDIR}/remodule
### End Environment (do not remove this line only change what is in between)
else
. $SW_ENVFILE
fi
############################## app specific section
#
set -o verbose
#clear out status file
rm -f status
cp /sw/testcases/nwchem/* $SW_WORKDIR/
cp -a $SW_BLDDIR/data $SW_WORKDIR/
cp -a $SW_BLDDIR/etc $SW_WORKDIR/
cd $SW_WORKDIR
cat > ${PACKAGE}.pbs << EOF
#!/bin/bash
#PBS -N ${PACKAGE}
#PBS -j oe
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
103
104
105
cd \$PBS_O_WORKDIR
export PATH=${SW_BLDDIR}/bin:\${PATH}
export NWCHEM_EXECUTABLE=${SW_BLDDIR}/bin/nwchem
export NWCHEM_TOP=${NWCHEM_TOP}
export NWCHEM_TARGET=LINUX64
export MPIRUN_PATH=\`which aprun\`
export MPIRUN_NPOPT=-n
export NWCHEM_NWPW_LIBRARY=${SW_WORKDIR}/data/libraryps/
export NWCHEM_BASIS_LIBRARY=${SW_WORKDIR}/data/libraries/
export HOME_NWCHEMRC=${SW_WORKDIR}/etc
aprun -n 256 nwchem Input_c240_pbe0.nw 2>&1 > nwchem.log
if [[ "\$?" -eq 0 ]]; then
echo verified > $SW_BLDDIR/status
else
echo unverified > $SW_BLDDIR/status
fi
chmod 664 $SW_BLDDIR/status
tail -n 2 nwchem.log | grep wall | awk '{print "YVALUE=",\$6}' \
| sed 's/ //g' | sed 's/s//g' > ${SW_BLDDIR}/wallclock
grep "Max memory" nwchem.log | awk '{print "YVALUE=",\$9}' \
| sed 's/ //g' > ${SW_BLDDIR}/memory
JOBID=\`echo \$PBS_JOBID | cut -d "." -f1 \`
cat nwchem.log >> ${SW_BLDDIR}/test.log
cat \$PBS_JOBNAME.o\$JOBID >> ${SW_BLDDIR}/test.log
chmod 664 ${SW_BLDDIR}/test.log
rm -f ${SW_BLDDIR}/.running
EOF
qsub ${PACKAGE}.pbs > ${SW_BLDDIR}/.running
if [ $? -ne 0 ] ; then
echo "Error submitting job"
rm -f .running
exit 1
else
echo "Job submitted"
cat ${SW_BLDDIR}/.running
exit 2
fi
################################ if this far, return 0
exit 0