Sample Scripts

From UF HPC Wiki

Jump to: navigation, search

Contents

Sample scripts for applications

You can find all of the sample scripts for various applications at the PBS Sample Job Scripts page.

Header Information

Scripts should start with the following approximate form:

#!/bin/bash
#
#PBS -q submit
#PBS -m abe
#PBS -l nodes=1:ppn=1
#PBS -r n
#PBS -l walltime=120:00:00
#

Header Options

  • -q: Defines which queue you wish the job to run in. If this option is left out, the job will run on the default queue.
  • -l: Defines resource lists. There are a number of options which will be defined separately.
  • -N: Defines the name of the job for the queuing system.
  • -o: Filename for where standard output of the job will go.
  • -e: Filename for where standard error of the job will go.
  • -j: Join the output of standard output and standard error into one file.
    • If oe is used, the output will be placed in standard output.
    • If eo is used, the output will be placed in standard error.
    • If this option is used, the second output file definition does not need to be used.
  • -m: Mail options:
    • a: Mail if job is aborted.
    • b: Mail when job begins.
    • e: Mail when job ends.
  • -M: Address that mail is sent to.

Resource List Options

  • nodes: Define the number of nodes to reserve for the job to run on.
  • ppn: Processors per node. Defines the number of processors per node that the job should use.
  • infiniband: Define whether or not the job requires the use of infiniband enabled nodes.
  • gige: Define whether or not the job should run on gigabit-only nodes.
  • walltime: Define the maximum walltime for the job to run. By default, this is 24 hours.
    • You want to be sure to set your walltime for the job with reasonable accuracy. If you know that your job will only take an hour to run, setting the walltime of your job to two hours is perfectly reasonable and will also help in the scheduling of your job. If your job is only going to run for an hour, but you specify in your job file a walltime of six days, it will not have the priority that it could have. The scheduler is smart enough to squeeze in jobs here and there that take a short amount of time.
    • When setting your walltime, allow for some amount of "wiggle" room so that if the job does take a bit longer than usual due to heavy disk access waits or other mitigating circumstances, it still has time to complete. Your job will be killed if it exceeds the walltime limit set.
  • Disk Settings

Infiniband Detection

C Shell

This script will detect whether or not a machine is IB enabled, and set the MPIRUN variable to be the appropriate mpirun command.

set IbEnabled = `/usr/local/sbin/IbEnabled`
if ( $IbEnabled ) then
      echo "Running on IB-enabled node set"
      set MPIRUN = "mpirun --mca btl openib"
else
      echo "Running on GigE-enabled node set"
      set MPIRUN = "mpirun --mca btl ^udapl,openib --mca btl_tcp_if_include eth0"
endif