- The plan
- Write a program which determines the names and the local time of all the
physical machines in the virtual machine and prints the information to standard
output.
- The model
- The most successful and probably the most straightforward model for writing
parallel programs using PVM is called Master and Slave.
The master process is the only one started by the user on one of the machines.
It then starts and controls processes on the other machines
which perform the actual work.
- The master
- has to do the following
- Determine which physical machines are part of the virtual machine
- Start a slave process on every physical machine
- Collect the result which are sent back by the slaves
- Print the results to standard output.
How this could look in C
How this could look in fortran
- The slave
- does the following
- Determine the name of the machine the process is running on.
- Determine the time on this machine
- Send a message with this information back to the master
How this could look in C
How this could look in fortran
- Compile the source codes for the slave processes with the
command,
cc -o answer c_slave.c -lpvm3
For Fortran users, you can find all commands and setup in our
Makefile.
It is important that you call the executable answer as
this is the name of the program the master process tries to
start. If you are using computers of different architecture then
you have to repeat this step on one machine
of every architecture and immediately copy the executable into the
architecture specific directories you created in your
configuration step.
- Compile the source codes for the master process by using the command,
cc -o master c_master.c -lpvm3
The resulting program is called master and you have to do this
compilation only once on the machine where you want to run the master.
- Let's Go
- After you installed and configured PVM, created your own parallel machine,
compiled all the programs and put them into their place all that is left to do
is starting the master process from the unix prompt. Type
master
you should get a result similar to
The master process runs on mango
I found the following hosts in your virtual machine
mango
goophy
daphy
coconut
mango's time is Fri May 10 13:10:50 1996
daphy's time is Fri May 10 15:15:42 1996
coconut's time is Fri May 10 13:15:46 1996
goophy's time is Fri May 10 15:17:01 1996
which makes it pretty obvious that I really have to change the time on some of
our computers.