# ### Example PBS script file ### Provided to show useful options when creating a PBS job script ### ### Submit jobs with 'qsub jobfilename' ### ### ### Job name #PBS -N jobname ### Declare job non-rerunable #PBS -r n ### Output files #PBS -e jobname.err #PBS -o jobname.log ### Mail directives ### -m send mail on (a)bort (b)egin (e)nd #PBS -m abe #PBS -M username@physics.purdue.edu ### Queue name (always default) #PBS -q default ### Number of nodes (want 2 nodes, property of 'dual', for 1 hour walltime) #PBS -l nodes=1:dual,walltime=01:00:00 ### If I'm a node owner, I specify my qos ##PBS -W qos=mine ### Otherwise, specify qos=1, and PBS will pick something available #PBS -W qos=1 # export all my environment variables to the job #PBS -V # # # Using PBS - Environment Variables # When a batch job starts execution, a number of environment variables are # predefined, which include: # # Variables defined on the execution host. # Variables exported from the submission host with # -v (selected variables) and -V (all variables). # Variables defined by PBS. # # The following reflect the environment where the user ran qsub: # PBS_O_HOST The host where you ran the qsub command. # PBS_O_LOGNAME Your user ID where you ran qsub. # PBS_O_HOME Your home directory where you ran qsub. # PBS_O_WORKDIR The working directory where you ran qsub. # # These reflect the environment where the job is executing: # PBS_ENVIRONMENT Set to PBS_BATCH to indicate the job is a batch job, or # to PBS_INTERACTIVE to indicate the job is a PBS interactive job. # PBS_O_QUEUE The original queue you submitted to. # PBS_QUEUE The queue the job is executing from. # PBS_JOBID The job's PBS identifier. # PBS_JOBNAME The job's name. # PBS_NODEFILE the name of the file contain the list of nodes assigned # to the job (for parallel and cluster systems). ### # Change to working directory cd $HOME/working_directory # Create scratch directory on the execution node mkdir /scratch/$PBS_JOBID # Copy data files into scratch directory cp $HOME/working_directory/data_files/* /scratch/$PBS_JOBID # cd into the /scratch directory cd /scratch/$PBS_JOBID # Run some misc commands @echo Running on host `hostname` @echo Time is `date` @echo Directory is `pwd` # Perhaps run a script to set your environment source $HOME/startup # Run your executable, with input and output in the /scratch directory. $HOME/bin/longjob < input.file > output.file # Copy files back home and cleanup cp * $HOME/working_directory/output && \ cd .. && rm -rf /scratch/$PBS_JOBID