MATLAB DCS: Difference between revisions

From Cheaha
Jump to navigation Jump to search
(→‎Steps to run Matlab: Fixed invoke of matlab script in SGE script and correct flag to suppress gui display)
(updated simple matlab test instructions)
Line 3: Line 3:
== Steps to run Matlab ==
== Steps to run Matlab ==


Once you log into Cheaha, set up your environment with the command:
=== Simple Matlab Test ===
These instructions NOT use the distributed licenses available on cheaha and will be restricted to a single cpu. See the next section for an example using the distributed computing license.
 
Set up your environment with the command:
<pre>
<pre>
module load mathworks/matlab-r2009a
module load mathworks/matlab
</pre>
</pre>
As a test, you can run MatLab and access your license server with
As a test, you can run MatLab and access your license server with
<pre>
<pre>
matlab -c port@license-server -nodesktop
matlab -c port@license-server -nodesktop -nojvm -r "rand, exit"
</pre>
For example:
<pre>
module load mathworks/matlab
matlab -c 27000@licserver.uab.edu -nodesktop -nojvm -r "rand, exit"
 
                        < M A T L A B (R) >
                Copyright 1984-2009 The MathWorks, Inc.
              Version 7.9.0.529 (R2009b) 64-bit (glnxa64)
                          August 12, 2009
  To get started, type one of these: helpwin, helpdesk, or demo.
  For product information, visit www.mathworks.com.
 
ans =
 
    0.8147
</pre>
</pre>
This will start matlab in an interactive shell.  This is good just to  
This will start matlab without a graphical display and without Java support.  This is good just to  
verify things work, but do not run any significant computations on the Cheaha  
verify things work, but do not run any significant computations on the Cheaha  
head node. MatLab computational work needs to be run on the compute nodes
head node.
by submitting a job submission script to the SGE scheduler
 
MatLab computational work needs to be run on the compute nodes by submitting a job submission script to the SGE scheduler


You can create a simple SGE script with (this example requests 1 cpu core / slot):
You can create a simple single cpu SGE script with (script name "matlabtest.qsub"):
<pre>
<pre>
#!/bin/bash
#$ -S /bin/bash
#$ -S /bin/bash
#$ -cwd
#$ -cwd
#
#
#$ -pe matlab 1
#$ -N testMatLab
#$ -N testMatLab
#$ -l h_rt=2:00:00,s_rt=1:55:00
#$ -l h_rt=00:10:00,s_rt=00:08:00
#$ -j y
#$ -j y
#
#
Line 29: Line 50:
#$ -m eas
#$ -m eas
#
#
module load mathworks/matlab-r2009a
module load mathworks/matlab
#$ -V
#$ -V
   
   
matlab -c port@license-server -nodisplay < matlab-script
matlab -c port@license-server -nodisplay -nojvm < matlab-script
</pre>
</pre>
   
   
Then submit that script with
Then submit the script to the scheduler with
<pre>
<pre>
qsub name-of-script-above
qsub matlabtest.qsub
</pre>
</pre>



Revision as of 22:12, 10 March 2010

Stub

Steps to run Matlab

Simple Matlab Test

These instructions NOT use the distributed licenses available on cheaha and will be restricted to a single cpu. See the next section for an example using the distributed computing license.

Set up your environment with the command:

module load mathworks/matlab

As a test, you can run MatLab and access your license server with

matlab -c port@license-server -nodesktop -nojvm -r "rand, exit"

For example:

module load mathworks/matlab
matlab -c 27000@licserver.uab.edu -nodesktop -nojvm -r "rand, exit"

                        < M A T L A B (R) >
                Copyright 1984-2009 The MathWorks, Inc.
              Version 7.9.0.529 (R2009b) 64-bit (glnxa64)
                          August 12, 2009
 
  To get started, type one of these: helpwin, helpdesk, or demo.
  For product information, visit www.mathworks.com.

ans =

    0.8147

This will start matlab without a graphical display and without Java support. This is good just to verify things work, but do not run any significant computations on the Cheaha head node.

MatLab computational work needs to be run on the compute nodes by submitting a job submission script to the SGE scheduler

You can create a simple single cpu SGE script with (script name "matlabtest.qsub"):

#!/bin/bash
#$ -S /bin/bash
#$ -cwd
#
#$ -N testMatLab
#$ -l h_rt=00:10:00,s_rt=00:08:00
#$ -j y
#
#$ -M YOUR_EMAIL_ADDRESS
#$ -m eas
#
module load mathworks/matlab
#$ -V
 
matlab -c port@license-server -nodisplay -nojvm < matlab-script

Then submit the script to the scheduler with

qsub matlabtest.qsub

Check on it with qstat.

qstat -u $USER