Useful PBS scripts: Difference between revisions
Jump to navigation
Jump to search
import>Mm695 No edit summary |
import>Mm695 No edit summary |
||
| Line 53: | Line 53: | ||
# PBS -q s32 |
# PBS -q s32 |
||
# PBS -l walltime=18:00:00 |
# PBS -l walltime=18:00:00 |
||
# PBS -l nodes=8:ppn=4 |
# PBS -l nodes=8:ppn=4 |
||
HERE=/home/mm695/whatever |
HERE=/home/mm695/whatever |
||
file=dho2498_singlePoint |
file=dho2498_singlePoint |
||
inpfile=${file}.inp |
inpfile=${file}.inp |
||
outfile=${file}.out |
outfile=${file}.out |
||
SCRATCH=/scratch/mm695/$file |
SCRATCH=/scratch/mm695/$file |
||
nodes=`cat $PBS_NODEFILE | uniq` |
nodes=`cat $PBS_NODEFILE | uniq` |
||
for node in $nodes |
for node in $nodes |
||
do |
do |
||
| Line 80: | Line 72: | ||
rsh $node "cp ${HERE}/${inpfile} $SCRATCH" |
rsh $node "cp ${HERE}/${inpfile} $SCRATCH" |
||
done |
done |
||
exe=/home/mm695/SOURCE/cpmd.x |
exe=/home/mm695/SOURCE/cpmd.x |
||
pp=/home/mm695/pseudopot |
pp=/home/mm695/pseudopot |
||
cd $SCRATCH |
cd $SCRATCH |
||
# Write out some helpful info to the output file |
# Write out some helpful info to the output file |
||
echo "Starting job $PBS_JOBID" |
echo "Starting job $PBS_JOBID" |
||
echo |
echo |
||
| Line 94: | Line 82: | ||
cat $PBS_NODEFILE |
cat $PBS_NODEFILE |
||
echo |
echo |
||
mvapichwrapper $exe $inpfile $pp > ${HERE}/${outfile} |
mvapichwrapper $exe $inpfile $pp > ${HERE}/${outfile} |
||
for node in $nodes |
for node in $nodes |
||
do |
do |
||
| Line 103: | Line 91: | ||
rsh $node 'rmdir /scratch/mm695/$file' |
rsh $node 'rmdir /scratch/mm695/$file' |
||
done |
done |
||
qstat -f $PBS_JOBID |
qstat -f $PBS_JOBID |
||
Revision as of 17:42, 12 March 2008
If you have put some effort into writing a PBS job script for a particular type of job, please consider adding it here.
Job script with signal handler
# This is an example PBS job script that can carry out an action to clean up
# after itself when the queueing system terminates the job. You could use it to
# make your code checkpoint or similar.
#PBS -q s4
#PBS -l walltime=2:00:00
WD=/scratch/cen1001/work
OUT=$WD/output
# A shell function to clean up after an imaginary job. Replace with whatever's
# appropriate for your job.
cleanup() {
cp $OUT /home/cen1001 && rm $OUT
}
# This function gets called when PBS tells your job to exit. PBS gives a job 60
# seconds to run its exit handler and then terminates it, so whatever this does
# must happen in less than 60 seconds.
exithandler() {
echo "Job was killed" >> $OUT
cleanup
exit
}
trap exithandler SIGTERM
# The main script starts here
mkdir -p $WD
# do some busy work that generates output
i=0
while [ $i -lt 100 ]
do
echo $i >> $OUT
sleep 2
i=$((i+1))
done
# call the cleanup function
cleanup
# get our PBS stats
qstat -f $PBS_JOBID
CPMD runscript if several nodes are needed
# PBS -q s32
# PBS -l walltime=18:00:00
# PBS -l nodes=8:ppn=4
HERE=/home/mm695/whatever
file=dho2498_singlePoint
inpfile=${file}.inp
outfile=${file}.out
SCRATCH=/scratch/mm695/$file
nodes=`cat $PBS_NODEFILE | uniq`
for node in $nodes
do
rsh $node "rm -f $SCRATCH/*"
rsh $node "rmdir $SCRATCH"
rsh $node "mkdir $SCRATCH"
rsh $node "cp ${HERE}/gromos* $SCRATCH"
rsh $node "cp ${HERE}/geom_end_of_sim.crd $SCRATCH"
rsh $node "cp ${HERE}/RESTART $SCRATCH"
rsh $node "cp ${HERE}/${inpfile} $SCRATCH"
done
exe=/home/mm695/SOURCE/cpmd.x
pp=/home/mm695/pseudopot
cd $SCRATCH
# Write out some helpful info to the output file
echo "Starting job $PBS_JOBID"
echo
echo "PBS assigned me this node:"
cat $PBS_NODEFILE
echo
mvapichwrapper $exe $inpfile $pp > ${HERE}/${outfile}
for node in $nodes
do
rsh $node 'mv ${SCRATCH}/* ${HERE}'
rsh $node 'rm -f ${SCRATCH}/*'
rsh $node 'rmdir /scratch/mm695/$file'
done
qstat -f $PBS_JOBID