A parallel solution to the 1-D heat diffusion problemFall 2001
Background:
The non-parallel version of this program was assigned toward the beginning of CS 471: Scientific Computing
taught by Dr. Don Morton. Later on in the course Dr. Morton wanted to teach us parallel programming.
He felt that the best way to do that was for us to parallelize a program we have already done.
The 1-D heat diffusion problem was that program.The significance of this program is that it was the
first parallel program (besides "hello world") that I wrote.
The problem:
The two ends of a wire are at different temperatures.
How is this heat spread out through the wire?
The solution:
This is a slide taken from Don Morton's CS 471 Class notes.
It sums up the problem and starts an explanation on a solution.
For the solution, cut the wire into discrete sections and solve the partial differential equation.
The solution to any point at the next point in time is a function of the current temperatures of
that point, and the points to the left and right of it.
Here is the MPI FORTRAN program that I wrote.
assign9.F
Here is a sample of the output of that program run with 800,000 points on the wire and run on 4 processors.
2: time = 3.262612000000000 seconds
3: time = 3.261373000000000 seconds
1: time = 3.263469000000000 seconds
0: time = 3.262794000000000 seconds
total processor time was 13.050248000000000 seconds
average processor time was 3.262562000000000 seconds
|
The reason the times are the only output is because the main point of the program was to compare the times
of the parallel and the non-parallel program.
Here are two graphs that summarize some runs of the program
Although the only output from the program is only timings, it could easily output the temperatures of the wire
over time. The first version (non-parallel) of the program was to do this and display it using grads, a data
visualization package.
What I learned:
The main thing I learned in this assignment was Message Passing Interface (MPI). This assignment
sparked my interest of parallel programming. In this assignment I used MPI in FORTRAN. I also
learned a little about MPI in C and C++ and (my favorite) MPI in JAVA.
page last updated May 2003
|