#!/bin/csh # Request maximum wallclock time for job #PBS -l walltime=01:00:00 # select=,ncpus=,mpiprocs= # Total cores requested = X #PBS -l select=1:ncpus=4:mpiprocs=1 # Specify how MPI processes are distributed on nodes #PBS -l place=scatter # Request job name #PBS -N linux_matlab # Request PBS job queue for job #PBS -q staff # Specify keep stdout/stderr files from job #PBS -k eo # Indicate required ABAQUS licenses ###PBS -l matlab=1 # Indicate Project ID #PBS -A ARLAP96090RAY # Request environment variables be exported from script #PBS -V # # ## End of preamble, beginning of shell script ## set JOBID=`echo $PBS_JOBID | cut -f1 -d.` echo job $JOBID starting at `date` on `hostname` cd ${HOME}/pbstest/MATLAB echo starting in `pwd` set outfile=output.txt set outdir=$HOME/pbstest/MATLAB/outdir set TMPD=/usr/var/tmp/$LOGNAME/$JOBID if (! -e $TMPD ) mkdir -p $TMPD set copy_to_archive=NO if ($copy_to_archive == "YES") then if (! -e $outdir ) mkdir -p $outdir endif set indir=`pwd` #set infile=input.m set infile=test.m cp ${indir}/${infile} $TMPD cd $TMPD ls -l module load matlab7.9.0 echo matlab $infile >& $outfile matlab -nodisplay -nojvm -nodesktop < $infile >& $outfile set st=$status echo execution ended at `date` with status $st if ($copy_to_archive == "YES") then echo "...copying output tar file to archive" ls -l tar cf ../output.tar.i$LSB_JOBID * set st=\$status if ( \$st != 0 ) then echo Tar of files failed, look in $TMPD for output files! #exit \$st endif mv ../output.tar.${LSB_JOBID} $outdir cd $outdir tar xf output.tar.${LSB_JOBID} set st=\$status if ( \$st != 0 ) then echo Tar of files failed, look in $TMPD for output files! #exit \$st endif echo output file mv for job $LSB_JOBID ended at `date` with status \$st if ( \$st == 0 ) then echo files copied back to $outdir successfully, will rmdir $TMPD rm -r $TMPD endif cd .. chmod -R 755 $outdir exit \$st endif