You need to configure PLab before you can use it!

The configuration is performed by editing the plab_defaults.m file. This can be either a system wide default if you are a sysadm, or your own local copy.

You need to understand the two different ways PLab can spawn slaves:

1. Fork
2. Remote shell

The difference is that fork clones the current Matlab session using a unix fork() system call. This is very fast! The second method invokes brand new Matlab sessions using a remote shell command, this can be either rsh or ssh based, or it can even use the "jr" command of the "Beowulf Job Manager" for selecting appropriate nodes in your Linux cluster. Another difference, relevant for those unfortunate people who dont have unlimited number of Matlab licenses, the fork method does not require separate Matlab licenses, i.e. the forked parallel session counts as a single Matlab instance to the flex license manager. In contrast, the remote shell spawn methods require one license for each child spawned.


All configuration is done by manipulating property-value pairs using the pset() and pget() functions. This is very much like the set and get functions for manipulation of graphics objects in Matlab.

If you just type "pget" you should get a struct with the entire settings. Type "pset" and you should be getting something like what is shown below. (badly formatted, I know). The ones you need to care about in the beginning are "nodes" and "spawnmethod".

nodes:                       A struct array describing the nodes 
                             in the cluster.
spawnmethod:              [ {fork} |  rsh  |  rexec  |  ssh  |  jr ]  
                             How to create slaves
spawncommands:               {'', '/usr/bin/rsh', '/usr/bin/rexec', 
                             '/usr/bin/ssh', '/usr/bin/jr', 'plab.mexlx'}
                             Which unix commands to use to do the 
                             respective spawnmethod (same number 
                             in list)
automigrate: 1               Nonzero if pinit calls pmigrate by 
                             default (MOSIX only)
slavedisplay: 'master'       How to set slave DISPLAY variable. 
                             If set to 'master' the value from 
                             the master will be copied
hostname: 'default'          Set the host name of the master 
                             (usually 'default') You can set 
                             this if the slave cannot find 
                             the master's hostname on the 
                             network (e.g. badly configured DHCP)
scheduling:                  [ {dynamic} |  fixed ]  
                             Control how pfor iterations are 
                             distributed across nodes. 
minchunksize:      1         Min. # pfor iters per node
maxchunksize:      1         Max. # pfor iters per node
seconds_per_chunk: 5.00      Used in pfor with dynamic scheduling. 
                             Assign iterations in chunks so chunks 
                             take this long (big chunks=less 
min_seconds_per_chunk:2.00   Used in pfor with dynamic scheduling. 
                             Make each chunk of iterations take 
                             at least this long


A linux cluster of nodes bond001, bond002... bond017, called using rsh (you need to be able to rsh/rlogin with no passwords for the rsh method to work!)
function plab_defaults
for i=1:17, 
  nodes(i).name=sprintf('bond%03d',i);    % The host names for rsh
  nodes(i).cpus=2;                        % Each node has 2 cpus 
pset('nodes', nodes);

A linux cluster using "Beowulf Job Manager"

function plab_defaults

A use-what-you've-got-access-to cluster. Notice that PLab supports heterogenous clusters, i.e. you can mix Sun, HP, Irix, Intel Linux etc into one big multi-ethnical happy parallel community. You can also make some nodes spawn using rsh, and others using ssh. Note: rexec does not work at present. If the nodes are different machine architecture than the master node (where you start plab from) you need to specify this in the 'nodes' struct array in the field 'arch'. This field can take the values 'default' (same as the master node) or one of "default", "lnx86", "irix", "hp700", "sol2" (see line 82 of plab.h

function plab_defaults
nodes(1).name='zork';      % Our old 4-cpu monster
nodes(1).spawnmethod='rsh'; % I can rlogin to this account
nodes(2).name='newton';    % A HP machine
nodes(2).login='joeb';     % For some reason my user name is different here
nodes(2).cpus=1;           % 
nodes(2).spawnmethod='rsh'; % I can rlogin to this account

nodes(3).name='newton';    % A HP machine
nodes(3).login='joeb';     % For some reason my user name is different here
nodes(3).cpus=1;           % 
nodes(3).spawnmethod='rsh'; % I can rlogin to this account

% Example of ssh 
nodes(4).name='medova.tea.com';  % Some remote machine
nodes(4).login='jb';       %
nodes(4).cpus=1;           % 
nodes(4).spawnmethod='ssh'; % I can do ssh to this account without 
                            % password because I have setup ssh-agent 
                            % and ssh-add etc. NOTE: YOU NEED TO USE 
                            % SSH-AGENT TO LOGIN WITH SSH WITH NO PASSWORD!

pset('nodes',nodes); % Put the nodes struct into PLab config

% Next 3 lines control pfor behavior
pset('scheduling','fixed'); % Dont make chunk size decisions for me with pfor