CPS-615 -- Program Examples -- Fall 1996
CPS-615 -- List of Programming Examples -- Fall 1996
Table of Contents
- Example-1
- Brief description:
The program will solve Laplace heat equation over a rectangle by the
Red/Black SOR method. The main subroutine implements the
Gauss-Seidel overrelaxation scheme using the odd-even
algorithm. The SOR update is computed afterward.
- The source code: for the DEC Alpha
cluster and a second version for the IBM SP2. A sample
run on the SP2 is here.
- Example-2
- Brief description:
Implementation of Fast Fourier Transforms (FFT).
- The source code: is here and a slightly
different version is here.
- Example-3
- Brief description:
The program will solve a linear system of equations by Gauss
elimination with partial pivoting.
- The source code: is here .
- Example-4
- Brief description:
An implementation of Floyd All-to-All shortest path algorithm.
- The source code: is here .
- Example-5
- Brief description:
Implementations of gather and scatter with HPF.
- The source code: for
gather and scatter.
- Example-6
- Brief description:
A reasonably good implementation of the
Nbody problem.
- The source code: which was tested on the DEC AlphaFarm
via VPL is available here.
- Example-7
- Brief description:
This is an example of a simple CFD implementation solving the
Laplace equation for Psi over a grid that is shaped into an air
vent. he grid is shaped using the logical variable Hide. The program
uses the Red/black SOR method.
- The source code is available here .
Back to top of the page
- Example-1
- Brief description:
Using Monte Carlo methods, two things are computed:
- Pi as the area of a circle of radius 1 in a 2-D space.
- The volume of a d-dimensional hypersphere of radius
1. The dimension is between 1 and 10.
So essentially the program performs 4 steps:
- Compute the volume of the unit sphere, in a random
manner, and given the dimension, few darts are thrown at an area
between 0 and 1.
- Determine the frequency of those darts that fell within
this area and those falling outside it. Then, within each processor
given this frequency and the number of tries, the average is computed.
- After computing the average or mean, the overall volume
of the sphere is easily computed. Essentially, we multiply this
average by 2^(dim) giving us the overall volume.
- Given the average, sphere darts, and per processor tries,
we compute the standard deviation.
- The source code: here is the program for
this method. Here is also another source
( the header) computing Pi using Monte
Carlo method.
- Example-2
- Brief description:
Using Simpson's rule we compute the value of Pi. When using this
approach and integrating on a multiprocessor, the logical thing to do
would be to partition the interval to subintervals and make each
processor run on one of these subintervals. In turn, each processor
applies Simpson's rule to its own interval, again, partitioning it
into subintervals of equal number to the one above it, etc. Among the
processors, one takes charge of receiving and adding up the results.
- The source code is available here.
- Example-3
- Brief description:
This is a list of programs from the
book Parallel Programming with MPI by Peter Pacheco, Morgan Kaufmann
Publishers. Many of these programs are self-contained and should
compile with no problems.
- The source code: The source files are inside the
the book chapters that are listed here.
- Example-4
- Brief description:
This example is about the topologies and forms of communication
between various processors.
- The source code can be found here.
- Example-5
- Brief description:
Another simple implementation of the Nbody problem. This uses the simple but highly
suboptimal n^2 algorithm, and does not take advantage of symmetry.
The time integrator is a simple leapfrog scheme.
- The source code can be found here.
- Example-6
- Brief description:
An example of a set of routines to circulate data around in a ring.
- The source code is
here.
- Example-7
- Brief description:
This is an example of particles interaction. To make it simple, it is
assumed that every process is responsible for the same
number of particles. Also, every process initializes positions and
mass of particles it is responsible for.
- The source code is here.
Back to top of the page
- Example-1
- Brief description:
This is a list of programs from the
book Parallel Programming with MPI by Peter Pacheco, Morgan Kaufmann
Publishers. Many of these programs are self-contained and should
compile with no problems.
- The source code: The source files are inside the
the book chapters that are listed
here.
- Example-2
- Brief description:
This program calculates the value of pi, using numerical integration
with parallel processing. The user selects the number of points of
integration. By selecting more points you get more accurate results
at the expense of additional computation
- The source code is here.
- Example-3
- Brief description:
Implementation of Fast Fourier Transforms (FFT).
- The source code: is here.
- Example-4
- Brief description:
Implementation of the two concepts of gather and scatter
with MPI.
- The source code of the gather and the scatter.
- Example-5
- Brief description:
This program finds the force on each of a set of particles interacting
via a long-range 1/r**2 force law.
The number of processes must be even, and the total number of points
must be exactly divisible by the number of processes.
- The source code can be obtained from here.
- Example-6
- Brief description:
There are a number of examples from the book "Using MPI" by
Gropp, Lusk and Skjellum.
- The source code is available here
- Example-7
- Brief description:
David Walker of ORNL has an Nbody example as well as a
2D Laplace SOR Solver both implemented in MPI. The SOR solver
solves Laplace's equation on a two-dimensional rectangle
using the successive over-relaxation method with red/black
ordering. The number of particles per processor in each direction must
be even.
- The source code for the
N-body and the SOR solver
source code. Also there is a Fortran code to solve a 2D
Laplace equation using Jacobi iteration.
- Example-8
- Brief description:
A list of examples on Redistribution of Block Cyclic Data
Distributions described in a paper by the same title by Walker and
Otto. The code is self-checking and averages results over several
calls to a redistribution routine. The output file gives the average
time for a call, together with the standard deviation, minimum and
maximum times.
- The source code is available from this page.
Also there is a simple
integration example.
Back to top of the page