Octave

From SciNet Users Documentation
Jump to: navigation, search

GNU Octave is a popular interactive data analysis language. It has been specifically designed to be an open-source alternative to MATLAB. As such, most MATLAB code can be successfully run using Octave. It is very fast to write code in, but the software that results is much much slower than C or Fortran; one should be wary of doing too much compute-intensive work in Octave.

Running Octave on Niagara

The available Octave modules can be found using the usual module commands. As of 6 December July 2018 the following Octave module is available:

   $ module spider octave
   ----------------------------------------------------------------------------
   octave: octave/4.4.0
   ----------------------------------------------------------------------------

The Octave module depends upon the gcc and mkl modules. You load the module in the usual way:

    $ module load gcc/7.3.0 mkl/2018.2
    $ module load octave/4.4.0
    $ octave
    octave:1>

You can also run MATLAB/Octave scripts in the usual way:

    $ octave myawesomescript.m

Running serial Octave jobs

As with all serial jobs, if your Octave computation does not use multiple cores, you should bundle them up so the 40 cores of a node are all performing work. Examples of this can be found on this page.

Changing the Octave history file

By default, Octave will save its history file in ~/.octave_hist. This is in your home directory, which cannot be written to from compute nodes. To change the location of the history file to your scratch directory, put the line

 export OCTAVE_HISTFILE=${SCRATCH}/.octave_hist

in your .bashrc file.