For parallel programming we use pvm (Parallel Virtual Machine). See also:

 Communication primitives for c++.

 PVM homepage See also the pvm manual available at the lab:

 Run your parallel program

On our LINUX system: Computers you can use to run in parallel: parallel1, parallel2 ... parallel9 (Some might not be running)  9/7/2004 SHOULD BE OK now (mail if problems)
Open 3 consoles:
  1. To run your master program (like a normal program).
  2. To run pvm:
  3. To show the log file (with the messages from the slaves: pvm errors and slave output )


Don't forget to halt pvm when you stopped experimenting!!
Otherwise your pvm-processes keep on running! Also when you log out!

Cluster   ONLY ACCESSIBLE FROM OUR LINUX SYSTEM   9/9/2004 PROBLEMS WITH node6, node8 & node9... they are unusable for the moment

Do your final experiments (performance measurements) on the cluster (ask first for permission to your assistent):

 Debugging in pvm

To debug your master program, just use gdb (see doc).
To debug your slaves, start the slave programs with the PvmTaskDebug flag (together with the normal PvmTaskDefault flag) and spawn the slaves on the same machine as  the master (don't specify the machine name), as follows: When the master spawns the slave, it will be in a gdb debug window, where you can debug your program as always with gdb.

You should start the slave program yourself with r (run), after having put breakpoints.
Quit the debug window with q, and then press ENTER to close the window.

   Program Example

Download the code

The .h, the.cc-files and the project file
Download the code all at once with this compressed archive file: pvmExample.tgz, extract the files in a new directory with command: tar -zxf pvmExample.tgz

Run the program

    1. create the makefile starting from the project file problem.pro with qmake and compile it (note that your executable problem is put in the pvm3/bin/LINUX directory.)
    2. run your parallel program
    3. try to understand the program (documentation)
    4. Study it:
Check our Quicklist and  page!!


  1. Change the task of the parallel program, so that it checks whether the parameter is a prime
  2. Do a small performance analysis:
  3. Measure the communication time and the ratio communication versus computation
  4. Solve the load imbalance problem!

 Program Example with EPPA instrumentation

On our LINUX system
EPPA is installed under the $PARDIR directory.
Extract pvmExapleWithEPPA in a new directory with command: tar -zxf pvmExampleWithEPPA.tgz
The example problemEPPA is the same as above, but now instrumented with EPPA. Run problemEPPA with the -m option to activate the EPPA probe. View your results with the EPPA tool (the command EPPA in a console or the icon in the toolbar).

On another system (with QT, pvm and mysql), EPPA can be installed
Compressed archive file: EPPAFiles.tgz,

 More Pvm

PVM reference manual

Advanced Pvm



To use pvm you should configure your account.


In order to make PVM work you need first to create a directory called pvm3/bin/LINUX. Do this by typing the following commands in a console (or use the file manager):
  1. cd  (= goes to your home directory)
  2. mkdir pvm3
  3. cd pvm3
  4. mkdir bin
  5. cd bin
  6. mkdir LINUX

When you want to start a process by PVM (eg a master that starts a slave), pvm will look for the slave in the pvm3/bin directory! Based on the architecture of your machine PVM will choose a sub directory in that directory. To do so it will look at the PVM_ARCH environment variable, which is in our case LINUX (see next paragraph).

Add also this directory to your path (see linux configuration): add the line $(HOME)/pvm3/bin/LINUX to your .path.local file

Remark: sometimes we use a hostf file in our home directory to indicate this path (for the exe's).

PVM variables

In order to work PVM requires 2 environment variables to be set, namely PVM_ROOT and PVM_ARCH. These are used by the PVM daemon to find were the different files are located on the system. By default they have the following values on our machines: At this point PVM should work for you now try to type PVM at the prompt. You should get a line like this

For further operations I refer you to the user manual.

.rhosts file

PVM uses remote  shell to start programs on the different machines that constitute a PVM. It is therefore important to ensure the you can indeed do a remote shell to another computer. Choose a computer other than the on you are login in and type :
ssh other_computer_name date

This line will run the program date on the remote machine and redirect the output of that program to the local machine. For this to work you should add the name of your local machine into the .rhosts file of your home directory. Again be aware of the fact that this is a hidden file and that you need to use ls -al if you want to make sure this file exists. What you do is simply put the name of all the machine you will allow to do a remote shell on the local machine in this file.
You can create the .rhosts file with: echo $HOSTNAME $LOGNAME > .rhosts

How does it work?
When you issue a rsh to a machine this machine check the .rhosts file to see which machine have the permission to request the execution of a program. Suppose machine A wants to run a program on machine B. Then the name of machine A should be present in the .rhosts file of machine B. So the remote machine has list of the machine that can start programs. The opposite would be quite dangerous. It that scenario it would suffice to make a file on a machine in order to run programs on any machine and by just adding the name of the machine  to that file.

So you can do a remote shell that is good. I recommend putting all the machines of our lab into your .rhosts file. This way you will be able to start PVM on all the machines you want.

Installation of PVM 3 on Windows 9x

IMPORTANT:  Install PVM only in machines that have Visual C++ 5 or greater, because the pvm libraries in this distribution are incompatible with other compilers.

The self-installation program could be downloaded at:
This program will install all the necesary files.

After installation check that the following enviroment variables are set... if not, put then in the autoexec.bat:

set PVM_ROOT=3DC:\Program Files\PVM3.4

Reboot the machine.  Run the PVM console and you are ready to execute any pvm program.

For more install information, check out the links page...