Parallel Virtual Machine (PVM) in 60 Seconds

Start PVM

Before we go over the steps to compile and run parallel PVM programs, you should be sure you can start up PVM and configure a virtual machine. On any host on which PVM has been installed you can type

% pvm

You should get back a PVM console prompt signifying that PVM is now running on this host.

Add PVM hosts

You can add hosts to your virtual machine by typing at the console prompt

pvm> add hostname

 

Delete a PVM host

You can delete hosts (except the one you are on) from your virtual machine by typing

pvm> delete hostname

 

Check virtual machine status

To see what the present virtual machine looks like, you can type

pvm> conf

 

Check out PVM tasks

To see what PVM tasks are running on the virtual machine, you type

pvm> ps -a

Of course you don't have any tasks running yet

 

Exit PVM console

You type ``quit" at the console prompt, the console will quit but your virtual machine and tasks will continue to run. At any Unix prompt on any host in the virtual machine, you can type

% pvm

and you will get the message ``pvm already running" and the console prompt.

 

Stop PVM

When you are finished with the virtual machine, you should type

pvm> halt

This command kills any PVM tasks, shuts down the virtual machine, and exits the console. This is the recommended method to stop PVM because it makes sure that the virtual machine shuts down cleanly.

 

Start a new run without Halt

If you get a problem with your current PVM tasks and want to start another new run, do "reset" first as follows:

pvm> reset

This will clean up all previous tasks on all hosts

PVM Hostfile

If you don't want to type in a bunch of host names each time, there is a hostfile option. You can list the hostnames in a file one per line and then type

% pvm hostfile

PVM will then add all the listed hosts simultaneously before the console prompt appears. Several options can be specified on a per-host basis in the hostfile .

Compiling Applications

  • Linking

    When compile you need PVM liabrary files. If the liabrary files are not in the default path, you can do this:

    gcc myfile.c -o helloworld -L/path/to/pvm/liabrary/ -lpvm3

    In McGill CS Lab do this:

    gcc myfile.c -o helloworld -L/usr/local/lib/ -lpvm3

  • Head files

    PVM applications written in C should include header file pvm3.h. In McGill CS Lab do as follows:

    #include "/usr/local/include/pvm3.h"

 

Hello World program

    Hereafter is a PVM "Hello World" program. I compiled and tested it in McGill CS Lab(e.g. lab103n). Should there be any problem to run this program, please feel free to let me know.

    hello.c

    You need to change "/path/to/hello_other" in hello.c to the folder you store hello_other.

    hello_other.c

    makefile

 

Web Resources

 

Parallel Virtual Machine Home Page

Very useful program examples come with PVM release package. You'd better check them out. Some example programs in PVM Book.

PVM Man Page (very useful for programming reference)