MATLAB

From FarmShare

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
-
We have a trial version of MATLAB Distributed Compute Server until 2011-12-25.
+
==example single matlab file run via qsub==
-
The standard MATLAB install in AFS now also has R2011b in addition to R2010b.
+
Here's our helloworld.m:
 +
<pre>
 +
disp('Hello World');
 +
</pre>
-
You will need to write your MATLAB code to use the Parallel Computing Toolbox before using the Distributed Computing Server.
+
Here's a command to run that.
 +
  /afs/ir.stanford.edu/software/matlab-2011b/bin/matlab -nodesktop < helloworld.m
-
Here's how to write a job using MDCS: http://docs.uabgrid.uab.edu/wiki/MatLab_CLI#Parallel_MATLAB
+
We want to run this same command via the job scheduling system. Let's write a job script.
-
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==
 
<pre>
<pre>
-
/afs/ir.stanford.edu/software/matlab-2011b/bin/matlab -nodesktop -r 'maxNumCompThreads'
+
$ cat matlab_example.script
 +
#!/bin/bash
-
>> matlabpool ( 'open', 'local', 8)
+
#$ -N matlab_example
-
Starting matlabpool using the 'local' configuration ... connected to 8 labs.
+
#$ -m bes
-
>>
+
#$ -M chekh@stanford.edu
-
>> matlabpool size
+
-
ans =
+
/afs/ir.stanford.edu/software/matlab-2011b/bin/matlab -nodesktop < /afs/ir/users/c/h/chekh/helloworld.m
-
 
+
-
    8
+
-
 
+
-
Then use 'parfor' instead of 'for'.
+
</pre>
</pre>
-
matlabpool of size 0 and size 1 are effectively the same, except the latter uses a PCT toolbox license.
+
Submit the script:
 +
  qsub matlab_example.script
-
Here are some training slides and example code that I copied from http://www.osc.edu/~samsi/sc11edu/
+
Look at the job status:
-
* http://stanford.edu/~chekh/matlab.tar
+
  qstat
-
==example single matlab file run==
+
You should get output files like matlab_example.script.eXXXXX and matlab_example.script.oXXXXX
-
 
+
-
Here's our helloworld.m:
+
-
<pre>
+
-
disp('Hello World');
+
-
</pre>
+
-
 
+
-
Here's a command to run that.
+
-
  /afs/ir.stanford.edu/software/matlab-2011b/bin/matlab -nodesktop < helloworld.m
+

Revision as of 13:36, 18 January 2012

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