#!/bin/bash # # Script Name : psubi # Purpose : PBS batch job submission with command line input executables # generated with Intel compiler. A companion script, psub, is # for use with default compiler which is ystem-defaulted to gcc. # If you use "module" to set default compiler to Intel's, then # psub and psubi are fully equivalent. # The problem with directly submitting a batch job thru PBS qsub # is the fact that qsub does not accept command line input other # than a run script. As a result, unless you always run the same # executable with same runtime and same number of processors, you # will inevitably have to create many runscripts to cater to # different situations. # This script circumvent that by acting as an interface. Running of # this script, which accepts command line input, such as exec name, # number of processors, etc., and generate a temp script that # include all those command line input into the script and submit # it via qsub. This temp script is called "psubi.USERID", where USERID # is the user's own ID. # Usage: # cootie % psubi exec-name numprocs ["-l walltime=xx:xx:xx ..."] # # Examples: (examples below override the script's default of # 30 mins walltime and per processor node ppn=1) # cootie % psubi ../../a.out 4 "-l walltime=00:45:00" # cootie % psubi ../../a.out 4 "-l walltime=00:45:00 -l nodes=2:ppn=2" # # The output files from using this script are: # 1) psubi.USERID -- the temp script # 2) psubi.USERID.ennnnn -- PBS error file # 3) psubi.USERID.onnnnn -- PBS output file # 4) psubi.JOBID.out -- stdout file (output to "terminal") # # Author : Kadin Tseng, SCV, Boston University # Date : April 23, 2005 if [ $# -ge 2 ] then script="psubi.${USER}" echo "#!/bin/bash" > $script echo '#' >> $script echo '# All lines starting with "#PBS" are PBS commands' >> $script echo '#' >> $script echo "# Request $2 nodes with 1 processor per node" >> $script echo '#' >> $script echo "#PBS -l nodes=$2:ppn=1" >> $script echo '#' >> $script echo '# Set wall clock time to 0 hours, 30 minutes and 0 seconds' >> $script echo '#PBS -l walltime=00:30:00' >> $script echo '#' >> $script echo 'GMCONF=`/usr/local/pbs/util/mknodes`' >> $script echo "cd \$PBS_O_WORKDIR" >> $script echo "#PBS $3" >> $script MPIRUN="/usr/local/IT/mpichgm-1.2.6..14b/intel/bin/mpirun" if [ -f mystdin ] then echo "$MPIRUN -machinefile \$GMCONF -np $2 $1 < mystdin > psubi.\$PBS_JOBID.out" >> $script else echo "$MPIRUN -machinefile \$GMCONF -np $2 $1 > psubi.\$PBS_JOBID.out" >> $script fi echo "exit 0" >> $script chmod +x $script qsub $script $3 else echo "Usage: psubi a.out num-procs ['optional PBS parameters']" fi