Department of Software Engineering: Course Code: CS332 Class: BESE6AB Lab 12: MPI (Part 2)
Department of Software Engineering: Course Code: CS332 Class: BESE6AB Lab 12: MPI (Part 2)
Class: BESE6AB
Its time to benchmark the data transfer between two processes. let's write a simple program
(pingpong) in which two processes send packets of information back and forth several times and
record the amount of time required. The packets of information consist of an array of dummy
floating point numbers which vary in length from one floating point number to 10,001 floating
point numbers. These packets are sent back and forth from one process to another 100 times and
the total amount of time required is recorded. From this timing data the average amount of time
per send/receive is computed as well as the transfer rate (bandwidth) in bytes/sec.
First of all, you'll need to use the MPI_Wtime() routine for timing the calls. This routine returns
the time expressed in seconds (see man MPI_Wtime). In order to time something two
MPI_Wtime() calls are needed and the difference between the returned values should be taken to
obtain the total elapsed time (in wall clock seconds).
After you've inserted two MPI_Wtime() calls to estimate the average time taken for one message
to complete a one way trip, calculate the transfer rate in bytes per second. What did you find?
Now, add a loop around the timing calls changing the length of the message (length varies from
1 to 10001 in increments of 1000) to investigate how the time taken varies with the size of the
message. Note the reading by varying the size to 90001
Deliverables