next up previous

3 Writing PVM Applications

There are two main programming models that codes written under PVM follow: master/worker and hostless. Under the master/worker paradigm, one task is used as the master. The sole purpose of the master task is to create all other tasks that are designated to work on the problem, coordinate the input of initial data to each task and collect the output of results from each task. Under the hostless model, the initial task spawns off copies of itself as tasks and then starts working on its portion of the problem, while the created tasks immediately begin working on their portion. Input and output requirements are often handled by individual tasks, but it may be beneficial to have some results collected by a single task, especially if those results need to be broadcast back out to all the tasks.

PVM applications can be written in either C or Fortran 77. To execute a program under PVM, the user adds calls to PVM library routines that spawn off tasks to other machines within the user's virtual machine and allow tasks to send and receive data. While PVM is implemented in C, Fortran applications call the library routines through an interface that is included with the PVM source. This requires an additional library be linked in at compilation, though. The default directory PVM looks into for executables is $HOME/pvm3/bin/PVM_ARCH.