#!/bin/tcsh -f # # This script was supplied by Lisa M. Perez at the Laboratory # for Molecular Simulation at Texas A&M University and is provided # on an "as is" basis. # # http://www.chem.tamu.edu/LMS # # This script was specifically designed for use on cosmos # # Last update: February 22nd, 2006 # # .................................................................... # HELP ............................................................... # .................................................................... if ( $#argv == 0 ) goto help foreach i ( $* ) switch ($i) case -help : goto help breaksw case -h : goto help endsw end # .................................................................... # PARAMETRAGE ....................................................... # .................................................................... set m = 1gb set mg = 100000000 set t = 1:00:00 set t2 = xshort set t3 = 1 set r = 0 set n = 4 set p = g03 @ ivar=0 foreach i ( $* ) @ ivar++ switch ($i) case -m500 set m=500mb set mg=50000000 # 50000000~400mb breaksw case -m1 set m=1gb set mg=100000000 # 100000000~800mb breaksw case -m2 set m=1925mb set mg=200000000 # 225000000~1.8gb breaksw case -m3 set m=3gb set mg=350000000 # 350000000~2.8gb breaksw case -m4 set m=3850mb set mg=450000000 # 450000000~3.6gb breaksw case -m5 set m=5gb set mg=600000000 # 600000000~4.8gb breaksw case -m6 set m=6gb set mg=725000000 # 725000000~5.8gb breaksw case -m7 set m=7gb set mg=850000000 # 850000000~6.8gb breaksw case -m8 set m=7700mb set mg=937500000 # 937500000~7.5gb breaksw case -s set t=5:00:00 set t2=short set t3=5 breaksw case -n set t=24:00:00 set t2=normal set t3=24 breaksw case -l set t=96:00:00 set t2=long set t3=96 breaksw case -p8 set t=40:00:00 set t2=p8 set t3=40 breaksw case -r set r=1 breaksw case -n1 set n=1 breaksw case -n2 set n=2 breaksw case -n6 set n=6 breaksw case -n8 set n=8 breaksw endsw end # .................................................................... # PREPARATION DES DONNEES ........................................... # .................................................................... set data=$argv[$#argv] if ( ! -e {$data}.com ) then echo The input file {$data}.com does not exist exit endif if ( ( $n == 1 && $mg > 200000000 ) || ( $n == 2 && $mg > 450000000 ) ) then clear echo "" echo "You may only specify up to 2 GB per processor." echo "" exit endif if ( $t2 == "xshort" && $n == "2" && $mg > 200000000 ) then clear echo "" echo "You may only specify up to 2 GB with 2 processors in the xshort queue." echo "" exit endif if ( $t2 == "p8" && $n < 6 ) then clear echo "" echo "To submit to the p8 queue, you must use 6 or 8 processors (-n6 or -n8)." echo "" exit endif echo "#\!/bin/bash -f" > $data.job echo '#' >> $data.job #set cput=`expr $t3 * $n` #echo $t3 $n echo '#PBS -l walltime='$t',mem='$m',ncpus='$n >> $data.job #echo '#PBS -l walltime='$t', cput='$cput',mem='$m',ncpus='$n >> $data.job echo '' >> $data.job echo 'source ' $HOME'/.bashrc' >> $data.job echo '' >> $data.job echo 'g03root=/usr/local/g03/c02.scsl' >> $data.job echo 'export g03root' >> $data.job echo '. $g03root/g03/bsd/g03.profile' >> $data.job echo 'alias g03=$g03root/g03/g03' >> $data.job echo '' >> $data.job echo 'cd $TMPDIR' >> $data.job echo '' >> $data.job echo 'echo -P- '$n' > Default.Route ' >> $data.job echo 'echo -M- '$mg' >> Default.Route ' >> $data.job echo '' >> $data.job echo 'env' >> $data.job echo 'date' >> $data.job echo '' >> $data.job if ($r == 0) then echo '( ' $p ' < $PBS_O_WORKDIR/'$data.com '> $PBS_O_WORKDIR/'{$data}.log ') >&' {$data}.err >> $data.job else echo '( ' $p ' < $PBS_O_WORKDIR/'$data.com '>> $PBS_O_WORKDIR/'{$data}.log ') >&' {$data}.err >> $data.job endif echo 'cat' {$data}.err '>> $PBS_O_WORKDIR/'{$data}.log >> $data.job echo '' >> $data.job echo 'date' >> $data.job echo '' >> $data.job echo 'exit' >> $data.job echo '' clear echo Look over the contents of your job file echo '' echo '<<<< Job file' {$data}.job '>>>>>' echo '' cat {$data}.job echo '' echo '<<<< end of Job file' {$data}.job '>>>>>' echo '' echo 'Do you want to submit this job? (y or n)' set submitit=($<) if ( $submitit == y) then qsub {$data}.job echo 'Your job has been submitted to the' {$t2} 'queue with a request for' {$m} 'memory and' {$n} 'processors' else echo 'Your job was NOT submitted to the' {$t2} 'queue with a request for' {$m} 'memory and' {$n} 'processors' endif echo '' qstat -u $LOGNAME echo '' exit #..................................................................... help: clear echo " " echo " This script was specifically set up for the PBS queueing system on k2.tamu.edu " echo " " echo " Syntax : qprep [-s] [-n] [-l] [-p8] [-n[x]] [-m[y]] [-r] filename" echo "" echo " x can have the values: 1, 2, 4, 6, and 8. (ie. -n8 will request 8 processors)" echo " y can have the values: 500, or 1-8. (ie. -m500 will request 500 mb and -m4 will request 4gb of memory.)" echo " NOTE: Do not ask for more than 4gb of memory for gaussian jobs." echo "" echo " filename is the name of the input file (minus the suffix)" echo "" echo " The default program is g03" echo " The default queue is xshort" echo " The default memory is 1gb" echo " The default number of processors is 4" echo " " echo " note : do not include %nproc in your input file (filename.com). The job file " echo " automatically sets the number of processors." echo "" echo " If you wish to submit to the long queue using 4 processors and 2gb of memory, " echo " you will need to use the -l and -m2 flags" echo "" echo " example: qprep -l -m2 filename" echo "" echo " The qprep -l -m2 filename command will create filename.job and submit " echo " it to the long queue" echo "" echo " To change the number of processors use:" echo " -n1 for 1 processor" echo " -n2 for 2 processors" echo " no flag for 4 processors (It's the default)" echo " -n6 for 6 processors" echo " -n8 for 8 processors" echo "" echo " The -r flag is used to append the output to the output file 'filename.out' instead of " echo " overwriting it. The -r flag is useful when you are performing a restart calculation " echo " and do not want to overwrite the output file" echo "" echo " USEFUL commands " echo "" echo " qlimit will list all of the queue names and their limits" echo "" echo " qstat -q will allow you to determine which queues have open run slots " echo "" echo " man pbs will bring up the manual pages for pbs" echo "" echo " General step to submit a job to the queueing system on titan or k2" echo "" echo " Step 1: prepare your input file (filename.com) manually, using GaussView, Cerius, or " echo " your favorite interface" echo " Step 2: qstat -q or qlimit to determine which queue to submit to" echo " Step 3: use qprep with the appropriate flags to create the job file and have it " echo " submitted to the appropriate queue" echo "" echo " To report problems with this script, e-mail Lisa M. Perez at mouse@mail.chem.tamu.edu" echo " " exit