Mathworks MATLAB

MATLAB (for matrix laboratory) is a numerical computing environment. It allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, and Fortran.

Please read the note regarding dead keys if you have trouble entering the ^ character.

Installed modules and toolboxes

The following modules are licensed:
  • 13x MATLAB
  • 1x Compiler
  • 3x Parallel Computing Toolbox
  • 8x Distributed Computing Server

The following toolboxes are licensed:

  • 1x Bioinformatics Toolbox
  • 1x Curve Fitting Toolbox
  • 1x Image Processing Toolbox
  • 1x Optimization Toolbox
  • 1x Signal Processing Toolbox
  • 1x Statistics Toolbox

The toolbox license count only applies to interactive sessions. If you use the Parallel Computing Toolbox and Distributed Computing Server you do not require a toolbox license for every MATLAB instance. That means you can run a parallel job on 8 nodes using the e.g. Optimization Toolbox although we only have 1 interactive license for it.

If you receive the message License checkout failed. when trying to use a toolbox it means that all licenses of this toolbox are already in use. In this case try again at a later time or contact Support and ask for more licenses.

Parallel Computing

The Parallel Computing Toolbox lets you parallelize your MATLAB code on multiple CPU cores and/or machines. The provided programming interface mimics a shared memory model although your code may run on multiple machines. The synchronization of your variables over the network is handled transparently and efficiently by MATLAB.

The Parallel Computing Toolbox can also be used to:

  • distribute arrays that are bigger than the memory of one workstation over several nodes (distributed arrays),
  • run an algorithm on multiple data sets simultaneously using the single program multiple data (spmd) construct,
  • submit nonparallel MATLAB code to multiple nodes for parallel execution with different parameters (parameter sweep),

Official documentation is provided at http://www.mathworks.com/help/toolbox/distcomp/.

Setup for use from within a CIP pool workstation

The Parallel Computing Toolbox and Distributed Computing Server are installed on the CIP pool's workstations. Follow these steps to configure MATLAB for parallel job execution on the CIP cluster:

  1. Start MATLAB and open the Configurations Manager via Parallel->Manage Configurations....
  2. Click on File->New->jobmanager
  3. Fill out the Form as follows in the screenshot:
    • Configuration name: cip
    • Job manager hostname: cipserv.cip.ph.tum.de
    • Job manager name: CIP-R2011a
  4. Press OK
  5. In the Configurations Manager window click on Start Validation.
  6. All test stages must pass within a few minutes.
  7. Click on File->New->jobmanager
  8. Fill out the Form as follows in the screenshot:
    • Configuration name: cip-cuda
    • Job manager hostname: cipserv.cip.ph.tum.de
    • Job manager name: CIP-CUDA-R2011a
  9. Press OK
  10. In the Configurations Manager window click on Start Validation.
  11. All test stages must pass within a few minutes.
  12. Close the Configurations Manager window.

Your MATLAB is now configured for parallel job execution.

The cip-cuda configuration will execute your jobs only on CUDA capable workers. At the moment this is only the workstation cuda1.

Usage from non-CIP computers

If you have a CIP account but want to use MATLAB on a private/university computer that does not belong to the CIP pool, you can still run MATLAB workers on the CIP pool workstations. You must first install MATLAB and the Parallel Computing Toolbox on your computer. Use the same instructions as above to configure your MATLAB installation.

Your hostname, i.e. the hostname of your computer, must be valid, resolvable and your computer must accept incoming TCP connection from the CIP subnet 10.152.84.0/24. You can view the hostname that MATLAB uses by entering pctconfig at the MATLAB prompt. If MATLAB uses a wrong hostname, you can change the hostname by entering pctconfig('hostname', '<NEW-HOSTNAME>') at the MATLAB prompt. This command must be executed in every MATLAB session, so it might be useful to put it in your startup.m file.

Example

The following MATLAB script creates twenty 1500x1500 matrices, stores them in cell array a and inverts them in parallel.

clear

%% data generation
n=1500;
for i=1:20
    a{i} = rand(n,n);
end

%% parallel run
parfor i=1:numel(a)
    ia{i} = inv(a{i});
end

Save this code snippet as dcsdemo.m.

Before you run this script you have to initialize the MATLAB pool of workers that will execute your code in parallel on a set of nodes. This is done by calling matlabpool [poolsize] from the MATLAB command prompt, where [poolsize] represents the number of workers you wish to use. matlabpool 4 would start workers on 4 machines. When you are finished call matlabpool close to quit the workers and release the licenses.

Here is a sample session:

>> matlabpool 4
Starting matlabpool using the 'cip' configuration ... connected to 4 labs.
>> dcsdemo
>> whos
  Name      Size                Bytes  Class     Attributes

  a         1x20            360002240  cell                
  i         1x1                     8  double              
  ia        1x20            360002240  cell                
  n         1x1                     8  double              

>> matlabpool close
Sending a stop signal to all the labs ... stopped.
>>

Of course you may also call matlabpool from your script.

For further information please read the users guide at http://www.mathworks.com/help/toolbox/distcomp/brb2x2l-1.html.

Troubleshooting

MATLAB hangs when you try to open a matlabpool

The underlying Sun Grid Engine is probably not able to allocate enough slots for your job.

Please run qstat -f | grep matlab.q and count the number of available hosts. Each host is represented by a row. Failed or overloaded hosts are marked with a, au or E in the last column; available hosts have no marker in the last column. Example output:

$ qstat -f | grep matlab.q
matlab.q@c2quad1.cip.ph.tum.de BIP   0/0/4          10.16    lx24-amd64    
matlab.q@c2quad2.cip.ph.tum.de BIP   0/0/4          4.07     lx24-amd64    
matlab.q@iseven1.cip.ph.tum.de BIP   0/0/1          0.55     lx24-amd64    
matlab.q@iseven2.cip.ph.tum.de BIP   0/0/1          8.51     lx24-amd64    
matlab.q@iseven3.cip.ph.tum.de BIP   0/0/1          0.32     lx24-amd64    
matlab.q@iseven4.cip.ph.tum.de BIP   0/0/1          0.26     lx24-amd64    au
matlab.q@iseven5.cip.ph.tum.de BIP   0/0/1          0.76     lx24-amd64    au
matlab.q@iseven6.cip.ph.tum.de BIP   0/0/1          0.47     lx24-amd64 
In this example output 6 hosts are available because iseven4, iseven5 have failed.

If you try to request more slots than available hosts SGE will wait (forever) until the required number of hosts becomes available. This causes MATLAB to hang. To fix this problem you have to adjust the ClusterSize in your MATLAB Parallel Preferences. Click on Parallel->Manage Configuration..., then double click on the CIP parallel configuration. In the Generic Scheduler Configuration Properties change Number of workers available to scheduler (ClusterSize) dialog to be equal or lower than the number of available SGE hosts. Alternatively write to mailto:trouble@ph.tum.de and request a reset of the failed hosts.

 
r15 - 25 Aug 2011 - 13:09:32 - SebastianUrban > Services > Applications > MATLAB
This site is powered by the TWiki collaboration platformCopyright © Technische Universität München. (login)