Howto OG matlab tutorial

From ImageWiki

Revision as of 14:15, 7 October 2013 by Sporring (Talk | contribs)
Jump to: navigation, search

Assume that I have matlab script that I want to start. All files for this example are stored in /home/kimstp/test_officegrid.

The matlab script is called mytestscript.m and looks like this:

 % This script is for testing Office Grid
 for i=1:10
   X=ones(1,268435456); % Allocate 2 GB of memory
   clear X;
 % Remember to use absolute paths when reading and writing files. Like this
 clear all;
 % Remember to call exit at the end of your matlab script (this is a problem
 % with our current matlab installation, ver.

In order to setup the environment and start matlab I have made a script called

 export MATLABPATH=/home/kimstp/test_officegrid
 /usr/local/bin/matlab -nodesktop -nojvm -nosplash -r mytestscript

After creating this file, you should make it executable as a script by:

 chmod u+x

Now we are ready to start the script as an OG job. Login to imagediskserver2 ( and using the CLI do the following:

 og_shcmd -i -p linux /home/kimstp/test_officegrid/

Notes on -w --walltime ( - 01/11-08) If you do not specify the walltime of the script it will stop your script after 1H.

The program runs and writes and reads a file called data.mat.

See section below on how to read back the text output from stdout and stderr. Or try to do:

 og_res -i <job_id>

Which should print the text output from your matlab script.

Personal tools