| MPI Exercise Code Descriptions |
Note that the C and Fortran versions of this code differ because of the
way arrays are stored/passed. C arrays are row-major order but FORTRAN
arrays are column-major order.
The parallel version has two variations, one which demonstrates
point-to-point communications and one that demonstrates collective
communications.
A vibrating string is decomposed into points. In the parallel version,
each processor is responsible for updating the amplitude of a number of
points over time. At each iteration, each processor exchanges boundary
points with their nearest neighbors.
The parallel versions provide an X based display of the final wave.
The parallel versions provide an X based display of the initial and final
temperature distributions.
Note: A straightforward unsophisticated 1D FFT kernel is used. It is
sufficient to convey the general idea, but be aware that there are
better 1D FFTs available on many systems.
A single processor reads the input image from disk and broadcasts to all the
other processors in the system. Each processor allocates space for a
contiguous swath of rows in the output image. Processors then calculate the
coordinates of the source input image pixel for each pixel in this output
image swath. Individual swaths of the output image are then collected at the
destination processor. The destination processor then displays the image on
the local X server.
Note: When running this program make sure that your DISPLAY environment
variable is set and that the MP_PROCS environment variable is set to 4.
Each processor calculates the image pixels for a swath of rows in the
output image. These swaths of rows are then collected at a single
processor and displayed on the screen.
This program implements the concurrent wave equation described in Chapter
5 of Fox et al., 1988, Solving Problems on Concurrent Processors, vol 1.
Sample image
This example is based on a simplified
two-dimensional heat equation domain decomposition. The initial
temperature is computed to be high in the middle of the domain and
zero at the boundaries. The boundaries are held at zero throughout
the simulation. During the time-stepping, an array containing two
domains is used; these domains alternate between old data and new data.
Before
After
It then sends/receives N roundtrips of incrementally sized messages
from start size J to finish size K by increment I. The bandwidth for each
message size is calculated as the average of N round trips.
This example is written in C using MPI. An image is read from disk
and repeatedly rotated by one degree increments. After each image rotation
the screen is updated.
Sample image
This program generates and Mandelbrot image and displays it using X Windows.
It is written in C using MPI.
Sample image