MSc in Network Centered Computing

Module: PVM and MPI

additional information for the assignment

a possible basic program design in PVM

1. read matrix A and B from file or use defined matrixes in the source code
2. decision: is it possible to calculate with given number of processors ?
3. set number of slaves
4. spawn the slave programs
5. pack all important information for slaves
6. send a part of matrix A and B to each slave
7. unpack received matrices
8. compute matrix
9. shift matrix A to other slave (not for Matrix by Vector multiplication)
10. receive all calculated parts of matrix C from all slaves
11. save matrix C into a file or just print it out

examples

Here is the hello sample to make some first test's (please change in the hello.c file the path to hello_other.c to your own directory):
hello.c
hello_other.c

To see the difference between SPMD and Master/Slave look here ( spmd.c and master1.c / slave1.c):
more examples

useful functions

It can be useful to use the following PVM functions:
- pvm_spawn Starts new PVM processes
- pvm_config Returns information about the present virtual machine configuration
- pvm_mytid Returns the tid of the calling process
- pvm_parent Returns the tid of the process that spawned the calling process
- pvm_kill Terminates a specified PVM process
- pvm_exit Tells the local pvmd that this process is leaving PVM
- pvm_initsend Clear default send buffer and specify message encoding
- pvm_pkint Pack the active message buffer with arrays of prescribed data type
- pvm_pkfloat Pack the active message buffer with arrays of prescribed data type
- pvm_send Immediately sends the data in the active message buffer
- pvm_recv Receive a message
- pvm_bufinfo Returns information about a message buffer
- pvm_upkfloat Unpack the active message buffer into arrays of prescribed data type
- pvm_freebuf Disposes of a message buffer
- pvm_catchout Catch output from child tasks. This is very useful for debugging the souce code.
More functions are to find here: PVM man pages

For parallel matrix multiplication it is necessary to split the matrix A and B into blocks and spawn them to the slaves. The following picture can help you, better to understand how this process works.

parallel matrix multiplication
Here you can find a even more detailt description of how the matrix-matrix multiplication works on parallel machiens.

back to the main page

© Oliver Otto - The University of Reading / Salford