Updated 2019-02-21

Run Octave in Batch Mode


  • Octave is a powerful math focused programming language. It includes :
    • An interactive terminal version
    • A GUI version which can be used to run the interactive terminal
    • Batch Mode (scripting)
  • This guide will focus on batch mode, but if you want to run the interactive modes check out the Octave Interactive guide


  • In the PBS script, load octave with module load octave.


You can use module avail octave to see what versions of octave are available.

  • The line to run an octave script is octave <filename>.m. Add this to the computation part of your PBS script to run.

Walkthrough: Run Octave on the Cluster

  • This walkthrough will use a simple Octave script that calculates the sqrt(3^2 + 4^2).
  • Octave script: octaveTest.m
  • PBS script: octave.pbs
  • You can transfer the files to your account on the cluster to follow along. The file transfer guide may be helpful.

Part 1: The PBS Script

#PBS -N octaveTest
#PBS -l nodes=1:ppn=2
#PBS -l pmem=2gb
#PBS -l walltime=1:00
#PBS -q force-6
#PBS -j oe
#PBS -o octaveTest.out

module load octave
octave octaveTest.m
  • The #PBS directives are standard, requesting just 1 minute of walltime and 1 node with 2 cores. More on #PBS directives can be found in the PBS guide
  • $PBS_O_WORKDIR is simply a variable that represents the directory you submit the PBS script from.


Make sure the octave script you want to run (in this case, octaveTest.m) is in the same directory you put the PBS script.

  • module load octave loads octave. To see what octave versions are available, run module avail octave, and load the one you want

Part 2: Submit Job and Check Status

  • Make sure you're in the dir that contains the PBS Script
  • Submit as normal, with qsub <pbs script name>. In this case qsub octave.pbs
  • Check job status with qstat -u <gtusername3> -n, replacing "gtusername3" with your gt username.
  • You can delete the job with qdel 22182721 , replacing the number with the jobid returned after running qsub

Part 3: Collecting Results

  • In the directory where you submitted the PBS script, you should see a octaveTest.out file, which contains the results of the job. Use cat octaveTest.out or open the file in a text editor to take a look.
  • octaveTest.out should look something like this:
Job name:   octaveTest
Queue:      force-6
End PBS Prologue Thu Oct  4 09:20:23 EDT 2018
octave: X11 DISPLAY environment variable not set
octave: disabling GUI features
x =  5
Sqrt of 3^2 + 4^2 = 5.0000
Elapsed time: 0.0004 seconds
Begin PBS Epilogue Thu Oct  4 09:20:24 EDT 2018
Job ID:     22612013.shared-sched.pace.gatech.edu
User ID:    shollister7
Job name:   octaveTest
Resources:  neednodes=1:ppn=2,nodes=1:ppn=2,pmem=2gb,walltime=00:01:00
  • After the result files are produced, you can move the files off the cluster, refer to the file transfer guide for help.
  • Congratulations! You successfully ran an Octave script on the cluster.