https://www.sharcnet.ca/help/api.php?action=feedcontributions&user=Jdesjard&feedformat=atomDocumentation - User contributions [en]2024-03-29T15:54:46ZUser contributionsMediaWiki 1.25.2https://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=16095OCTAVE2017-12-06T19:37:28Z<p>Jdesjard: </p>
<hr />
<div><!--checked2016--><br />
{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
==On the Graham national system==<br />
The module setup on the new national systems general purpose systems Graham and Cedar are slightly different from other SHARCNET systems. The module loading procedures introduce more automation of dependency interactions.<br />
<br />
On the Graham system the user simply needs to call the "module load" command without manually unloading conflicting packages.<br />
<br />
$ module load octave/4.2.1<br />
<br />
To obtain information about the package's dependencies the "spider" action can be included in the call to "module":<br />
<br />
<pre><br />
$ module spider octave<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave:<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Versions:<br />
octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
For detailed information about a specific "octave" module (including how to load the modules) use the module's full name.<br />
For example:<br />
<br />
$ module spider octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
<br />
<br />
<br />
[jdesjard@gra-login1 ~]$ module spider octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave: octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Properties:<br />
Tools for development / Outils de développement<br />
<br />
You will need to load all module(s) on any one of the lines below before the "octave/4.2.1" module is available to load.<br />
<br />
nixpkgs/16.09 gcc/5.4.0<br />
nixpkgs/16.09 intel/2016.4<br />
nixpkgs/16.09 intel/2017.1<br />
<br />
Help:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
</pre><br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
<br />
==On the Graham national system==<br />
<br />
The Graham national system uses the Slurm scheduler which is different from the Torque Moab scheduler that is typical to the majority of other SHARCNET systems. In order to submit a simple "Hellow World!" process to Graham the user would first need to create a submit script as follows.<br />
<br />
$ cat oct_serial.sh <br />
#!/bin/bash<br />
#SBATCH -t 0-00:01<br />
#SBATCH --mem=400<br />
octave --eval 'disp("Hello World! from Octave")'<br />
<br />
Then pass this submit script to "sbatch" to be entered into the queue:<br />
<br />
$ sbatch --account=accountname oct_serial.sh<br />
<br />
... where "accountname" is the name of the accounting group to submit to (e.g. def-groupname, rgg-projectname).<br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.<br />
<br />
==One the Graham nation system==<br />
<br />
Rather than dedicated development as it typical on some of the other SHARCNET systems the national systems have nodes that prioritize interactive jobs allocated by call to "salloc" of the Slurm scheduler.<br />
<br />
To use Octave interactively on Graham you can do the following:<br />
<br />
Use salloc to request a single task for one hour:<br />
<br />
$ salloc --account=def-roxa88 --time=1:0:0 --ntasks=1<br />
<br />
Then you will receive notification when the reservation is granted (including jobid), for<br />
example:<br />
<br />
salloc: Granted job allocation 12345<br />
<br />
Then use srun to start a terminal to work in on the reservation:<br />
<br />
$ srun --wait 0 --pty bash<br />
<br />
Once running the terminal in the allocation you can start your work with Octave by loading<br />
the module and starting the program:<br />
<br />
<pre><br />
$ module load octave<br />
$ octave<br />
octave: X11 DISPLAY environment variable not set<br />
octave: disabling GUI features<br />
GNU Octave, version 4.2.1<br />
Copyright (C) 2017 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-pc-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1><br />
<br />
</pre><br />
<br />
... Then once you have the "octave:#>" prompt the terminal will behave like the Matlab<br />
command line.<br />
<br />
Once you are finished with Octave use "quit" to exit the program, then "exit" to logout of<br />
the compute node (terminate srun), then "exit" again to terminate the allocation<br />
(relinquishing the allocate resources).<br />
<br />
=Running on a visualization system=<br />
<br />
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu > Eduction > GNU Octave.<br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
In order to run Octave so that it interprets scripts as closely as possible to Matlab, use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:<br />
<br />
sqsub -r 60m -o ofile.%J octave --traditional mycode.m<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=16094OCTAVE2017-12-06T18:20:26Z<p>Jdesjard: /* On the Graham national system */</p>
<hr />
<div>{{GrahamUpdate}}<br />
<!--checked2016--><br />
{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
==On the Graham national system==<br />
The module setup on the new national systems general purpose systems Graham and Cedar are slightly different from other SHARCNET systems. The module loading procedures introduce more automation of dependency interactions.<br />
<br />
On the Graham system the user simply needs to call the "module load" command without manually unloading conflicting packages.<br />
<br />
$ module load octave/4.2.1<br />
<br />
To obtain information about the package's dependencies the "spider" action can be included in the call to "module":<br />
<br />
<pre><br />
$ module spider octave<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave:<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Versions:<br />
octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
For detailed information about a specific "octave" module (including how to load the modules) use the module's full name.<br />
For example:<br />
<br />
$ module spider octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
<br />
<br />
<br />
[jdesjard@gra-login1 ~]$ module spider octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave: octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Properties:<br />
Tools for development / Outils de développement<br />
<br />
You will need to load all module(s) on any one of the lines below before the "octave/4.2.1" module is available to load.<br />
<br />
nixpkgs/16.09 gcc/5.4.0<br />
nixpkgs/16.09 intel/2016.4<br />
nixpkgs/16.09 intel/2017.1<br />
<br />
Help:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
</pre><br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
<br />
==On the Graham national system==<br />
<br />
The Graham national system uses the Slurm scheduler which is different from the Torque Moab scheduler that is typical to the majority of other SHARCNET systems. In order to submit a simple "Hellow World!" process to Graham the user would first need to create a submit script as follows.<br />
<br />
$ cat oct_serial.sh <br />
#!/bin/bash<br />
#SBATCH -t 0-00:01<br />
#SBATCH --mem=400<br />
octave --eval 'disp("Hello World! from Octave")'<br />
<br />
Then pass this submit script to "sbatch" to be entered into the queue:<br />
<br />
$ sbatch --account=accountname oct_serial.sh<br />
<br />
... where "accountname" is the name of the accounting group to submit to (e.g. def-groupname, rgg-projectname).<br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.<br />
<br />
==One the Graham nation system==<br />
<br />
Rather than dedicated development as it typical on some of the other SHARCNET systems the national systems have nodes that prioritize interactive jobs allocated by call to "salloc" of the Slurm scheduler.<br />
<br />
To use Octave interactively on Graham you can do the following:<br />
<br />
Use salloc to request a single task for one hour:<br />
<br />
$ salloc --account=def-roxa88 --time=1:0:0 --ntasks=1<br />
<br />
Then you will receive notification when the reservation is granted (including jobid), for<br />
example:<br />
<br />
salloc: Granted job allocation 12345<br />
<br />
Then use srun to start a terminal to work in on the reservation:<br />
<br />
$ srun --wait 0 --pty bash<br />
<br />
Once running the terminal in the allocation you can start your work with Octave by loading<br />
the module and starting the program:<br />
<br />
<pre><br />
$ module load octave<br />
$ octave<br />
octave: X11 DISPLAY environment variable not set<br />
octave: disabling GUI features<br />
GNU Octave, version 4.2.1<br />
Copyright (C) 2017 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-pc-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1><br />
<br />
</pre><br />
<br />
... Then once you have the "octave:#>" prompt the terminal will behave like the Matlab<br />
command line.<br />
<br />
Once you are finished with Octave use "quit" to exit the program, then "exit" to logout of<br />
the compute node (terminate srun), then "exit" again to terminate the allocation<br />
(relinquishing the allocate resources).<br />
<br />
=Running on a visualization system=<br />
<br />
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu > Eduction > GNU Octave.<br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
In order to run Octave so that it interprets scripts as closely as possible to Matlab, use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:<br />
<br />
sqsub -r 60m -o ofile.%J octave --traditional mycode.m<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=MKL&diff=16016MKL2017-11-02T13:52:55Z<p>Jdesjard: </p>
<hr />
<div>{{Template:GrahamUpdate}}<br />
{{Software<br />
|package_name=MKL<br />
|package_description=Intel Math Kernel Library<br />
|package_idnumber=89<br />
}}<br />
<br />
===Introduction===<br />
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded<br />
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality<br />
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,<br />
ScaLAPACK, BLACS, PBLAS, FFT. <br />
<br />
===Version Selection===<br />
<br />
Presently the version of MKL 10.3.9 is the default and its module (mkl/10.3.9) is loaded automatically when you login. Version 11.1.4 is also available (mkl/11.1.4)<br />
<br />
Later versions of MKL are bundled with the Intel compiler. You can still load them separately (for use with different compiler) by loading modules: intel/mkl/15.0.3, intel/mkl/15.0.6, intel/mkl/16.0.3.<br />
<br />
More details about module usage can be found here:<br />
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules<br />
<br />
===Job Submission ===<br />
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.<br />
See the next section which illustrates this procedure.<br />
<br />
===Examples of Job Compilation===<br />
We are assuming that the following modules are currently loaded: mkl/10.3.9 intel/12.1.3<br />
<br />
==== Fortran DGEMM example====<br />
Use following command to compile file test_dgemm.f90:<br />
<br />
<source lang="bash"><br />
$FC test_dgemm.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -lpthread -lm -openmp<br />
</source><br />
<br />
where<br />
<br />
<source lang="fortran"><br />
! file name = test_dgemm.f90<br />
<br />
program mainp1<br />
implicit none<br />
integer, parameter :: HEIGHT=4<br />
integer, parameter :: WIDTH=3<br />
integer, parameter :: K=1<br />
integer :: i, j<br />
double precision :: ColumnVector(HEIGHT,K)<br />
double precision :: RowVector(K,WIDTH)<br />
double precision :: Result(HEIGHT,WIDTH)<br />
double precision :: ALPHA, BETA<br />
character*1 :: NoTrans<br />
<br />
ALPHA = 1.0e0<br />
BETA = 0.0e0<br />
<br />
do i=1,HEIGHT<br />
ColumnVector(i,K) = i<br />
enddo<br />
<br />
do j=1,WIDTH<br />
RowVector(K,j) = j<br />
enddo<br />
<br />
call PrintMatrix(ColumnVector, HEIGHT,K)<br />
call PrintMatrix(RowVector, K, WIDTH)<br />
<br />
! To do the calculation, we will use the BLAS function dgemm. <br />
! This function calculates: C = ALPHA*A*B + BETA*C <br />
<br />
NoTrans = 'N'<br />
<br />
call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA, &<br />
& ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)<br />
<br />
call PrintMatrix(Result, HEIGHT, WIDTH)<br />
stop<br />
end<br />
<br />
subroutine PrintMatrix(pMatrix,nRows,nCols)<br />
implicit none<br />
integer :: i, j, nRows, nCols<br />
double precision :: pMatrix(nRows,nCols)<br />
<br />
do i=1,nRows<br />
do j=1,nCols<br />
print *,i,j,pMatrix(i,j)<br />
enddo<br />
enddo<br />
<br />
print *," "<br />
return<br />
end<br />
<br />
</source><br />
<br />
==== Fortran ZDOTC example====<br />
Use following command to compile:<br />
<br />
<source lang="bash"><br />
$FC fortran_zdotc.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread<br />
</source><br />
<br />
where <br />
<br />
<source lang="fortran"><br />
! file name = fortran_zdotc.f90<br />
<br />
program fortran_zdotc<br />
implicit none<br />
<br />
integer, parameter :: NN=5<br />
integer :: n, inca, incb<br />
integer :: i<br />
<br />
DOUBLE COMPLEX :: ZX(0:NN-1),ZY(0:NN-1),ZDPXY,ZDPYX,ZDOTC<br />
REAL*8 :: Di, Dn<br />
<br />
inca = 1<br />
incb = 1<br />
<br />
n = NN<br />
Dn = DBLE(n)<br />
<br />
print *,""<br />
<br />
DO i=0,n-1<br />
Di = i<br />
ZX(i) = CMPLX(Di,2.0D0*Di)<br />
ZY(i) = CMPLX(Dn-Di,2.0D0*Di)<br />
write(6,1001) ZX(i),ZY(i)<br />
1001 format("(",f6.2,",",f6.2,") (",f6.2,",",f6.2,")")<br />
END DO<br />
<br />
ZDPXY = ZDOTC(n,ZX,inca,ZY,incb)<br />
ZDPYX = ZDOTC(n,ZY,incb,ZX,inca)<br />
<br />
1002 format("(",f6.2,",",f6.2,")")<br />
print *,""<br />
print *,"<ZX,ZY>"<br />
write(6,1002) ZDPXY<br />
<br />
print *,""<br />
print *,"<ZY,ZX>"<br />
write(6,1002) ZDPYX<br />
print *,""<br />
<br />
print *,"Job completed successfully"<br />
print *,""<br />
<br />
end program fortran_zdotc<br />
</source><br />
<br />
<br />
==== C ZDOTC example====<br />
Use following command to compile: <br />
<br />
<source lang="bash"><br />
$CC main_zdotc.c -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread<br />
</source><br />
<br />
where<br />
<br />
<source lang="c"><br />
/* file name = main_zdotc.c */<br />
<br />
/* The following example illustrates a call from a C program to the <br />
* complex BLAS Level 1 function zdotc(). This function computes <br />
* the dot product of two double-precision complex vectors. <br />
<br />
DOT_PRODUCT = <ZX,ZY> = SUM[i=0,i=n-1] { DCONJG(ZX(I)) * ZY(I) }<br />
------------- * ----<br />
Note that <ZX,ZY> = DCONJG(<ZY,ZX>)<br />
<br />
See: http://www2.math.umd.edu/~hking/Hermitian.pdf<br />
<br />
* In this example, the complex dot product is returned in the structure c. <br />
*/<br />
<br />
#include "mkl.h"<br />
#define N 5 <br />
<br />
void zdotc();<br />
<br />
int main() {<br />
int n, inca = 1, incb = 1, i;<br />
<br />
int DEBUG=1;<br />
<br />
/* typedef struct {...} MKL_Complex16; defined in "mkl.h" */<br />
<br />
MKL_Complex16 a[N], b[N], c, d;<br />
n = N;<br />
<br />
printf("\n");<br />
<br />
for ( i = 0; i < n; i++ ){<br />
a[i].real = (double)i;<br />
a[i].imag = (double)i * 2.0;<br />
<br />
b[i].real = (double)(n - i);<br />
b[i].imag = (double)i * 3.0;<br />
<br />
printf(" ( %6.2f, %6.2f) ( %6.2f, %6.2f) \n",a[i].real,a[i].imag,b[i].real,b[i].imag);<br />
}<br />
<br />
zdotc( &c, &n, a, &inca, b, &incb );<br />
zdotc( &d, &n, b, &incb, a, &inca ); <br />
<br />
printf("\n");<br />
printf("The complex dot product a|b is: ( %6.2f, %6.2f) \n", c.real, c.imag );<br />
printf("The complex dot product b|a is: ( %6.2f, %6.2f) \n", d.real, d.imag );<br />
printf("\n");<br />
printf("Job completed successfully\n");<br />
printf("\n");<br />
<br />
}<br />
</source><br />
<br />
<!-- <U>COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT</U><br />
<br />
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension <b>xyz</b> can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:<br />
<br />
<pre>compile program.xyz -llapack</pre><br />
<br />
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:<br />
<br />
<pre><br />
ssh kraken.sharcnet.ca<br />
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f<br />
compile dgetrf_example.f -llapack<br />
./a.out<br />
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected <br />
</pre><br />
--><br />
<br />
===General Notes===<br />
<br />
====COMPILING WITH MKL - USING ONLINE LINK ADVISOR====<br />
<br />
More generally (on any SHARCNET cluster) the <i>Intel Math Kernel Library Link Line Advisor</i> http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL. For instance, to determine the link arguments for the MKL version 10.3, Linux Operating System, Intel Compiler, Intel (R) 64 architecture, Static Linking, 32 bit Integers, sequential version of MKL, ScaLAPACK library, and OpenMPI, the MKL Link Line Advisor would return the following linking recomendation (the syntax below would go into your [[Make utility and makefiles|Makefile]]):<br />
<br />
<pre><br />
$(MKLROOT)/lib/intel64/libmkl_scalapack_lp64.a -Wl,--start-group $(MKLROOT)/lib/intel64/libmkl_intel_lp64.a $(MKLROOT)/lib/intel64/libmkl_core.a $(MKLROOT)/lib/intel64/libmkl_sequential.a -Wl,--end-group $(MKLROOT)/lib/intel64/libmkl_blacs_openmpi_lp64.a -lpthread -lm<br />
</pre><br />
<br />
and the following recommendation for locating the include files<br />
<br />
<pre><br />
-I$(MKLROOT)/include<br />
</pre><br />
<br />
The $(MKLROOT) will already be set for you by the MKL module which is currently loaded. The above case is the one applicable on most SHARCNET clusters.<br />
<br />
====Using The ILP64 Vs LP64 Variants Of MKL====<br />
<br />
You should use Intel MKL ilp64 in following cases.<br><br />
1. If you are using huge data arrays (indexing exceeds 2^32-1)<br><br />
2. If you enable FORTRAN code with the /4I8 compiler option<br><br />
<br />
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type. Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.<br />
<br />
====Support for Third-Party Interfaces====<br />
<br />
<b>o GMP Functions</b><br><br />
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this <a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'>link</a>. If you currently use the GMP library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.<br />
<br />
==== FFTW Interface Support====<br />
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters. Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:<br />
<pre><br />
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls<br />
blas95 fftw2xc fftw2x_cdft fftw2xf fftw3xc fftw3xf lapack95<br />
<br />
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls<br />
fftw3.f fftw_f77.i fftw_mpi.h rfftw.h rfftw_threads.h<br />
fftw3.h fftw.h fftw_threads.h rfftw_mpi.h<br />
</pre><br />
<br />
The wrappers can be used for calling the Intel ~<i>equivilent</i>~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document <a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'>FFTW to Intel® Math Kernel Library Wrappers Technical User Notes</a> its mentions that "FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library." By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:<br />
<br />
<pre><br />
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree<br />
.<br />
|-- ilp64<br />
| |-- libfftw2xc_intel.a<br />
| |-- libfftw2xf_intel.a<br />
| |-- libfftw3xc_intel.a<br />
| |-- libfftw3xf_intel.a<br />
| |-- libmkl_blas95.a<br />
| |-- libmkl_lapack95.a<br />
| |-- mkl77_lapack.mod<br />
| |-- mkl77_lapack1.mod<br />
| |-- mkl95_blas.mod<br />
| |-- mkl95_lapack.mod<br />
| `-- mkl95_precision.mod<br />
`-- lp64<br />
|-- libfftw2xc_intel.a<br />
|-- libfftw2xf_intel.a<br />
|-- libfftw3xc_intel.a<br />
|-- libfftw3xf_intel.a<br />
|-- libmkl_blas95.a<br />
|-- libmkl_lapack95.a<br />
|-- mkl77_lapack.mod<br />
|-- mkl77_lapack1.mod<br />
|-- mkl95_blas.mod<br />
|-- mkl95_lapack.mod<br />
`-- mkl95_precision.mod<br />
</pre><br />
<br />
====Introduction to Using the MKL FFT====<br />
<br />
Intel markets two implementations of the FFT. The first being from <a href='http://software.intel.com/en-us/intel-mkl/'>MKL</a> and the other from <a href='http://software.intel.com/en-us/intel-ipp/'>IPP</a> whose differences are described <a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'>here</a>. Only the MKL version is installed on SHARCNET.<br />
<br />
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively. These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the <a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'>Table “FFT Functions in Intel MKL”</a>. Intel describes howto use these functions in their <a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'>Fourier Transform Functions Code Examples</a> document which also covers multi-threading aspects.<br />
<br />
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under <i>/opt/sharcnet/intel/11.0.083/ifc/mkl/examples</i> where the fortran samples are contained in the <i>dftf</i> sub-directory while the c program samples are contained in the <i>dftc</i> sub-directory. The problem demonstrated here is from the source <i>complex_2d_double_ex1.f90</i> which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace. Steps to run this program are as follows:<br />
<br />
1) Copy the example directory to a test directory in your account with:<br><br />
<pre><br />
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf /scratch/myusername/dftfdemo<br />
cd /scratch/myusername/dftfdemo<br />
</pre><br />
<br />
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.<br />
<pre><br />
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2>&1 | tee myMake.out<br />
</pre><br />
<br />
3) The built output appears as follows, where you will note the first step is to compile <b>mkl_dfti.f90</b> into a module which is then used in the program on line 42 where the statement <i>Use MKL_DFTI</i> can be seen vizzz:<br />
<br />
<pre><br />
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2>&1 | tee myMake.out<br />
rm -fr *.o *.mod<br />
make mkl_dfti.o dfti_example_support.o dfti_example_status_print.o complex_2d_double_ex1.res _IA=64 EXT=a RES_EXT=lib<br />
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'<br />
mkdir -p ./_results/intel_ia64_parallel_64_lib<br />
ifort -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o<br />
mkdir -p ./_results/intel_ia64_parallel_64_lib<br />
ifort -w -c source/dfti_example_support.f90 -o dfti_example_support.o<br />
mkdir -p ./_results/intel_ia64_parallel_64_lib<br />
ifort -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o<br />
mkdir -p ./_results/intel_ia64_parallel_64_lib<br />
ifort -w mkl_dfti.o dfti_example_support.o dfti_example_status_print.o source/complex_2d_double_ex1.f90 -L"/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64"<br />
"/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64"/libmkl_intel_lp64.a -Wl,--start-group "/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64"/libmkl_intel_thread.a<br />
"/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64"/libmkl_core.a -Wl,--end-group -L"/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64" -liomp5 -lpthread -o<br />
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out<br />
export<br />
LD_LIBRARY_PATH="/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64":/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$<br />
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out <data/complex_2d_double_ex1.d >_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res<br />
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'<br />
</pre><br />
<br />
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called <i>complex_2d_double_ex1.res</i> which gets created.<br />
<br />
<pre><br />
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res<br />
COMPLEX_2D_DOUBLE_EX1<br />
Forward-Backward 2D complex transform for double precision data<br />
<br />
Configuration parameters:<br />
<br />
DFTI_FORWARD_DOMAIN = DFTI_COMPLEX<br />
DFTI_PRECISION = DFTI_DOUBLE <br />
DFTI_DIMENSION = 2<br />
DFTI_LENGTHS = { 5, 3}<br />
DFTI_PLACEMENT = DFTI_INPLACE<br />
DFTI_INPUT_STRIDES = { 0, 1, 15}<br />
DFTI_FORWARD_SCALE = 1.0 <br />
DFTI_BACKWARD_SCALE = 1.0/real(m*n)<br />
<br />
<br />
INPUT vector X (2D columns)<br />
( 0.729, 0.486) ( -0.865, -0.577) ( -0.278, -0.186)<br />
( 0.787, 0.525) ( 0.839, 0.559) ( -0.586, -0.391)<br />
( 0.122, 0.081) ( -0.741, -0.494) ( -0.794, -0.529)<br />
( -0.655, -0.437) ( 0.580, 0.387) ( -0.866, -0.577)<br />
( -0.830, -0.554) ( -0.371, -0.247) ( -0.791, -0.527)<br />
<br />
Compute DftiComputeForward<br />
<br />
Forward OUTPUT vector X (2D columns)<br />
( -3.720, -2.480) ( 3.681, -0.995) ( 0.497, 3.780)<br />
( 2.932, -1.810) ( 1.422, 0.044) ( 3.078, -1.928)<br />
( 1.115, -2.479) ( -2.040, 1.814) ( 3.144, 1.228)<br />
( -1.859, 1.982) ( 2.343, 2.430) ( 0.890, -2.581)<br />
( -0.543, 3.403) ( -0.596, 3.583) ( 0.588, 1.295)<br />
<br />
Compute DftiComputeBackward<br />
<br />
Backward OUTPUT vector X (2D columns)<br />
( 0.729, 0.486) ( -0.865, -0.577) ( -0.278, -0.186)<br />
( 0.787, 0.525) ( 0.839, 0.559) ( -0.586, -0.391)<br />
( 0.122, 0.081) ( -0.741, -0.494) ( -0.794, -0.529)<br />
( -0.655, -0.437) ( 0.580, 0.387) ( -0.866, -0.577)<br />
( -0.830, -0.554) ( -0.371, -0.247) ( -0.791, -0.527)<br />
<br />
ACCURACY = 0.248253E-15<br />
TEST PASSED<br />
</pre><br />
<br />
====Intel MKL Examples====<br />
<br />
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:<br />
<br />
<pre>cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER</pre><br />
<br />
Then each example can be compiled by going into any example directory and executing:<br />
<br />
<pre>make soem64t</pre><br />
<br />
==References==<br />
<br />
o Intel Math Kernel Library Documentation (current release)<br><br />
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm<br />
<br />
o Intel Math Kernel Library Documentation Home (latest release)<br><br />
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/<br />
<br />
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler<br><br />
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/<br />
<br />
o Known Limitiation In Mkl 10.1 For Linux<br><br />
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/<br />
<br />
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &Fortran and C/C++ Calls<br><br />
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/<br />
<br />
o Using the ILP64 Interface vs. LP64 Interface<br><br />
https://software.intel.com/en-us/node/528682<br />
<br />
o Use of Intel MKL data types in C/C++ applications<br><br />
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications<br />
<br />
o Working with the Intel® Math Kernel Library Cluster Software<br><br />
https://software.intel.com/en-us/node/528420</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=NIX&diff=16009NIX2017-11-02T13:14:43Z<p>Jdesjard: </p>
<hr />
<div>{{Template:GrahamUpdate}}<br />
{{Software<br />
|package_name=NIX<br />
|package_description=User Level Purely Functional Package Manager<br />
|package_idnumber=171<br />
}}<br />
<br />
= Introduction =<br />
<br />
Nix is a package manager system that allows users to manage their own software environment. This environment is persistent and is shared across all clusters.<br />
<br />
* Users can build, install, upgrade, downgrade, and remove packages from their environment without root privileges and without affecting other users.<br />
* Operations either succeed and create a new environment or fail leaving the previous environment in place (operations are atomic).<br />
* Previous environments can be switched back to at any point.<br />
* Users can add their own packages and share them with other users.<br />
<br />
The default Nix package set includes a huge selection (over 10,000) of recent versions of many packages.<br />
== Enabling and disabling the Nix environment ==<br />
<br />
The user's current Nix environment is enabled by loading the nix module. This creates some ''.nix*'' files and sets some environment variables.<br />
<br />
<pre class="sh">module load nix<br />
ls -ld .nix*<br />
env | fgrep -i nix</pre><br />
It is disabled by unloading the nix module. This unsets the environment variables but leaves the ''.nix*'' files alone.<br />
<br />
<pre class="sh">module unload nix<br />
ls -ld .nix*<br />
env | fgrep -i nix<br />
module load nix</pre><br />
<br />
= Installing and remove packages =<br />
<br />
The <code>nix-env</code> command is used to setup your Nix environment.<br />
== What do I have installed and what can I install ==<br />
<br />
Lets first see what we currently have installed.<br />
<br />
<nowiki>nix-env --query</nowiki><br />
Now let's see what is available. We request the attribute paths (unambiguous way of specifying a package) and the descriptions too (cursor to the right to see them). This takes a bit of time as it visits a lot of small files. Especially over NFS it can be a good idea to pipe it to a file and then grep that in the future.<br />
<br />
<nowiki>nix-env --query --available --attr-path --description</nowiki><br />
== Installing packages ==<br />
<br />
Let's say that we need a newer version of git than provided by default on our OS (e.g., the CentOS 6 one has issues with fetching over https). First lets check what our OS comes with.<br />
<br />
<nowiki>git --version<br />
which git</nowiki><br />
Let's tell Nix to install its version in our environment.<br />
<br />
<nowiki>nix-env --install --attr nixpkgs.git<br />
nix-env --query</nowiki><br />
Let's checkout what we have now (it may be necessary to tell bash to to forget remembered executable locations with <code>hash -r</code> so it notices the new one).<br />
<br />
<nowiki>git --version<br />
which git</nowiki><br />
== Removing packages ==<br />
<br />
For completeness, lets add in the other usual version-control suspects.<br />
<br />
<nowiki>nix-env --install --attr nixpkgs.subversion nixpkgs.mercurial<br />
nix-env --query</nowiki><br />
Actually, we probably don't really want subversion any more. Let's remove that.<br />
<br />
<nowiki>nix-env --uninstall subversion<br />
nix-env --query</nowiki><br />
= Environments =<br />
<br />
Nix keeps referring to user environments. Each time we install or remove packages we create a new environment based off of the previous environment.<br />
== Switching between previous environments ==<br />
<br />
This means the previous environments still exist and we can switch back to them at any point. Let's say we changed our mind and want subversion back. It's trivial to restore the previous environment.<br />
<br />
<nowiki>nix-env --rollback<br />
nix-env --query</nowiki><br />
Of course we may want to do more than just move to the previous environment. We can get a list of all our environments so far and then jump directly to whatever one we want. Let's undo the rollback.<br />
<br />
<nowiki>nix-env --list-generations<br />
nix-env --switch-generation 4<br />
nix-env --query</nowiki><br />
== Operations are atomic ==<br />
<br />
Due to the atomic property of Nix environments, we can't be left halfway through installing/updating packages. They either succeed and create us a new environment or leave us with the previous one intact.<br />
<br />
Let's go back to the start when we just had Nix itself and install the one true GNU distributed version control system tla. Don't let it complete though. Hit it with <code>CTRL+c</code> partway through.<br />
<br />
<nowiki>nix-env --switch-generation 1<br />
nix-env --install --attr nixpkgs.tla</nowiki><br />
<blockquote>CTRL+c<br />
</blockquote><br />
Nothing bad happens. The operation didn't complete so it has no effect on the environment whatsoever.<br />
<br />
<nowiki>nix-env --query<br />
nix-env --list-generations</nowiki><br />
== Nix only does things once ==<br />
<br />
The install and remove commands take the current environment and create a new environment with the changes. This works regardless of which environment we are currently in. Let's create a new environment from our original environment by just adding git and mercurial.<br />
<br />
<nowiki>nix-env --list-generations<br />
nix-env --install nixpkgs.git nixpkgs.mercurial<br />
nix-env --list-generations</nowiki><br />
Notice how much much faster it was to install git and mercurial the second time? That is because the software already existed in the local Nix store from the previous installs so Nix just reused it.<br />
== Garbage collection ==<br />
<br />
Nix periodically goes through and removes any software not accessible from any existing environments. This means we have to explicitly delete environments we don't want anymore so Nix is able to reclaim the space. We can delete specific environments or any sufficiently old.<br />
<br />
<nowiki>nix-env --delete-generations 30d</nowiki><br />
= Using channels to obtain Nix expressions =<br />
<br />
Nix packages are Nix expressions that specify how to build something. The default source for of these expression for <code>nix-env</code> is ''~/.nix-defexp'' and ''~/.nix-defexp/channels''. Nix channels provide a way to populate this later directory with existing expressions from repositories on the internet.<br />
== Subscribing to a channel ==<br />
<br />
By default we are subscribed to the SHARCNET version of the latest NixOS release under the name nixpkg. Let us add the older NixOS 15.09 release too under the name nixpkgs_old and then download the latest versions of all NixOS 15.09 the expressions.<br />
<br />
<nowiki>nix-channel --list<br />
nix-channel --add file:///nix/channels/sharcnet-15.09 nixpkgs_old<br />
nix-channel --list<br />
nix-channel --update nixpkgs_old</nowiki><br />
== Installing packages from a channel ==<br />
<br />
Now searching our available packages we see that we can install software using either the nixpkgs or nixpkgs_old expressions.<br />
<br />
<nowiki>nix-env --query --available --attr-path --description git</nowiki><br />
Let's replace our git built and installed from the unstable (nixpkgs) expression with one built and installed from the stable expression (note that git is the default version of git which is gitMinimal).<br />
<br />
<nowiki>nix-env --install --attr nixpkgs_old.git<br />
nix-env --query<br />
git --version</nowiki><br />
== What about dependency conflicts ==<br />
<br />
There are no issues with having a mix of packages installed from different sources even if they have conflicting dependencies. Nix puts each package in a separate directory under ''/nix/store'' versioned by the hash of the its build instructions. Binaries are linked with rpaths to ensure they always find the versions they need.<br />
<br />
<nowiki>ldd $(readlink ($which git))</nowiki><br />
Switching between environments continue to work as before.<br />
<br />
<nowiki>nix-env --rollback<br />
git --version<br />
nix-env --list-generations<br />
nix-env --switch-generation 5<br />
git --version</nowiki><br />
== Switching between previous updates ==<br />
<br />
The channel updates (updating the list of expressions we can build and install from) are also atomic and versioned. This ensures we never find ourselves stuck due to accidentally updating to something broken.<br />
<br />
<nowiki>nix-channel --rollback<br />
nix-env --query --available --attr-path git<br />
nix-channel --rollback 2</nowiki><br />
= Development with Nix (e.g., Python, R, etc.) =<br />
<br />
Several languages have their own repository of packages and associated infrastructure (e.g., PyPI and pip). Nix builds on these to automatically handle the external dependencies (e.g., C libraries) and makes it easy to work simultaneously with different projects requiring different versions of internal packages.<br />
== Wrapper scripts for setting paths ==<br />
<br />
Nix has expressions for many of these that generate wrapper scripts that set path environment variables to bring a specific set of the internal packages into scope and then run the approriate program.<br />
<br />
The following Nix expression defines top-level myPython, myR, and myHaskell attributes that use the appropriate package-specific expressions to create wrappers for a selection of internal packages (for details about the Nix langauge see the [https://nixos.org/nix/manual/#ch-expression-language Nix Expression Language].<br />
<br />
<pre class="nix">with import &lt;nixpkgs&gt; { };<br />
<br />
rec {<br />
myPython = python3.buildEnv.override rec {<br />
extraLibs = with python3Packages; [ numpy scipy ];<br />
};<br />
<br />
myR = rWrapper.override rec {<br />
packages = with rPackages; [ rgeos rgdal ];<br />
};<br />
<br />
myHaskell = haskellPackages.ghcWithPackages (ghcpkgs:<br />
with ghcpkgs; [ pipes lens cabal-install ]<br />
);<br />
}</pre><br />
Saving it as ''~/.nix-defexpr/mypkgs.nix'' makes these available for installation with <code>nix-env</code>.<br />
<br />
<nowiki>nix-env --install --attr mypkgs.myPython<br />
cat $(which python3)<br />
python3</nowiki><br />
<nowiki>import scipy</nowiki><br />
<blockquote>CTRL+d<br />
</blockquote><br />
== Development environments ==<br />
<br />
A Nix expression evaluates to a specification for setting up a (build) environment and then doing a build in it. Frequently we want to do something very similar: setup a (development) environment and then do development in it.<br />
<br />
The <code>nix-shell</code> command bridges the gap between these two. It uses Nix to sets up a non-rooted (build) environment with the dependencies we specify and then laucnhes a (development) shell in it instead of a build process.<br />
<br />
<nowiki>mkdir devel<br />
cd devel</nowiki><br />
Say we need Clang and Python with the NumPy and SciPy packages. Instead of installing these into our global environment we can create a Nix expression that specifies these as build (development) inputs<br />
<br />
<pre class="nix">with import &lt;nixpkgs&gt; { };<br />
<br />
stdenv.mkDerivation {<br />
name = &quot;my-env&quot;;<br />
buildInputs = [<br />
( python3.buildEnv.override rec {<br />
extraLibs = with python3Packages; [ numpy scipy ];<br />
} )<br />
clang<br />
];<br />
}</pre><br />
save it in ''default.nix'' and then run <code>nix-shell</code>.<br />
<br />
<nowiki>nix-shell</nowiki><br />
Now we are in a build (development) environment with all the dependencies we specified in the appropriate PATHs.<br />
<br />
<nowiki>cat $(which python3)<br />
clang --version<br />
python3</nowiki><br />
<nowiki>import scipy</nowiki><br />
<blockquote>CTRL+d<br />
</blockquote><br />
To return to our standard environment we just exit the shell. This is extreamily nice if we work on many projects with conflicting dependencies.<br />
<br />
<nowiki>exit<br />
cd ..</nowiki><br />
== One-off environments ==<br />
<br />
Quite frequently we need a one-off development environment with a few packages. Say CLang and git. Rather than have to write the following boilerplate ''default.nix'' file<br />
<br />
<pre class="nix">with import &lt;nixpkgs&gt; { };<br />
<br />
stdenv.mkDerivation {<br />
name = &quot;my-env&quot;;<br />
buildInputs = [<br />
clang<br />
git<br />
];<br />
}</pre><br />
we can just get <code>nix-shell</code> to do it for us.<br />
<br />
<pre class="sh">nix-shell --packages clang git</pre><br />
<blockquote>CTRL+d<br />
</blockquote><br />
<br />
= Submitting Jobs =<br />
<br />
Loading the Nix module before submitting a job makes the Nix environment available to the job. Note that these jobs will see the current Nix environment including any changes made after submission. Compiled binaries should not require the Nix module to be loaded to run.<br />
<br />
<pre class="sh">module load nix<br />
sqsub ...</pre><br />
= Internals =<br />
<br />
This section details some of the internals of how Nix works and how to create your own packages. It is more advanced material not required for the basic usage.<br />
== The Nix store ==<br />
<br />
A Nix environment is just a collection of symlinks to all the packages that exist in that environment.<br />
<br />
<pre class="sh">readlink $(which git)<br />
readlink -f ~/.nix-profile</pre><br />
Everything in Nix exists as a path in the Nix store. Each path is distinguished with a hash of either its contents or everything that went into creating it to keep it separate from everything else. Paths are immutable once created. This means they can be freely shared.<br />
<br />
Paths are created by the Nix build server when it realizes a Nix derivation. Nix derivations specify all the inputs to a jailed process that creates the contents of the store path.<br />
== Nix expressions and instantiation ==<br />
<br />
Nix derivations are instantiated from Nix expressions, which are written in the Nix language. The <code>nix-repl</code> program can be used to interactively experiment with the Nix language.<br />
<br />
<pre class="sh">nix-env --install --attr nix-repl<br />
nix-repl</pre><br />
The following ''cabextract.nix'' Nix expression evaluates to a derivation fully specifying how to build the <code>cabextract</code> utility.<br />
<br />
<pre class="nix">with import ~/.nix-defexpr/nixpkgs { };<br />
stdenv.mkDerivation rec {<br />
name = &quot;cabextract-1.6&quot;<br />
<br />
src = fetchurl {<br />
url = &quot;http://www.cabextract.org.uk/${name}.tar.gz&quot;;<br />
sha256 = &quot;1ysmmz25fjghq7mxb2anyyvr1ljxqxzi4piwjhk0sdamcnsn3rnf&quot;;<br />
};<br />
<br />
meta = with stdenv.lib; {<br />
homepage = http://www.cabextract.org.uk/;<br />
description = &quot;Free Software for extracting Microsoft cabinet files&quot;;<br />
platforms = platforms.all;<br />
license = licenses.gpl3;<br />
maintainers = with maintainers; [ pSub ];<br />
};<br />
}</pre><br />
It is written using the <code>stdenv.mkDerivation</code> function from <code>nixpkgs</code>. This function creates a derivation that executes the standard unpack, patch, configure, build, check, install, fixup, check, and distribute steps on the package. It provides a series of hooks that can be used at each step to customize the process for non-standard packages. For full details see the [https://nixos.org/nixpkgs/manual nixpkgs manual].<br />
<br />
The Nix expression is instantiate to a derivation using <code>nix-instantiate</code>. The leading ''./'' is required to distinguish that the arguments is file containing a Nix expression to be instantiated and not the name of a package in the default Nix expression to instantiate.<br />
<br />
<pre class="sh">cabdrv=$(nix-instantiate ./cabextract.nix)<br />
echo $cabdrv</pre><br />
<br />
== Nix derivations and realization ==<br />
<br />
The Nix derivation instantiated from the above Nix expression can be pretty-printed using the <code>pp-aterm</code> program.<br />
<br />
<pre class="sh">nix-env --install --attr nixpkgs.strategoPackages.strategoxt<br />
pp-aterm -i $cabdrv</pre><br />
<pre>Derive(<br />
[(&quot;out&quot;, &quot;/home/nixbld/store/...-cabextract-1.6&quot;, &quot;&quot;, &quot;&quot;)]<br />
, [ (&quot;/home/nixbld/store/...-stdenv.drv&quot;, [&quot;out&quot;])<br />
, (&quot;/home/nixbld/store/...-cabextract-1.6.tar.gz.drv&quot;, [&quot;out&quot;])<br />
, (&quot;/home/nixbld/store/...-bash-4.3-p42.drv&quot;, [&quot;out&quot;])<br />
]<br />
, [&quot;/home/nixbld/store/...-default-builder.sh&quot;]<br />
, &quot;x86_64-linux&quot;<br />
, &quot;/home/nixbld/store/...-bash-4.3-p42/bin/bash&quot;<br />
, [&quot;-e&quot;, &quot;...-default-builder.sh&quot;]<br />
, [ (&quot;buildInputs&quot;, &quot;&quot;)<br />
, (&quot;builder&quot;, &quot;/home/nixbld/store/...-bash-4.3-p42/bin/bash&quot;)<br />
, (&quot;name&quot;, &quot;cabextract-1.6&quot;)<br />
, (&quot;nativeBuildInputs&quot;, &quot;&quot;)<br />
, (&quot;out&quot;, &quot;/home/nixbld/store/...-cabextract-1.6&quot;)<br />
, (&quot;propagatedBuildInputs&quot;, &quot;&quot;)<br />
, (&quot;propagatedNativeBuildInputs&quot;, &quot;&quot;)<br />
, (&quot;src&quot;, &quot;/home/nixbld/store/...-cabextract-1.6.tar.gz&quot;)<br />
, (&quot;stdenv&quot;, &quot;/home/nixbld/store/...-stdenv&quot;)<br />
, (&quot;system&quot;, &quot;x86_64-linux&quot;)<br />
]<br />
)</pre><br />
The Nix build server realizes derivations by building the packages in an isolated environment. Each derivation specifies what comes out of the environment, what goes into it, the required machine architecture, what build program to execute in the environment, and what arguments and environment to pass to the program to be executed.<br />
<br />
The <code>nix-store</code> program <code>--realize</code> option is used to signal the build server to realize the derivation.<br />
<br />
<pre class="sh">cabpath=$(nix-store --realize $cabdrv)<br />
echo $cabpath</pre><br />
The <code>nix-env</code> program will add the realized derivation to the users environment with the <code>--install</code> (<code>-i</code>) option. Technically it creates a new realization of the <code>user-environment</code> package that symlinks in the entire contents of the path path and switches to it.<br />
<br />
<pre class="sh">nix-env --install $cabpath</pre><br />
The build log associated with a realization can be viewed with the <code>--read-log</code> (<code>-l</code>) option.<br />
<br />
<pre class="sh">nix-store --read-log $cabdrv<br />
nix-store --read-log $cabpath<br />
nix-store --read-log $(which git)</pre><br />
The <code>nix-store</code> program also supports numerous other store related items such as computing the transitive closure of a package with the <code>--query</code> (<code>-q</code>) <code>--requisites</code> (<code>-R</code>) and exporting them via the <code>--export</code> option to a Nix archive for import into another store.<br />
<br />
<pre class="sh">nix-store --query --requisites $cabpath<br />
nix-store --export $(nix-store --query --requisites $(which git)) | gzip &gt; git.nar.gz</pre><br />
== Nix default expression ==<br />
<br />
Nix has a default expression created from the contents of ''~/.nix-defexpr''. The <code>nix-env</code> <code>--install</code> operation normally works by selecting an attribute in this expression (fast) or matching against the <code>name</code> attribute in all the attributes in this expression (slow) to determine an expression to instantiate, realize, and then symlink into a new environment.<br />
<br />
The <code>nix-channel</code> command works by building new Nix expression packages (containing all the Nix expressions for the subscribed channels) and symlinking ''~/.nix-defexprs/channels'' to then. Adding additional expressions to ''~/.nix-defexpr'' makes them available for use with <code>nix-env</code> as well. For example, the following ''~/.nix-defexpr/mypkgs'' expression packages up the above ''cabextract.nix'' example.<br />
<br />
<pre class="nix">args@{ ... }: with import ./nixpkgs args;<br />
rec {<br />
cabextract = stdenv.mkDerivation rec {<br />
name = &quot;cabextract-1.6&quot;;<br />
<br />
src = fetchurl {<br />
url = &quot;http://www.cabextract.org.uk/${name}.tar.gz&quot;;<br />
sha256 = &quot;1ysmmz25fjghq7mxb2anyyvr1ljxqxzi4piwjhk0sdamcnsn3rnf&quot;;<br />
};<br />
<br />
meta = with stdenv.lib; {<br />
homepage = http://www.cabextract.org.uk/;<br />
description = &quot;Free Software for extracting Microsoft cabinet files&quot;;<br />
platforms = platforms.all;<br />
license = licenses.gpl3;<br />
maintainers = with maintainers; [ pSub ];<br />
};<br />
};<br />
}</pre><br />
This makes it possible to install packages from <code>mypkgs</code> as easily as those from the official <code>nixpkgs</code>.<br />
<br />
<pre class="sh">nix-env --install --attr mypkgs.cabextract</pre><br />
=References=<br />
<br />
o Nix Package Manager<br><br />
http://nixos.org/nix/<br />
<br />
o Official Nix/Nixpkgs/NixOS<br><br />
https://github.com/NixOS<br />
<br />
o Nix on SHARCNET (slides by Tyson Whitehead)<br><br />
https://www.sharcnet.ca/help/images/5/5f/Tyson_nix_2015.pdf<br />
<br />
o Exploring a new approach to package management (youtube video by Tyson Whitehead)<br><br />
https://www.youtube.com/watch?v=pQE9WTLAPHQ</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=15337OCTAVE2017-07-11T15:11:39Z<p>Jdesjard: /* Running in the development nodes */</p>
<hr />
<div><!--checked2016--><br />
{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
==On the Graham national system==<br />
The module setup on the new national systems general purpose systems Graham and Cedar are slightly different from other SHARCNET systems. The module loading procedures introduce more automation of dependency interactions.<br />
<br />
On the Graham system the user simply needs to call the "module load" command without manually unloading conflicting packages.<br />
<br />
$ module load octave/4.2.1<br />
<br />
To obtain information about the package's dependencies the "spider" action can be included in the call to "module":<br />
<br />
<pre><br />
$ module spider octave<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave:<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Versions:<br />
octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
For detailed information about a specific "octave" module (including how to load the modules) use the module's full name.<br />
For example:<br />
<br />
$ module spider octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
<br />
<br />
<br />
[jdesjard@gra-login1 ~]$ module spider octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave: octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Properties:<br />
Tools for development / Outils de développement<br />
<br />
You will need to load all module(s) on any one of the lines below before the "octave/4.2.1" module is available to load.<br />
<br />
nixpkgs/16.09 gcc/5.4.0<br />
nixpkgs/16.09 intel/2016.4<br />
nixpkgs/16.09 intel/2017.1<br />
<br />
Help:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
</pre><br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
<br />
==On the Graham national system==<br />
<br />
The Graham national system uses the Slurm scheduler which is different from the Torque Moab scheduler that is typical to the majority of other SHARCNET systems. In order to submit a simple "Hellow World!" process to Graham the user would first need to create a submit script as follows.<br />
<br />
$ cat oct_serial.sh <br />
#!/bin/bash<br />
#SBATCH -t 0-00:01<br />
#SBATCH --mem=400<br />
octave --eval 'disp("Hello World! from Octave")'<br />
<br />
Then pass this submit script to "sbatch" to be entered into the queue:<br />
<br />
$ sbatch --account=myusername oct_serial.sh<br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.<br />
<br />
==One the Graham nation system==<br />
<br />
Rather than dedicated development as it typical on some of the other SHARCNET systems the national systems have nodes that prioritize interactive jobs allocated by call to "salloc" of the Slurm scheduler.<br />
<br />
To use Octave interactively on Graham you can do the following:<br />
<br />
Use salloc to request a single task for one hour:<br />
<br />
$ salloc --account=def-roxa88 --time=1:0:0 --ntasks=1<br />
<br />
Then you will receive notification when the reservation is granted (including jobid), for<br />
example:<br />
<br />
salloc: Granted job allocation 12345<br />
<br />
Then use srun to start a terminal to work in on the reservation:<br />
<br />
$ srun --wait 0 --pty bash<br />
<br />
Once running the terminal in the allocation you can start your work with Octave by loading<br />
the module and starting the program:<br />
<br />
<pre><br />
$ module load octave<br />
$ octave<br />
octave: X11 DISPLAY environment variable not set<br />
octave: disabling GUI features<br />
GNU Octave, version 4.2.1<br />
Copyright (C) 2017 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-pc-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1><br />
<br />
</pre><br />
<br />
... Then once you have the "octave:#>" prompt the terminal will behave like the Matlab<br />
command line.<br />
<br />
Once you are finished with Octave use "quit" to exit the program, then "exit" to logout of<br />
the compute node (terminate srun), then "exit" again to terminate the allocation<br />
(relinquishing the allocate resources).<br />
<br />
=Running on a visualization system=<br />
<br />
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu > Eduction > GNU Octave.<br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
In order to run Octave so that it interprets scripts as closely as possible to Matlab, use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:<br />
<br />
sqsub -r 60m -o ofile.%J octave --traditional mycode.m<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=15336OCTAVE2017-07-11T15:07:21Z<p>Jdesjard: /* On the Graham national system */</p>
<hr />
<div><!--checked2016--><br />
{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
==On the Graham national system==<br />
The module setup on the new national systems general purpose systems Graham and Cedar are slightly different from other SHARCNET systems. The module loading procedures introduce more automation of dependency interactions.<br />
<br />
On the Graham system the user simply needs to call the "module load" command without manually unloading conflicting packages.<br />
<br />
$ module load octave/4.2.1<br />
<br />
To obtain information about the package's dependencies the "spider" action can be included in the call to "module":<br />
<br />
<pre><br />
$ module spider octave<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave:<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Versions:<br />
octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
For detailed information about a specific "octave" module (including how to load the modules) use the module's full name.<br />
For example:<br />
<br />
$ module spider octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
<br />
<br />
<br />
[jdesjard@gra-login1 ~]$ module spider octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave: octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Properties:<br />
Tools for development / Outils de développement<br />
<br />
You will need to load all module(s) on any one of the lines below before the "octave/4.2.1" module is available to load.<br />
<br />
nixpkgs/16.09 gcc/5.4.0<br />
nixpkgs/16.09 intel/2016.4<br />
nixpkgs/16.09 intel/2017.1<br />
<br />
Help:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
</pre><br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
<br />
==On the Graham national system==<br />
<br />
The Graham national system uses the Slurm scheduler which is different from the Torque Moab scheduler that is typical to the majority of other SHARCNET systems. In order to submit a simple "Hellow World!" process to Graham the user would first need to create a submit script as follows.<br />
<br />
$ cat oct_serial.sh <br />
#!/bin/bash<br />
#SBATCH -t 0-00:01<br />
#SBATCH --mem=400<br />
octave --eval 'disp("Hello World! from Octave")'<br />
<br />
Then pass this submit script to "sbatch" to be entered into the queue:<br />
<br />
$ sbatch --account=myusername oct_serial.sh<br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.<br />
<br />
=Running on a visualization system=<br />
<br />
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu > Eduction > GNU Octave.<br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
In order to run Octave so that it interprets scripts as closely as possible to Matlab, use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:<br />
<br />
sqsub -r 60m -o ofile.%J octave --traditional mycode.m<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=15335OCTAVE2017-07-11T15:03:57Z<p>Jdesjard: /* Job Submission */</p>
<hr />
<div><!--checked2016--><br />
{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
==On the Graham national system==<br />
The module setup on the new national systems general purpose systems Graham and Cedar are slightly different from other SHARCNET systems. The module loading procedures introduce more automation of dependency interactions.<br />
<br />
On the Graham system the user simply needs to call the "module load" command without manually unloading conflicting packages.<br />
<br />
$ module load octave/4.2.1<br />
<br />
To obtain information about the package's dependencies the "spider" action can be included in the call to "module":<br />
<br />
<pre><br />
$ module spider octave<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave:<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Versions:<br />
octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
For detailed information about a specific "octave" module (including how to load the modules) use the module's full name.<br />
For example:<br />
<br />
$ module spider octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
<br />
<br />
<br />
[jdesjard@gra-login1 ~]$ module spider octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave: octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Properties:<br />
Tools for development / Outils de développement<br />
<br />
You will need to load all module(s) on any one of the lines below before the "octave/4.2.1" module is available to load.<br />
<br />
nixpkgs/16.09 gcc/5.4.0<br />
nixpkgs/16.09 intel/2016.4<br />
nixpkgs/16.09 intel/2017.1<br />
<br />
Help:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
</pre><br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
<br />
==On the Graham national system==<br />
<br />
The Graham national system uses the Slurm scheduler which is different from the Torque Moab scheduler that is typical to the majority of other SHARCNET systems. In order to submit a simple "Hellow World!" process to Graham the user would first need to create a submit script as follows.<br />
<br />
$ cat oct_serial.sh <br />
#!/bin/bash<br />
#SBATCH -t 0-00:01<br />
#SBATCH --mem=400<br />
octave --eval 'disp("Hello World! from Octave")'<br />
<br />
Then pass this submit script to "sbatch" to be entered into the queue:<br />
<br />
$ sbatch oct_serial.sh<br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.<br />
<br />
=Running on a visualization system=<br />
<br />
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu > Eduction > GNU Octave.<br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
In order to run Octave so that it interprets scripts as closely as possible to Matlab, use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:<br />
<br />
sqsub -r 60m -o ofile.%J octave --traditional mycode.m<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=15334OCTAVE2017-07-11T14:52:33Z<p>Jdesjard: /* Job Submission */</p>
<hr />
<div><!--checked2016--><br />
{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
==On the Graham national system==<br />
The module setup on the new national systems general purpose systems Graham and Cedar are slightly different from other SHARCNET systems. The module loading procedures introduce more automation of dependency interactions.<br />
<br />
On the Graham system the user simply needs to call the "module load" command without manually unloading conflicting packages.<br />
<br />
$ module load octave/4.2.1<br />
<br />
To obtain information about the package's dependencies the "spider" action can be included in the call to "module":<br />
<br />
<pre><br />
$ module spider octave<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave:<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Versions:<br />
octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
For detailed information about a specific "octave" module (including how to load the modules) use the module's full name.<br />
For example:<br />
<br />
$ module spider octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
<br />
<br />
<br />
[jdesjard@gra-login1 ~]$ module spider octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave: octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Properties:<br />
Tools for development / Outils de développement<br />
<br />
You will need to load all module(s) on any one of the lines below before the "octave/4.2.1" module is available to load.<br />
<br />
nixpkgs/16.09 gcc/5.4.0<br />
nixpkgs/16.09 intel/2016.4<br />
nixpkgs/16.09 intel/2017.1<br />
<br />
Help:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
</pre><br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
<br />
==On the Graham national system==<br />
<br />
The Graham national system uses the Slurm scheduler which is different from the Torque Moab scheduler that is typical to the majority of other SHARCNET systems. In order to submit a simple "Hellow World!" process to Graham the user would first need to create a submit script as follows.<br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.<br />
<br />
=Running on a visualization system=<br />
<br />
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu > Eduction > GNU Octave.<br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
In order to run Octave so that it interprets scripts as closely as possible to Matlab, use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:<br />
<br />
sqsub -r 60m -o ofile.%J octave --traditional mycode.m<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=15333OCTAVE2017-07-11T14:44:57Z<p>Jdesjard: /* Version Selection */</p>
<hr />
<div><!--checked2016--><br />
{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
==On the Graham national system==<br />
The module setup on the new national systems general purpose systems Graham and Cedar are slightly different from other SHARCNET systems. The module loading procedures introduce more automation of dependency interactions.<br />
<br />
On the Graham system the user simply needs to call the "module load" command without manually unloading conflicting packages.<br />
<br />
$ module load octave/4.2.1<br />
<br />
To obtain information about the package's dependencies the "spider" action can be included in the call to "module":<br />
<br />
<pre><br />
$ module spider octave<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave:<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Versions:<br />
octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
For detailed information about a specific "octave" module (including how to load the modules) use the module's full name.<br />
For example:<br />
<br />
$ module spider octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
<br />
<br />
<br />
[jdesjard@gra-login1 ~]$ module spider octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave: octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Properties:<br />
Tools for development / Outils de développement<br />
<br />
You will need to load all module(s) on any one of the lines below before the "octave/4.2.1" module is available to load.<br />
<br />
nixpkgs/16.09 gcc/5.4.0<br />
nixpkgs/16.09 intel/2016.4<br />
nixpkgs/16.09 intel/2017.1<br />
<br />
Help:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
</pre><br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.<br />
<br />
=Running on a visualization system=<br />
<br />
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu > Eduction > GNU Octave.<br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
In order to run Octave so that it interprets scripts as closely as possible to Matlab, use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:<br />
<br />
sqsub -r 60m -o ofile.%J octave --traditional mycode.m<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=15332OCTAVE2017-07-11T14:41:11Z<p>Jdesjard: /* Version Selection */</p>
<hr />
<div><!--checked2016--><br />
{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
==on the national system Graham==<br />
The module setup on the new national systems general purpose systems Graham and Cedar are slightly different from other SHARCNET systems. The module loading procedures introduce more automation of dependency interactions.<br />
<br />
On the Graham system the user simply needs to call the "module load" command without manually unloading conflicting packages.<br />
<br />
$ module load octave/4.2.1<br />
<br />
To obtain information about the package's dependencies the "spider" action can be included in the call to "module":<br />
<br />
<pre><br />
$ module spider octave<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave:<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Versions:<br />
octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
For detailed information about a specific "octave" module (including how to load the modules) use the module's full name.<br />
For example:<br />
<br />
$ module spider octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
<br />
<br />
<br />
[jdesjard@gra-login1 ~]$ module spider octave/4.2.1<br />
<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
octave: octave/4.2.1<br />
---------------------------------------------------------------------------------------------------------------------------------------------------------<br />
Description:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
<br />
Properties:<br />
Tools for development / Outils de développement<br />
<br />
You will need to load all module(s) on any one of the lines below before the "octave/4.2.1" module is available to load.<br />
<br />
nixpkgs/16.09 gcc/5.4.0<br />
nixpkgs/16.09 intel/2016.4<br />
nixpkgs/16.09 intel/2017.1<br />
<br />
Help:<br />
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. - Homepage: http://www.gnu.org/software/octave/<br />
</pre><br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.<br />
<br />
=Running on a visualization system=<br />
<br />
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu > Eduction > GNU Octave.<br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
In order to run Octave so that it interprets scripts as closely as possible to Matlab, use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:<br />
<br />
sqsub -r 60m -o ofile.%J octave --traditional mycode.m<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=15331OCTAVE2017-07-11T14:37:52Z<p>Jdesjard: /* Version Selection */</p>
<hr />
<div><!--checked2016--><br />
{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
==on the national system Graham==<br />
The module setup on the new national systems general purpose systems Graham and Cedar are slightly different from other SHARCNET systems. The module loading procedures introduce more automation of dependency interactions.<br />
<br />
On the Graham system the user simply needs to call the "module load" command without manually unloading conflicting packages.<br />
<br />
$ module load octave/4.2.1<br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.<br />
<br />
=Running on a visualization system=<br />
<br />
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu > Eduction > GNU Octave.<br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
In order to run Octave so that it interprets scripts as closely as possible to Matlab, use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:<br />
<br />
sqsub -r 60m -o ofile.%J octave --traditional mycode.m<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=15330OCTAVE2017-07-11T14:30:19Z<p>Jdesjard: /* Version Selection */</p>
<hr />
<div><!--checked2016--><br />
{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
==on the national system Graham==<br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.<br />
<br />
=Running on a visualization system=<br />
<br />
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu > Eduction > GNU Octave.<br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
In order to run Octave so that it interprets scripts as closely as possible to Matlab, use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:<br />
<br />
sqsub -r 60m -o ofile.%J octave --traditional mycode.m<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=File:Ccglobus_local_to_scratch.png&diff=14610File:Ccglobus local to scratch.png2017-01-16T16:30:53Z<p>Jdesjard: cc globus transfer between local computer and orca scratch.</p>
<hr />
<div>cc globus transfer between local computer and orca scratch.</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=File:Ccglobus_dtn1.png&diff=14600File:Ccglobus dtn1.png2017-01-16T15:53:18Z<p>Jdesjard: Globus portal displaying actibe computecanada#sharcnet-dtn1 Endpoint.</p>
<hr />
<div>Globus portal displaying actibe computecanada#sharcnet-dtn1 Endpoint.</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=11592OCTAVE2015-07-08T16:03:40Z<p>Jdesjard: </p>
<hr />
<div>{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.<br />
<br />
=Running on a visualization system=<br />
<br />
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu > Eduction > GNU Octave.<br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
In order to run Octave so that it interprets scripts as closely as possible to Matlab, use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:<br />
<br />
sqsub -r 60m -o ofile.%J octave --traditional mycode.m<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=11584OCTAVE2015-07-07T16:58:25Z<p>Jdesjard: /* Matlab Compatibility */</p>
<hr />
<div>{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.<br />
<br />
=Running on a visualization system=<br />
<br />
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu > Eduction > GNU Octave.<br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
In order to run Octave so that it interprets scripts as closely as possible to Matlab, use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:<br />
<br />
sqsub -r 60m -o ofile.%J octave --traditional mycode.m<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Large Memory Array Allocation==<br />
<br />
The following command sequence should successfully run on hound or tope. Since tope has 32gb of unlimited memory the test will be demonstrated there since it should be sufficient to run:<br />
<br />
[mypc ~] ssh tope.sharcnet.ca<br />
<br />
[tope ~] module load octave/3.4.0<br />
<br />
[tope ~] octave<br />
GNU Octave, version 3.4.0<br />
octave:3> N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1); C(N); 3*N <br />
ans = 1.2000e+09<br />
octave:4> exit<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=11583OCTAVE2015-07-07T16:57:30Z<p>Jdesjard: </p>
<hr />
<div>{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.<br />
<br />
=Running on a visualization system=<br />
<br />
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu > Eduction > GNU Octave.<br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
In order to run Octave so that it interprets scripts as closely as possible to Matlab use the --traditional flag. Taking from the above sqsub example the maximum Matlab compatible submission would be:<br />
<br />
sqsub -r 60m -o ofile.%J octave --traditional mycode.m<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Large Memory Array Allocation==<br />
<br />
The following command sequence should successfully run on hound or tope. Since tope has 32gb of unlimited memory the test will be demonstrated there since it should be sufficient to run:<br />
<br />
[mypc ~] ssh tope.sharcnet.ca<br />
<br />
[tope ~] module load octave/3.4.0<br />
<br />
[tope ~] octave<br />
GNU Octave, version 3.4.0<br />
octave:3> N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1); C(N); 3*N <br />
ans = 1.2000e+09<br />
octave:4> exit<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=11582OCTAVE2015-07-07T14:03:18Z<p>Jdesjard: </p>
<hr />
<div>{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.<br />
<br />
=Running on a visualization system=<br />
<br />
Once logged in to a visualization system an instance of Octave can be launched from Applications Menu > Eduction > GNU Octave.<br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Large Memory Array Allocation==<br />
<br />
The following command sequence should successfully run on hound or tope. Since tope has 32gb of unlimited memory the test will be demonstrated there since it should be sufficient to run:<br />
<br />
[mypc ~] ssh tope.sharcnet.ca<br />
<br />
[tope ~] module load octave/3.4.0<br />
<br />
[tope ~] octave<br />
GNU Octave, version 3.4.0<br />
octave:3> N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1); C(N); 3*N <br />
ans = 1.2000e+09<br />
octave:4> exit<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=11581OCTAVE2015-07-07T13:52:22Z<p>Jdesjard: </p>
<hr />
<div>{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
With X11 forwarding enabled in the development node interactive work with Octave can include figure generation.<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Large Memory Array Allocation==<br />
<br />
The following command sequence should successfully run on hound or tope. Since tope has 32gb of unlimited memory the test will be demonstrated there since it should be sufficient to run:<br />
<br />
[mypc ~] ssh tope.sharcnet.ca<br />
<br />
[tope ~] module load octave/3.4.0<br />
<br />
[tope ~] octave<br />
GNU Octave, version 3.4.0<br />
octave:3> N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1); C(N); 3*N <br />
ans = 1.2000e+09<br />
octave:4> exit<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=11580OCTAVE2015-07-07T13:50:05Z<p>Jdesjard: </p>
<hr />
<div>{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
<br />
<pre><br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
</pre><br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Large Memory Array Allocation==<br />
<br />
The following command sequence should successfully run on hound or tope. Since tope has 32gb of unlimited memory the test will be demonstrated there since it should be sufficient to run:<br />
<br />
[mypc ~] ssh tope.sharcnet.ca<br />
<br />
[tope ~] module load octave/3.4.0<br />
<br />
[tope ~] octave<br />
GNU Octave, version 3.4.0<br />
octave:3> N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1); C(N); 3*N <br />
ans = 1.2000e+09<br />
octave:4> exit<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=11579OCTAVE2015-07-07T13:49:23Z<p>Jdesjard: </p>
<hr />
<div>{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=Running in the development nodes=<br />
<br />
Besides running production work in Octave via the scheduler on SharcNET systems it is also possible to use Octave interactively on systems' development nodes.<br />
<br />
To start Octave from a development node one can login to a system with trusted X11 forwarding enabled:<br />
<br />
ssh -Y username@kraken.sharcnet.ca<br />
<br />
Then login to one of the development nodes with trusted X11 forwarding enabled:<br />
<br />
ssh -Y kraken-devel1<br />
<br />
Once logged into the development node one can load the Octave modules and launch the program:<br />
<br />
module unload intel<br />
module load octave<br />
octave<br />
<br />
GNU Octave, version 3.8.1<br />
Copyright (C) 2014 John W. Eaton and others.<br />
This is free software; see the source code for copying conditions.<br />
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or<br />
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.<br />
<br />
Octave was configured for "x86_64-unknown-linux-gnu".<br />
<br />
Additional information about Octave is available at http://www.octave.org.<br />
<br />
Please contribute if you find this software useful.<br />
For more information, visit http://www.octave.org/get-involved.html<br />
<br />
Read http://www.octave.org/bugs.html to learn how to submit bug reports.<br />
For information about changes from previous versions, type 'news'.<br />
<br />
octave:1> <br />
<br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Large Memory Array Allocation==<br />
<br />
The following command sequence should successfully run on hound or tope. Since tope has 32gb of unlimited memory the test will be demonstrated there since it should be sufficient to run:<br />
<br />
[mypc ~] ssh tope.sharcnet.ca<br />
<br />
[tope ~] module load octave/3.4.0<br />
<br />
[tope ~] octave<br />
GNU Octave, version 3.4.0<br />
octave:3> N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1); C(N); 3*N <br />
ans = 1.2000e+09<br />
octave:4> exit<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=11578OCTAVE2015-07-07T13:35:48Z<p>Jdesjard: /* Job Submission */</p>
<hr />
<div>{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters for production work Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Large Memory Array Allocation==<br />
<br />
The following command sequence should successfully run on hound or tope. Since tope has 32gb of unlimited memory the test will be demonstrated there since it should be sufficient to run:<br />
<br />
[mypc ~] ssh tope.sharcnet.ca<br />
<br />
[tope ~] module load octave/3.4.0<br />
<br />
[tope ~] octave<br />
GNU Octave, version 3.4.0<br />
octave:3> N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1); C(N); 3*N <br />
ans = 1.2000e+09<br />
octave:4> exit<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=11577OCTAVE2015-07-07T13:34:32Z<p>Jdesjard: /* Version Selection */</p>
<hr />
<div>{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly, to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Large Memory Array Allocation==<br />
<br />
The following command sequence should successfully run on hound or tope. Since tope has 32gb of unlimited memory the test will be demonstrated there since it should be sufficient to run:<br />
<br />
[mypc ~] ssh tope.sharcnet.ca<br />
<br />
[tope ~] module load octave/3.4.0<br />
<br />
[tope ~] octave<br />
GNU Octave, version 3.4.0<br />
octave:3> N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1); C(N); 3*N <br />
ans = 1.2000e+09<br />
octave:4> exit<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=11576OCTAVE2015-07-07T13:13:36Z<p>Jdesjard: /* Version Selection */</p>
<hr />
<div>{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
Similarly to load the default Octave module (currently version 3.8.1) one would do:<br />
<br />
module unload intel<br />
module load octave<br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Large Memory Array Allocation==<br />
<br />
The following command sequence should successfully run on hound or tope. Since tope has 32gb of unlimited memory the test will be demonstrated there since it should be sufficient to run:<br />
<br />
[mypc ~] ssh tope.sharcnet.ca<br />
<br />
[tope ~] module load octave/3.4.0<br />
<br />
[tope ~] octave<br />
GNU Octave, version 3.4.0<br />
octave:3> N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1); C(N); 3*N <br />
ans = 1.2000e+09<br />
octave:4> exit<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=OCTAVE&diff=11575OCTAVE2015-07-07T13:12:00Z<p>Jdesjard: /* Version Selection */</p>
<hr />
<div>{{Software<br />
|package_name=OCTAVE<br />
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations<br />
|package_idnumber=28<br />
}}<br />
<br />
=Introduction=<br />
<br />
Octave is provided on SHARCNET clusters to allow serial or threaded jobs to be run in the queue as described below.<br />
<br />
=Version Selection=<br />
<br />
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:<br />
<br />
<pre>module avail</pre><br />
<br />
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module. This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing. Therefore to load octave/3.6.3 one would do:<br />
<br />
<pre><br />
module unload intel<br />
module load octave/3.6.3<br />
</pre><br />
<br />
=Job Submission=<br />
<br />
On SHARCNET clusters Octave should only be run via the queuing system. Octave serial jobs can be submitted to the serial queue using following sqsub command:<br />
<br />
<pre>sqsub -r 60m -o ofile.%J octave mycode.m</pre><br />
<br />
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code. Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:<br />
<br />
<pre>sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m</pre><br />
<br />
=Example Job=<br />
<br />
This section shows howto submit a [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. <br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat sample.m <br />
#! /bin/octave -qf<br />
printf ("%s", program_name ());<br />
arg_list = argv ();<br />
for i = 1:nargin<br />
printf (" %s", arg_list{i});<br />
endfor<br />
printf ("\n");<br />
</pre><br />
<br />
To eliminate exatraneous verbosity in the output file two switches are passed:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc<br />
WARNING: no memory requirement defined; assuming 2GB per process.<br />
submitted as jobid 6937872<br />
</pre><br />
<br />
The output file from the job appears as:<br />
<br />
<pre><br />
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50<br />
sample.m arg1 arg2 arg3 etc<br />
</pre><br />
<br />
=General notes=<br />
<br />
==Matlab Compatibility==<br />
<br />
The online wiki resources "Octave Wiki":<br />
http://wiki.octave.org/ <br />
or "Wikibook":<br />
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB <br />
provide good introductory explanations of code compatibility between Octave and Matlab.<br />
<br />
==Reading/Writing Files==<br />
<br />
There are two strategies for handling file <i>input and output</i> described in the "Octave manual" viz ...<br><br />
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output<br> http://www.gnu.org/software/octave/docs.html.<br />
<br />
The following stanza demonstrates the "simple file I/O" approach:<br />
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO <br />
<br />
<pre><br />
save myiofile.dat A B C<br />
save ("-text", "myiofile.dat", "A", "B", "C")<br />
save ("-binary", "myiofile.dat", "A", "B", "C")<br />
load myiofile.dat<br />
load ("-text", "myiofile.dat", "A", "B", "C")<br />
load ("-binary", "myiofile.dat", "A", "B", "C")<br />
</pre><br />
<br />
where A, B and C are a potential mix of entities such as scalars, vectors or matrices. Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.<br />
<br />
==Large Memory Array Allocation==<br />
<br />
The following command sequence should successfully run on hound or tope. Since tope has 32gb of unlimited memory the test will be demonstrated there since it should be sufficient to run:<br />
<br />
[mypc ~] ssh tope.sharcnet.ca<br />
<br />
[tope ~] module load octave/3.4.0<br />
<br />
[tope ~] octave<br />
GNU Octave, version 3.4.0<br />
octave:3> N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1); C(N); 3*N <br />
ans = 1.2000e+09<br />
octave:4> exit<br />
<br />
==Octave-Forge==<br />
<br />
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system. Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).<br />
<br />
However 16 of approximately 95 octave-forge packages are installed on some sharcnet visualization workstations including viz1,2,3-uwaterloo, viz2-uwo, viz6-uoguelph under /usr/share/octave/packages. As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature). Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.<br />
<br />
===Sharing Packages===<br />
<br />
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users. To do this simply set access permissions for group or global read access accordingly. For details on how to change <br />
the permissions see: https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F<br />
<br />
===Managing Packages===<br />
<br />
The "Octave Forge" http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as <i>~/my_octave_sources</i> then manually installed into your own sharcnet account as will be shown in the follow example. A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. <br />
<br />
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.<br />
<br />
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12). Next consider you want to download the latest geometry package that was compatible with octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12). To show a list of all archived geometry versions, do the following steps:<br />
<br />
<pre><br />
http://octave.sourceforge.net/<br />
Click Packages on top menu menu bar<br />
Scroll down to the miscellaneous package row and click details<br />
Click (older versions) located below "Download Package"<br />
Click Octave Forge Packages<br />
Click Individual Package Releases<br />
Please wait for the page to load ...<br />
Click "Name" at the top of first colum to sort packages alphabetically<br />
Scroll down you will find all available archived geometry packages:<br />
geometry-1.0.1.tar.gz 2011-09-27<br />
geometry-1.1.1.tar.gz 2011-10-06<br />
geometry-1.1.2.tar.gz 2011-10-09<br />
geometry-1.1.3.tar.gz 2011-10-13<br />
geometry-1.1.tar.gz 2011-10-04<br />
geometry-1.2.0.tar.gz 2011-10-22<br />
geometry-1.2.1.tar.gz 2011-11-02<br />
geometry-1.2.2.tar.gz 2011-11-04<br />
geometry-1.4.0.tar.gz 2012-01-25<br />
geometry-1.4.1.tar.gz 2012-03-24<br />
geometry-1.5.0.tar.gz 2012-06-05<br />
</pre><br />
<br />
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next<br />
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave<br />
3.4.3 as follows:<br />
<br />
<pre><br />
[roberpj@tope:~/my_octave_sources] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg install geometry-1.2.2.tar.gz<br />
octave:2> pkg list<br />
Package Name | Version | Installation directory<br />
---------------+---------+-----------------------<br />
geometry | 1.2.2 | /home/roberpj/octave/geometry-1.2.2<br />
octave:15> pkg load geometry<br />
octave:16> pkg describe geometry<br />
---<br />
Package name:<br />
geometry<br />
Version:<br />
1.2.2<br />
Short description:<br />
Library for geometric computing extending MatGeom functions. Useful to create,<br />
transform, manipulate and display geometric primitives.<br />
Status:<br />
Loaded<br />
</pre><br />
<br />
<b>Note:</b> Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.<br />
<br />
===Package Commands===<br />
<br />
Additional examples of package commands are shown in this section. For demonstration purpose linear-algebra will first be downloaded:<br />
<br />
<pre><br />
[roberpj@iqaluk:~] mkdir my_octave_sources<br />
[roberpj@iqaluk:~] cd my_octave_sources<br />
wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
<pre><br />
[myusername@orc-login1:~]octave<br />
octave:1> help pkg<br />
</pre><br />
<br />
To install a package such as linear-algebra do:<br />
<br />
<pre><br />
octave:2> cd ~/my_octave_sources<br />
octave:3> pkg install general-1.3.2.tar.gz<br />
octave:4> pkg install linear-algebra-2.2.0.tar.gz<br />
</pre><br />
<br />
To remove a package, from a terminal first do:<br />
<pre>cd ~/octave<br />
rm -rf linear-algebra-2.2.0</pre><br />
<br />
... then from within octave do:<br />
<pre>octave:5> pkg uninstall linear-algebra</pre><br />
<br />
To list all installed packages do:<br />
<br />
<pre>octave:6> pkg list</pre><br />
<br />
To add a named packages to your path:<br />
<br />
<pre>octave:7> pkg load name</pre><br />
<br />
To remove a named package from your path:<br />
<br />
<pre>octave:8> pkg unload</pre><br />
<br />
To list all functions provided by a package:<br />
<br />
<pre>octave:9> pkg describe -verbose all</pre><br />
<br />
To list functions provide by extra odepkg package:<br />
<br />
<pre>octave:10> pkg describe odepkg</pre><br />
<br />
To list functions details for extra financial package:<br />
<br />
<pre>octave:11> pkg describe financial -verbose</pre><br />
<br />
To get documentation for a topic such as sin do:<br />
<br />
<pre>octave:12> doc sin</pre><br />
<br />
To get help using the doc command do:<br />
<br />
<pre>octave:13> help doc</pre><br />
<br />
To get documentation for a topic such as matrix do:<br />
<br />
<pre>octave:14> doc matrix</pre><br />
<br />
To get documentation for any topic run the doc command alone:<br />
<br />
<pre>octave:15> doc</pre><br />
<br />
===Package Example===<br />
<br />
This example assumes you first create two directories in your home account one being named<br />
~/my_octave_packages <br />
and the other <br />
~/my_octave_sources <br />
then download the required three tar.gz files into the latter from <br />
http://octave.sourceforge.net/packages.php ...<br />
<br />
[roberpj@orc-login1:~] module unload octave<br />
[roberpj@orc-login1:~] module load octave<br />
[roberpj@orc-login1:~] octave<br />
GNU Octave, version 3.4.3<br />
octave:1> pkg prefix ~/my_octave_packages<br />
ans = /home/roberpj/my_octave_packages<br />
octave:2> cd my_octave_sources<br />
octave:3> ls<br />
miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:4> pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz<br />
octave:5> pkg list<br />
Package Name | Version | Installation directory<br />
---------------|---------|-----------------------<br />
miscellaneous *| 1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11<br />
optim *| 1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17<br />
struct *| 1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9</PRE><br />
<br />
=References=<br />
<br />
o Octave Homepage<br><br />
http://www.gnu.org/software/octave/<br />
<br />
o Octave 725 Page Manual (Version 3.4.0)<br><br />
http://www.gnu.org/software/octave/doc/interpreter/<br />
<br />
o Statistic Package Function Reference<br><br />
http://octave.sourceforge.net/doc/funref_statistics.html<br />
<br />
o GNU Octave Wiki<br><br />
http://wiki.octave.org/<br />
<br />
o Matlab-Like Tools for HPC (article)<br><br />
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=File:Gnuplot_demo_randome_numbers.png&diff=10056File:Gnuplot demo randome numbers.png2014-11-12T15:57:23Z<p>Jdesjard: Figure generated by "random numbers" from http://gnuplot.sourceforge.net/demo/</p>
<hr />
<div>Figure generated by "random numbers" from http://gnuplot.sourceforge.net/demo/</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=File:Gnuplot_demo_3d_surfaces1.png&diff=10026File:Gnuplot demo 3d surfaces1.png2014-11-12T14:50:22Z<p>Jdesjard: 3D gnuplot figure generated by surfaces1 example at http://gnuplot.sourceforge.net/demo/</p>
<hr />
<div>3D gnuplot figure generated by surfaces1 example at http://gnuplot.sourceforge.net/demo/</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=Category:Storage&diff=9668Category:Storage2014-09-19T02:47:01Z<p>Jdesjard: Created page with "Pages related to Storage."</p>
<hr />
<div>Pages related to Storage.</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=Category:Parallel_language&diff=9665Category:Parallel language2014-09-19T02:43:09Z<p>Jdesjard: Created page with "Pages related to parallel programming language."</p>
<hr />
<div>Pages related to parallel programming language.</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=Category:Industry&diff=9662Category:Industry2014-09-19T02:32:39Z<p>Jdesjard: Created page with "Pages related to Industry."</p>
<hr />
<div>Pages related to Industry.</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=Category:Digital_Humanities&diff=9656Category:Digital Humanities2014-09-19T02:21:39Z<p>Jdesjard: Created page with "Pages related to Digital Humanities."</p>
<hr />
<div>Pages related to Digital Humanities.</div>Jdesjardhttps://www.sharcnet.ca/help/index.php?title=Category:GPU&diff=9653Category:GPU2014-09-19T01:57:33Z<p>Jdesjard: Created page with "GPU related pages."</p>
<hr />
<div>GPU related pages.</div>Jdesjard