2

I use the following code to submit a job on a cluster, but I don't know what these code means. Can some one explain me what the following code means if possible line-by-line.

#!/bin/bash
#PBS -N NAME_OF_JOB
#PBS -l nodes=1:ppn=20
#PBS -l matlab_user=1
#PBS -l matlab_lic=20
#PBS -l min_walltime=1:00
#PBS -q small
#PBS -S /bin/bash
##PBS -V
##PBS -m abe
#PBS -j oe
#
cd $PBS_O_WORKDIR
cat $PBS_NODEFILE
export PATH=/opt/software/matlabr2014a/mdcs/bin:$PATH
matlab -nodisplay -r "code1" -logfile code1.log

Thanks

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
pkj
  • 123
  • 3

2 Answers2

1

Can some one explain me what the following code means if possible line-by-line.

The commands beginning with "#PBS" are directives for the batch job summiting resource manager. Your cluster should have an administrator who can point you at the PBS documentation. Or, here's some I found on the internet: https://rcc.its.psu.edu/user_guides/system_utilities/pbs/#overview

The other lines are:

cd $PBS_O_WORKDIR

Change to the directory defined in the environment variable $PBS_O_WORKDIR

cat $PBS_NODEFILE

print the file whose name is defined in the environment variable $PSB_NODEFILE to the screen

export PATH=/opt/software/matlabr2014a/mdcs/bin:$PATH

Update the $PATH variable (where the system looks for executables) to include the directory /opt/software/matlabr2014a/mdcs/bin (probably where matlab executable is located)

matlab -nodisplay -r "code1" -logfile code1.log

run MATLAB to execute the function or subroutine "code1" and send the output to the log file "code1.log"

hft
  • 201
  • 2
  • 8
0

These commands are for a task scheduler. There are several different ones, but this looks like the format for torque, which I am very familiar with.

Torque - http://docs.adaptivecomputing.com/torque/5-1-0/help.htm

Here is the torque 5 documentation. You may be running 2.x, 4.x or 5.x http://docs.adaptivecomputing.com/torque/5-1-0/help.htm#topics/torque/commands/qsub.htm?Highlight=-m%20abe

#PBS -N NAME_OF_JOB => Sets a name that can be identified in `qstat` or `checkjob`
#PBS -l nodes=1:ppn=20 => Requests 20 tasks, (1 node with 20 processors, 2 nodes with 10 processors ect...)
#PBS -l matlab_user=1 
#PBS -l matlab_lic=20 
#PBS -l min_walltime=1:00 => The job should run for at least 1 minute
#PBS -q small => => queue or class you administrator has configured
#PBS -S /bin/bash => Shell to use
##PBS -V => Commented out, exports environment variables to batch job
##PBS -m abe => Commented out, specifies when mail should be sent (abort, begin, end)
#PBS -j oe => Combine stdout and stderror into one directory

cd $PBS_O_WORKDIR => Environment variable of where the job runs
cat $PBS_NODEFILE => prints out the output of the spool. 
spuder
  • 17,643
  • 36
  • 91
  • 119
  • sure... I will accept a satisfactory answer but before that I would like to give others time to reply. – pkj Apr 11 '15 at 16:40