MATLAB

From FarmShare

Revision as of 13:37, 18 January 2012 by Chekh (Talk | contribs)
Jump to: navigation, search

We have a trial version of MATLAB Distributed Compute Server until 2011-12-25.

The standard MATLAB install in AFS now also has R2011b in addition to R2010b.

You will need to write your MATLAB code to use the Parallel Computing Toolbox before using the Distributed Computing Server.

Here's how to write a job using MDCS: http://docs.uabgrid.uab.edu/wiki/MatLab_CLI#Parallel_MATLAB

You can use the "maxNumCompThreads" command (deprecated) to see how many parallel threads you can run. I get "24" on barley, or "8" on corn.

simple PCT run

/afs/ir.stanford.edu/software/matlab-2011b/bin/matlab -nodesktop -r 'maxNumCompThreads'

>> matlabpool ( 'open', 'local', 8)
Starting matlabpool using the 'local' configuration ... connected to 8 labs.
>> 
>> matlabpool size

ans =

     8

Then use 'parfor' instead of 'for'.

matlabpool of size 0 and size 1 are effectively the same, except the latter uses a PCT toolbox license.

Here are some training slides and example code that I copied from http://www.osc.edu/~samsi/sc11edu/

example single matlab file run via qsub

Here's our helloworld.m:

disp('Hello World');

Here's a command to run that.

 /afs/ir.stanford.edu/software/matlab-2011b/bin/matlab -nodesktop < helloworld.m

We want to run this same command via the job scheduling system. Let's write a job script.

$ cat matlab_example.script
#!/bin/bash

#$ -N matlab_example
#$ -m bes
#$ -M chekh@stanford.edu

/afs/ir.stanford.edu/software/matlab-2011b/bin/matlab -nodesktop < /afs/ir/users/c/h/chekh/helloworld.m

Submit the script:

 qsub matlab_example.script

Look at the job status:

 qstat

You should get output files like matlab_example.script.eXXXXX and matlab_example.script.oXXXXX

Personal tools
Toolbox
LANGUAGES