UMBC High Performance Computing Facility
How to run Octave on tara
Introduction
On this page we'll see how to use Octave on the tara
cluster. Before proceeding, make sure you've read the
how to run tutorial first.
Octave is an open source
mathematics package, similar to in functionality to
MATLAB.
Example batch script
We'll write a simple Octave script that says "hello", and does some simple
linear algebra operations.
[status, host] = system('hostname');
printf('Hello world from %s\n', host);
A = [1 3 5; 2 5 1; 2 3 8]
inv(A)
det(A)
Download:
../code/octave_hello/hello.m
We can launch it with a standard SLURM script
#!/bin/bash
#SBATCH --job-name=hello_octave
#SBATCH --output=slurm.out
#SBATCH --error=slurm.err
#SBATCH --partition=develop
octave --silent --eval hello
Download:
../code/octave_hello/run.slurm
Now we launch the job
[araim1@tara-fe1 octave_hello]$ sbatch run.slurm
sbatch: Submitted batch job 2618
[araim1@tara-fe1 octave_hello]$ ls
hello.m run.slurm slurm.err slurm.out
[araim1@tara-fe1 octave_hello]$ cat slurm.out
Hello world from n1
A =
1 3 5
2 5 1
2 3 8
ans =
-1.480000 0.360000 0.880000
0.560000 0.080000 -0.360000
0.160000 -0.120000 0.040000
ans = -25
[araim1@tara-fe1 octave_hello]$
Also note that hello.m can be run directly on the front end node, which is okay
here because it's a small job
[araim1@tara-fe1 octave_hello]$ octave --silent --eval hello
Hello world from tara-fe1.rs.umbc.edu
A =
1 3 5
2 5 1
2 3 8
ans =
-1.480000 0.360000 0.880000
0.560000 0.080000 -0.360000
0.160000 -0.120000 0.040000
ans = -25
[araim1@tara-fe1 octave]$
Running Octave interactively
Octave can also be used interatively on the front end node, as in the
following example
[araim1@tara-fe1 octave_hello]$ octave --silent
octave:1> [status, host] = system('hostname')
status = 0
host = tara-fe1.rs.umbc.edu
octave:2> printf('Hello world from %s\n', host);
Hello world from tara-fe1.rs.umbc.edu
octave:3> A = [1 3 5; 2 5 1; 2 3 8]
A =
1 3 5
2 5 1
2 3 8
octave:4> inv(A)
ans =
-1.480000 0.360000 0.880000
0.560000 0.080000 -0.360000
0.160000 -0.120000 0.040000
octave:5> det(A)
ans = -25
octave:6> quit
[araim1@tara-fe1 octave_hello]$
As always, this should only be used for smaller computations. Intensive
programs should be submitted to the compute nodes.