3 # Check if we're running under PBS and print information useful for debugging
4 if [ -n "$PBS_ENVIRONMENT" ]; then
6 echo "This job was submitted by user: $PBS_O_LOGNAME"
7 echo "This job was submitted to host: $PBS_O_HOST"
8 echo "This job was submitted to queue: $PBS_O_QUEUE"
9 echo "PBS working directory: $PBS_O_WORKDIR"
10 echo "PBS job id: $PBS_JOBID"
11 echo "PBS job name: $PBS_JOBNAME"
12 echo "PBS environment: $PBS_ENVIRONMENT"
14 echo "This script is running on `hostname` "
18 # make sure that /usr/ucb is here, towards the beginning, to make sure
19 # that the 'ps' command in Solaris is compatible with the gnu one.
20 export PATH=/usr/ucb:/usr/local/bin:${PATH}
24 # start loop to download code
28 count=`expr $count + 1`
29 if [ $count -gt 50 ]; then
30 # not successful, and we attempted it too many times. Clean up and leave.
36 # Check that we have all executables
37 if ! WGET=`command -v wget 2>&1`; then exit 1; fi
38 if ! SVN=`command -v svn 2>&1`; then exit 1; fi
39 if ! PERL=`command -v perl 2>&1`; then exit 1; fi
40 if ! MAKE=`command -v gmake 2>&1`; then
41 if ! MAKE=`command -v make 2>&1`; then exit 1; fi
43 if ! TAR=`command -v gtar 2>&1`; then
44 if ! TAR=`command -v tar 2>&1`; then exit 1; fi
46 if ! MAIL=`command -v mhmail 2>&1`; then
47 if ! MAIL=`command -v mailx 2>&1`; then
48 if ! MAIL=`command -v sendmail 2>&1`; then
49 if ! MAIL=`command -v mutt 2>&1`; then exit 1; fi
54 # Create temp directory
57 pushd $temp_dir > /dev/null
61 MAILLIST=cmusphinx-results@lists.sourceforge.net
64 ${WGET} -q http://www.speech.cs.cmu.edu/databases/an4/an4_sphere.tar.gz
65 ${TAR} -xzf an4_sphere.tar.gz
66 /bin/rm an4_sphere.tar.gz
69 if (loopUntilSuccess ${SVN} co https://cmusphinx.svn.sourceforge.net/svnroot/cmusphinx/trunk/sphinxbase > /dev/null &&
72 ./autogen.sh CFLAGS="-O2 -Wall" --prefix=`(cd ..; pwd)`/build &&
73 ${MAKE} all install) >> $LOG 2>&1 ; then
76 if (loopUntilSuccess ${SVN} co https://cmusphinx.svn.sourceforge.net/svnroot/cmusphinx/trunk/SphinxTrain > /dev/null &&
78 ./configure CFLAGS="-O2 -Wall" --with-sphinxbase=$temp_dir/sphinxbase &&
80 ${PERL} scripts_pl/setup_tutorial.pl an4) >> $LOG 2>&1 ; then
83 if (loopUntilSuccess ${SVN} co https://cmusphinx.svn.sourceforge.net/svnroot/cmusphinx/trunk/sphinx3 > /dev/null &&
86 ./autogen.sh CFLAGS="-O2 -Wall" --prefix=`(cd ..; pwd)`/build --with-sphinxbase=$temp_dir/sphinxbase &&
87 ${MAKE} all install &&
88 ${PERL} scripts/setup_tutorial.pl an4) >> $LOG 2>&1 ; then
92 perl scripts_pl/make_feats.pl -ctl etc/an4_train.fileids >> $LOG 2>&1 &&
93 perl scripts_pl/make_feats.pl -ctl etc/an4_test.fileids >> $LOG 2>&1 &&
94 perl scripts_pl/RunAll.pl >> $LOG 2>&1 &&
95 perl scripts_pl/decode/slave.pl >> $LOG 2>&1
99 # end of if (SphinxTrain)
104 # Check whether the Word Error Rate is reasonable, hardwired for now
105 if SER=`grep 'SENTENCE ERROR' $LOG 2>&1`; then
106 SUCCESS=`echo $SER | awk '{d = $(3) - 57};{if (d < 0) d = -d};{if (d < 2) print "1"}'`;
109 # Send mail if we failed
110 if test x${SUCCESS} == x ; then
111 cat `find $temp_dir/an4/logdir/ -type f -print | tail -1` >> ${LOG}
112 $MAIL -s "Tutorial failed" ${MAILLIST} < ${LOG}
114 echo $SER | $MAIL -s "Tutorial succeded" ${MAILLIST}
117 # Remove what we created
119 /bin/rm -rf $temp_dir