Building a Beowulf Cluster/Parallelization of computation/Matlab

From Wikibooks, open books for an open world
Jump to navigation Jump to search

As for matlab, note that in order to run it on a 64bit system you need shared libraries (on Fedora the package is called libXp, on ubuntu ia32) and some java packages.

Matlab comes with the parallel computing toolbox, the distributed computing server, and an implementation of mpich2. You can find manuals in pdf format on the corresponding mathworks site. You start the mpich2 server as root:

$MATLAB/toolbox/distcomp/bin/mdce start

$MATLAB is the directory of your matlab installation.

(Note: Here holds the same as for PVM. For mdce to work, you need to remove from /etc/hosts the loopback line with your host name in it, i.e. node0 becomes your_network_ip node0. )

We start the job manager:

$MATLAB/toolbox/distcomp/bin/startjobmanager -name MyJobManager

Connect one worker:

$MATLAB/toolbox/distcomp/bin/startworker -jobmanager MyJobManager -jobmanagerhost node0

where node0 is the machine where your jobmanager is running (obviously).

...and a second worker on a different machine. From node0:

$MATLAB/toolbox/distcomp/bin/startworker -jobmanager MyJobManager -jobmanagerhost node0 -name worker2 -remotehost node1

Use the option remotehost to start a worker on a different machine.

Make sure that job manager and workers are running:


Starting matlab in desktop mode (we need jvm), parallel->configure and parallel->administrate, we choose MyJobManager basically and start the "matlabpool":

>> matlabpool open

You should see the confirmation" Connected to a matlabpool session with 2 labs (or more)."

The simple proof of concept:

>> parfor i=1:5

See also[edit]