Skip to content
Snippets Groups Projects
Forked from SCS / docs.it4i.cz
1525 commits behind, 992 commits ahead of the upstream repository.
octave.md 2.59 KiB

Octave

GNU Octave is a high-level interpreted language, primarily intended for numerical computations. It provides capabilities for the numerical solution of linear and nonlinear problems, and for performing other numerical experiments. It also provides extensive graphics capabilities for data visualization and manipulation. Octave is normally used through its interactive command line interface, but it can also be used to write non-interactive programs. The Octave language is quite similar to Matlab so that most programs are easily portable. Read more on http://www.gnu.org/software/octave/

Two versions of octave are available on the cluster, via module

Status Version module
Stable Octave 3.8.2 Octave
    $ module load Octave

The octave on the cluster is linked to highly optimized MKL mathematical library. This provides threaded parallelization to many octave kernels, notably the linear algebra subroutines. Octave runs these heavy calculation kernels without any penalty. By default, octave would parallelize to 24 threads. You may control the threads by setting the OMP_NUM_THREADS environment variable.

To run octave interactively, log in with ssh -X parameter for X11 forwarding. Run octave:

    $ octave

To run octave in batch mode, write an octave script, then write a bash jobscript and execute via the qsub command. By default, octave will use 16 threads when running MKL kernels.

    #!/bin/bash

    # change to local scratch directory
    mkdir -p /scratch/work/user/$USER/$PBS_JOBID
    cd /scratch/work/user/$USER/$PBS_JOBID || exit

    # copy input file to scratch
    cp $PBS_O_WORKDIR/octcode.m .

    # load octave module
    module load Octave

    # execute the calculation
    octave -q --eval octcode > output.out

    # copy output file to home
    cp output.out $PBS_O_WORKDIR/.

    #exit
    exit

This script may be submitted directly to the PBS workload manager via the qsub command. The inputs are in octcode.m file, outputs in output.out file. See the single node jobscript example in the Job execution section.

The octave c compiler mkoctfile calls the GNU gcc 4.8.1 for compiling native c code. This is very useful for running native c subroutines in octave environment.

    $ mkoctfile -v

Octave may use MPI for interprocess communication This functionality is currently not supported on the cluster cluster. In case you require the octave interface to MPI, please contact our cluster support.