#!/bin/bash
##########################################################################################################
# This acts as a wrapper/filter to qsub. Written by Sreedhar Manchu.
# Added on Aug 8th, 2011
# http://www.clusterresources.com/torquedocs21/a.jqsubwrapper.shtml
##########################################################################################################
# Memory Variables.
# If you want to provide more memory for jobs than the currently allocated memory on
# nodes on certain chassis you just need to change these variables.
mem16gb_limit=14 # Right now 14GB memory is allocated for jobs on 16GB nodes
mem32gb_limit=30 # Right now 30GB memory is allocated for jobs on 32GB nodes
mem_bigmem_min=18 # Minimum memory required for bigmem queue in GB
memory_per_core=1536 # Memory allocated per core is 1536MB (1.5GB). If you are changing this number make sure
# that the processors per node times this number is at least 1GB less than physcal memory
# present on the node. In this case, it is 16GB. 8*1536MB=12GB < 15GB. This number
# should be in MB.
wtime_bigmem_max=172800 # Bigmem queue maximum walltime in seconds (48 hours)
# Should be a multiple of 3600.
wtime_p12_max=43200 # p12 queue maximum walltime in seconds (12 hours)
# Should be a multiple of 3600.
wtime_p48_max=172800 # p48 queue maximum walltime in seconds (48 hours)
# Should be a multiple of 3600.
wtime_serlong_min=172860 # serlong queue minimum walltime in seconds (48 hours 1 minute)
# The remainder after deviding it with 3600 should be a multiple of 60.
wtime_serlong_max=345600 # serlong queue maximum walltime in seconds (96 hours)
# Should be a multiple of 3600.
wtime_ser2_min=60 # ser2 queue minimum walltime in seconds (1 minute).
# Should be a multiple of 60. For example, it can be 120 (=2*60)
wtime_ser2_max=172800 # ser2 queue maximum walltime in seconds (48 hours)
# Should be a multiple of 3600.
# Don't change the code in the block bordered by dashes
#---------------------------------------------------------------------------------------------------------
if [ $# -eq 1 ] # Enters loop when job runs through only script. Hence argument is 1.
then # This part of the code makes sure that script follows the pbs scripting rules.
counter=0
line_count=0
while read -r i
do
if [ $line_count -eq 0 ]
then
if echo $i | egrep "^#\! */" 2>&1 > /dev/null # Looks for shebang/hashbang (#!) in the first line
then
echo $i
else
echo -e "\nFirst line should have shebang/hashbang (#!). Please fix the script\n" > /dev/tty
echo -e "For example, it can be #!/bin/sh or #!/bin/bash , etc.\n" > /dev/tty
echo -e "For more information please refer to https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
fi
line_count=1
pbs_operatives="not_done"
pbs_line_count=0
pbs_first_line="yes"
continue
elif [[ $pbs_operatives == "not_done" ]]
then
if [ $pbs_first_line = "yes" -a `echo $i | egrep "^$" 2>&1 > /dev/null` $? -ne 0 -a `echo $i | egrep "^ *#" | grep -v "^ *#PBS *" 2>&1 > /dev/null` $? -ne 0 -a `echo $i | egrep "^ *#PBS *" 2>&1 > /dev/null` $? -ne 0 ]
then
echo -e "\nPBS operatives such as \"#PBS -l nodes=1:ppn=2,walltime=05:00:00\" are either missing or not declared immediately after shebang/hashbang line \"#\!/bin/bash\". Please fix the script.\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
else
pbs_first_line="no"
if [ `echo $i | egrep "^$" 2>&1 > /dev/null` $? -eq 0 -o `echo $i | egrep "^ *#" | grep -v "^ *#PBS *" 2>&1 > /dev/null` $? -eq 0 ]
then
echo $i
line_count=$(($line_count+1))
if [ `head -$(($line_count+1)) $1 | tail -1 | egrep "^$" 2>&1 > /dev/null` $? -ne 0 -a `head -$(($line_count+1)) $1 | tail -1 | egrep "^ *#" | grep -v "^ *#PBS *" 2>&1 > /dev/null` $? -ne 0 -a `head -$(($line_count+1)) $1 | tail -1 | egrep "^ *#PBS *" 2>&1 > /dev/null` $? -ne 0 ]
then
if [ $pbs_line_count -eq 0 ]
then
echo -e "\nPBS operatives such as \"#PBS -l nodes=1:ppn=2,walltime=05:00:00\" are either missing or not declared immediately after shebang/hashbang line \"#\!/bin/bash\". Please fix the script.\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
else
pbs_operatives="done"
fi
fi
continue # This part of the code finds the required parts from #pbs lines
elif echo $i | egrep "^ *#PBS *" 2>&1> /dev/null # Looks for #PBS lines
then
if echo $i | egrep "^ *#PBS *-q *" 2>&1> /dev/null # Looks for #PBS -q line
then
queue=$i # Stores the queue requested
echo $i
elif echo $i | egrep "^ *#PBS *-l *" 2>&1> /dev/null # Looks for #PBS -l lines
then
if echo $i | egrep " *nodes=0*[1-9][0-9]?" 2>&1> /dev/null # Looks for nodes= in #PBS -l line
then
node_count=`echo $i | egrep -o 'nodes=0*[1-9][0-9]?' | cut -d"=" -f2` # stores number of nodes requested
#echo "node count is $node_count"
fi
if echo $i | egrep "ppn=0*[1-9][0-9]?" 2>&1> /dev/null # Looks for ppn= in #PBS -l line
then
ppn_count=`echo $i | egrep -o 'ppn=0*[1-9][0-9]?' | cut -d"=" -f2` # stores number of ppn requested
#echo "ppn count is $ppn_count"
fi
if echo $i | egrep " *mem=0*[1-9][0-9]*[a-zA-Z][a-zA-Z]" 2>&1> /dev/null # looks for mem= in #PBS -l line
then
if echo $i | egrep -w " *mem=0*[1-9][0-9]*[a-zA-Z][a-zA-Z]" 2>&1> /dev/null
then
mtag=`echo $i | egrep -o ' *mem=0*[1-9][0-9]*[a-zA-Z][a-zA-Z]' | cut -d= -f2 | egrep -o '[a-zA-Z][a-zA-Z]'` # stores memory tag like KB, MB or GB
memory=`echo $i | egrep -o 'mem=0*[1-9][0-9]*' | cut -d"=" -f2`
if echo $mtag | egrep '[gG][bB]' 2>&1> /dev/null
#if [[ $mtag =~ "[gG][bB]" ]]
then
memory=`expr $memory '*' 1024 '*' 1024` # stores memory requested and converts it into kilo bytes
#memory=$(($memory*1024*1024))
elif echo $mtag | egrep '[mM][bB]' 2>&1> /dev/null
#if [[ $mtag =~ "[mM][bB]" ]]
then
memory=`expr $memory '*' 1024`
#memory=$(($memory*1024))
elif echo $mtag | egrep '[kK][bB]' 2>&1> /dev/null
#if [[ $mtag =~ "[kK][bB]" ]]
then
memory=$memory
else
echo -e "\nMemory should be either in Kilo Bytes(kb, KB) or Mega Bytes (mb, MB) or Giga Bytes (gb, GB). Please fix the script.\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
fi
else
echo -e "\nMemory tag should not be more than two letters. It can be just one of kb,KB,mb,MB,gb and GB. Please fix the script.\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
fi
fi
if echo $i | egrep -o '( |,)walltime=[0-9]*:?[0-9]*:?[0-9]*:?[0-9]*($|,)' 2>&1> /dev/null # looks for walltime= in #PBS -l line
then
wallstring=`echo $i | egrep -o '( |,)walltime=[0-9]*:?[0-9]*:?[0-9]*:?[0-9]*($|,)' | cut -f2 -d"="`
if [ `echo "$wallstring" | egrep -o '^[0-9]*:?[0-9]*:?[0-9]*:?[0-9]*,$'` ]
then
wallstring=`echo "$wallstring" | cut -f1 -d","`
fi
if [ -z "$wallstring" ]
then
echo -e "\nPlease declare the walltime in the script such as in \"#PBS -l walltime=05:00:00\" or \"#PBS -l nodes=1:ppn=8,walltime=05:00:00\"\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1;
elif [ `echo "$wallstring" | egrep -o '^:{1,3}$'` ]
then
echo -e "\nPlease declare the walltime in the script such as in \"#PBS -l walltime=05:00:00\" or \"#PBS -l nodes=1:ppn=8,walltime=05:00:00\"\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1;
else
number=`echo "$wallstring" | tr -dc ":" | wc -c`
for (( j=$(($number+1)); j>0; j-- ))
do
if [ -n "`echo "$wallstring" | cut -f"$j" -d":"`" -a $j -eq $(($number+1)) ]
then
walltime=`echo "$wallstring" | cut -f"$j" -d":"` # stores walltime requested
elif [ -n "`echo "$wallstring" | cut -f$j -d":"`" -a $j -eq $number ]
then
walltime=$(($walltime+`echo "$wallstring" | cut -f$j -d":"`*60)) # converts into seconds
elif [ -n "`echo "$wallstring" | cut -f$j -d":"`" -a $j -eq $(($number-1)) ]
then
walltime=$(($walltime+`echo "$wallstring" | cut -f$j -d":"`*60*60)) # converts into seconds
elif [ -n "`echo "$wallstring" | cut -f$j -d":"`" -a $j -eq $(($number-2)) ]
then
walltime=$(($walltime+`echo "$wallstring" | cut -f$j -d":"`*24*60*60)) # converts into seconds
fi
done
fi
#echo "walltime is $walltime"
fi
echo $i
else
echo $i
fi
line_count=$(($line_count+1))
pbs_line_count=$(($pbs_line_count+1))
if [ `head -$(($line_count+1)) $1 | tail -1 | egrep "^$" 2>&1 > /dev/null` $? -ne 0 -a `head -$(($line_count+1)) $1 | tail -1 | egrep "^ *#" | grep -v "^ *#PBS *" 2>&1 > /dev/null` $? -ne 0 -a `head -$(($line_count+1)) $1 | tail -1 | egrep "^ *#PBS *" 2>&1 > /dev/null` $? -ne 0 ]
then
pbs_operatives="done"
fi
continue
fi
fi
fi
if [ -z $node_count ]
then
echo -e "\nNode count is not declared such as in \"#PBS -l nodes=1:ppn=8,walltime=05:00:00\". Please fix the script.\n" > /dev/tty
echo -e "For more information please refter to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
fi
if [ -z $ppn_count ]
then
echo -e "\nProcessor Per Node count is not declared such as in \"#PBS -l nodes=1:ppn=8,walltime=05:00:00\". Please fix the script.\n" > /dev/tty
echo -e "For more information please refter to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
else
if [ $ppn_count -gt 8 ]
then
echo -e "\nMaximum number of processors per node available is 8. Please fix the script.\n" > /dev/tty
echo -e "For more information please refter to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
fi
fi
if [ -z $walltime ]
then
echo -e "\nPlease declare the walltime in the script such as in \"#PBS -l walltime=05:00:00\" or \"#PBS -l nodes=1:ppn=8,walltime=05:00:00\"\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1;
fi
#---------------------------------------------------------------------------------------------------------
# This part of the code works based on the queues declared.
if [ -n "$queue" -a $counter -eq 0 ]
then
if echo $queue | egrep "^ *#PBS *-q *bigmem$" 2>&1> /dev/null # Enters if the queue is bigmem
then
if [ -z "$memory" ] # If memory is not requested it echoes the statement below.
then
echo -e "\nBigmem queue needs memory declaration in the pbs script. For example, if your job needs 25GB memory, job script should contain a line:" > /dev/tty
echo -e "\n#PBS -l mem=25GB\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
else
if [ $memory -lt $(($mem_bigmem_min*1024*1024)) ]
then
echo -e "\nMinimum memory for bigmem queue is ${mem_bigmem_min}GB. Please fix the script.\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
elif [ $memory -gt $(($mem32gb_limit*1024*1024)) ]
then
echo -e "\nMaximum memory for bigmem queue is ${mem32gb_limit}GB. Please fix the script.\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
fi
fi
if [ $walltime -gt $wtime_bigmem_max ] # makes sure walltime is less than 48 hours
then
echo -e "\nThe maximum walltime for bigmem jobs is $(($wtime_bigmem_max/3600)) hours. Please fix the walltime before you resubmit the script.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
fi
elif echo $queue | egrep "^ *#PBS *-q *p12$" 2>&1> /dev/null # looks for p12 queue in #PBS -q line
then
if [ ! -z $node_count -a $node_count -eq 1 ] # p12 jobs require minimum 2 nodes
then
echo -e "\nMinimum number of nodes needed for queue p12 is 2. Please fix your job script.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
elif [ -n "$memory" -a -n $node_count ]
then
if [ $memory -gt $(($mem16gb_limit*1024*1024)) ]
then
echo -e "\nTo run parallel jobs that require memory greater than ${mem16gb_limit}GB please use queue bigmem.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
fi
elif [ -z "$memory" ]
then
echo "#PBS -l mem=${mem16gb_limit}GB"
echo -e "\nAllocated memory for your job is ${mem16gb_limit}GB. If you need more than this please use bigmem queue.\n"> /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
fi
if [ $walltime -gt $wtime_p12_max ] # makes sure walltime is less than 12 hours for p12 jobs
then
echo -e "\nThe maximum walltime for p12 jobs is $(($wtime_p12_max/3600)) hours. Please fix the walltime before you resubmit the script.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
fi
elif echo $queue | egrep "^ *#PBS *-q *p48$" 2>&1> /dev/null # p48 queue
then
if [ ! -z $node_count -a $node_count -eq 1 ]
then
echo -e "\nMinimum number of nodes needed for queue p48 is 2. Please fix your job script.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
elif [ -n "$memory" -a -n $node_count ]
then
if [ $memory -gt $(($mem16gb_limit*1024*1024)) ]
then
echo -e "\nTo run parallel jobs that require memory greater than ${mem16gb_limit}GB please use queue bigmem.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
fi
elif [ -z "$memory" ]
then
echo "#PBS -l mem=${mem16gb_limit}GB"
echo -e "\nAllocated memory for your job is ${mem16gb_limit}GB. If you need more than this please use bigmem queue.\n"> /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
fi
if [ $walltime -gt $wtime_p48_max ]
then
echo -e "\nThe maximum walltime for p48 jobs is $(($wtime_p48_max/3600)) hours. Please fix the walltime before you resubmit the script.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
fi
elif echo $queue | egrep "^ *#PBS *-q *serlong$" 2>&1> /dev/null # serlong queue
then
if [ ! -z $node_count -a $node_count -gt 1 ]
then
echo -e "\nThe maximum node count for serlong queue is 1. Please fix the script.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
elif [ $walltime -lt $wtime_serlong_min ]
then
echo -e "\nThe minimum walltime for serlong queue is $(($wtime_serlong_min/3600)) hours $((($wtime_serlong_min-3600*($wtime_serlong_min/3600))/60)) minute. Please fix the script.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
elif [ $walltime -gt $wtime_serlong_max ]
then
echo -e "\nThe maximum walltime for serlong queue is $(($wtime_serlong_max/3600)) hours. Please fix the script.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
fi
if [ -n "$memory" ]
then
if [ $memory -gt $(($mem16gb_limit*1024*1024)) ]
then
echo -e "\nMaximum memory available for serlong queue is ${mem16gb_limit}GB. To request more than this please use queue bigmem.\n" > /dev/tty
echo -e "For more information please refter to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
fi
if [ $ppn_count -lt 8 ]
then
if [ $(($ppn_count*$mem16gb_limit*1024*1024/8)) -lt $memory ]
then
echo -e "\nAllocated memory for each core is $(($mem16gb_limit*1024/8))MB (=${mem16gb_limit}GB/8). Please change the ppn count in the script according to the calculation, ppn*$(($mem16gb_limit*1024/8))MB >= declared memory for the job.\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
fi
else
if [ $memory -gt $(($mem16gb_limit*1024*1024)) ]
then
echo -e "\nMaximum memory available is ${mem16gb_limit}GB. Please fix the script.\n" > /dev/tty
echo -e "For more information refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
fi
fi
else
if [ $ppn_count -lt 8 ]
then
echo "#PBS -l mem=$(($ppn_count*$memory_per_core))MB"
echo -e "\nAllocated memory for your job is $(($ppn_count*$memory_per_core))MB. Memory is calculated using the formula ppn times memory per core, ${memory_per_core}MB." > /dev/tty
echo -e "If you think you need more memory than this please either change ppn count or declare memory with #PBS -l mem=xxGB\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
else
echo "#PBS -l mem=${mem16gb_limit}GB"
echo -e "\nAllocated memory for your job is ${mem16gb_limit}GB. If you need more than this please use bigmem queue.\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
fi
fi
elif echo $queue | egrep "^ *#PBS *-q *ser2$" 2>&1> /dev/null # ser2 queue
then
if [ ! -z $node_count -a $node_count -gt 1 ]
then
echo -e "\nThe maximum node count for ser2 queue is 1. Please fix the script.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
elif [ $walltime -lt $wtime_ser2_min ]
then
echo -e "\nThe minimum walltime for ser2 queue is $(($wtime_ser2_min/60)) minute. Please fix the script.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
elif [ $walltime -gt $wtime_ser2_max ]
then
echo -e "\nThe maximum walltime for ser2 queue is $(($wtime_ser2_max/3600)) hours. Please fix the script.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
fi
if [ -n "$memory" ]
then
if [ $memory -gt $(($mem16gb_limit*1024*1024)) ]
then
echo -e "\nMaximum memory available for ser2 queue is ${mem16gb_limit}GB. To request more than this please use queue bigmem.\n" > /dev/tty
echo -e "For more information please refter to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
fi
if [ $ppn_count -lt 8 ]
then
if [ $(($ppn_count*$mem16gb_limit*1024*1024/8)) -lt $memory ]
then
echo -e "\nAllocated memory for each core is $(($mem16gb_limit*1024/8))MB (=${mem16gb_limit}GB/8). Please change the ppn count in the script according to the calculation, ppn*$(($mem16gb_limit*1024/8))MB >= declared memory for the job.\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
fi
else
if [ $memory -gt $(($mem16gb_limit*1024*1024)) ]
then
echo -e "\nMaximum memory available is ${mem16gb_limit}GB. Please fix the script.\n" > /dev/tty
echo -e "For more information refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
fi
fi
else
if [ $ppn_count -lt 8 ]
then
echo "#PBS -l mem=$(($ppn_count*$memory_per_core))MB"
echo -e "\nAllocated memory for your job is $(($ppn_count*$memory_per_core))MB. Memory is calculated using the formula ppn times memory per core,${memory_per_core} MB." > /dev/tty
echo -e "If you think you need more memory than this please either change ppn count or declare memory with #PBS -l mem=xxGB\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
else
echo "#PBS -l mem=${mem16gb_limit}GB"
echo -e "\nAllocated memory for your job is ${mem16gb_limit}GB. If you need more than this please use bigmem queue.\n"> /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
fi
fi
fi
counter=1
# This part of the code works when there are no queues declared.
elif [ -z "$queue" -a $counter -eq 0 ]
then
if [ -n $node_count -a $node_count -eq 1 ]
then
if [ $walltime -lt $wtime_ser2_min ]
then
echo -e "\nThe minimum walltime for serial jobs is $(($wtime_ser2_min/60)) minute. Please fix the script.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
elif [ $walltime -gt $wtime_serlong_max ]
then
echo -e "\nThe maximum walltime for serial jobs is $(($wtime_serlong_max/3600)) hours. Please fix the script.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
fi
if [ -z "$memory" ]
then
if [ -n $ppn_count -a $ppn_count -lt 8 ]
then
echo "#PBS -l mem=$(($ppn_count*$memory_per_core))MB"
echo -e "\nAllocated memory for your job is $(($ppn_count*$memory_per_core))MB. Memory is calculated using the formula ppn times memory per core, ${memory_per_core}MB." > /dev/tty
echo -e "If you think you need more memory than this please either change ppn count or declare memory with #PBS -l mem=xxGB\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
elif [ -n $ppn_count -a $ppn_count -eq 8 ]
then
echo "#PBS -l mem=${mem16gb_limit}GB"
echo -e "\nAllocated memory for your job is ${mem16gb_limit}GB. If you need more than this please use bigmem queue.\n"> /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
fi
else
if [ $memory -gt $(($mem16gb_limit*1024*1024)) ]
then
echo -e "\nMaximum memory available is ${mem16gb_limit}GB. To request more than this please use queue bigmem.\n" > /dev/tty
echo -e "For more information please refter to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
fi
if [ $ppn_count -lt 8 ]
then
if [ $(($ppn_count*$mem16gb_limit*1024*1024/8)) -lt $memory ]
then
echo -e "\nAllocated memory for each core is $(($mem16gb_limit*1024/8))MB (=${mem16gb_limit}GB/8). Please change the ppn count in the script according to the calculation, ppn*$(($mem16gb_limit*1024/8))MB >= declared memory for the job.\n" > /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
fi
fi
fi
elif [ -n $node_count -a $node_count -ge 2 ]
then
if [ $walltime -gt $wtime_p48_max ]
then
echo -e "\nMaximum walltime for parallel jobs is $(($wtime_p48_max/3600)) hours. Please fix the script.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Queues\n" > /dev/tty
exit -1
fi
if [ -n "$memory" ]
then
if [ $memory -gt $(($mem16gb_limit*1024*1024)) ]
then
echo -e "\nTo run parallel jobs that require memory greater than ${mem16gb_limit}GB please use queue bigmem.\n" > /dev/tty
echo -e "For more information please refer to HPC wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
exit -1
fi
else
echo "#PBS -l mem=${mem16gb_limit}GB"
echo -e "\nAllocated memory for your job is ${mem16gb_limit}GB. If you need more than this please use bigmem queue.\n"> /dev/tty
echo -e "For more information please refer to HPC Wiki at https://wikis.nyu.edu/display/NYUHPC/Running+jobs\n" > /dev/tty
fi
fi
counter=1
fi
echo $i
done
# This below part works when job is submitted through command line but
# not through script. Where as the above part entirely deals with the pbs scripts.
else
while read -r i
do
echo $i
done
fi
Monday, August 22, 2011
Torque qsub wrapper/submit filter shell script
I have recently written this shell script to act as a filter to pbs job scripts submitted on our clusters. For more information look online for Torque administrator manual.
Subscribe to:
Post Comments (Atom)
PBS Script Generator: Interdependent dropdown/select menus in Javascript
About Me
- My Knotty Mind - Labyrinth
- LA, CA, United States
- Here I write about the battles that have been going on in my mind. It's pretty much a scribble.
Blog Archive
-
▼
2011
(43)
-
▼
August
(13)
- MySQL with ODBC driver
- Applescript for Apple Mail
- Locking screen on Mac from Terminal
- Installing XmGrace (Grace) on Mac OS X
- Torque qsub wrapper/submit filter shell script
- Making personal keyboard shortcuts to Applications...
- selection of form fields uisng tab on Mac
- Getting rid of annoying document images under plac...
- Installing DJVIEW4 on Mac OS X for viewing .djvu f...
- Enabling X11 Forwarding on Mac OS X
- Apple shortcut to highlight apple icon on top left...
- Performance Analysis Tools: MPE2, mpiP and libunwi...
- LAMMPS, FFTW, JPEGLIB and MPICH2 Installation on M...
-
▼
August
(13)
No comments:
Post a Comment