



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An mpi assignment for csi 702 students, which involves completing two problems using mpi for parallelization. The first problem is the diffusion equation, where students need to write a serial code, modify it for mpi, and analyze performance. The second problem is the mandelbrot set, where students must create a parallel version using the manager/worker programming pattern. The document also mentions an n-body assembly line and parallel sort problem.
Typology: Assignments
1 / 6
This page cannot be seen from the preview
Don't miss anything!




CSI 702- Fall 2008 - Assignment 3 Due: Wednesday October 15
Overview For this assignment, you will experiment with several of the code tuning techniques we covered in class. You may write your codes in C, C++, or Fortran. The timing results should be done using the profilers for the ap- propriate compiler. The final assignment will be turned in at the beginning of class. Electronic submissions will not be allowed for this assignment, and there will be a penalty for late submission. NOTE: October 15 is the night of our midterm exam. Elements of these assignments may be included as part of this exam.
Requirements: For this assignment, you will need to
The diffusion equation is a simple parabolic partial differential equation that can be solved numerically using a finite difference method.
dφ dt
= κ ▽^2 φ
in one dimension
dφ dt
= κ
d^2 φ dx^2
The simple finite difference representation of this equation is in one di- mension
φi,j+1 − φi,j k
= κ
φi+1,j − 2 φi,j + φi− 1 ,j h^2
or
φi,j+1 = φi,j + κ
k h^2
(φi+1,j − 2 φi,j + φi− 1 ,j )
φi,j+1 =
( 1 − 2 κ
k h^2
) φi,j +
( κ
k h^2
) (φi+1,j + φi− 1 ,j )
where h is the spatial grid size, k is the time-step size, and κ is a diffusion coefficient. For this problem, let
xmin = 0 xmax = 1 φ(xmin) = 0 φ(xmax) = 0 κ = 1 k = 0. 2 × h^2 t 0 = 0 tf inal = 0. 5
It is important to note that some starting points will never reach C > 2, so a maximum iteration number is needed in the problem (500 iterations, for example.) For this problem, you are to make a parallel version of the Mandelbrot problem that uses the manager/worker programming pattern. You cannot use the fine grain scatter decomposition we discussed in the notes for this problem.
(a) To do this, you should designate node 0 to manage the work load. (b) Each CPU will be given an initial parcel of work to do. (c) Processor 0 will then listen for communications from the others using asynchronous communication. (d) When any processor finishes its work block, it should send a mes- sage to processor 0 asking for another block. At the same time, it should send its results back to node 0 so they can be output to a file. It should go in a receive state to get the message from node 1 about which block to do. (e) Processor 0 will assign the processor a new block, and update the list of things left to do. If there are no blocks left to be calculated, then it should tell the CPU to exit.
In this problem, you will solve the gravitational potential for a set of particles using an assembly line programming paradigm.
The gravitational potential for a given particle is given by the equations
φj =
∑^ n
i=1,i 6 =j
−GMiMj Rij
So, to calculate the gravitational potential, you need to have a loop over all the particles like
for j = 1:n potential(j) = 0 for i = 1:n if (i /= j) then R_ij = sqrt( (x(i) - x(j))^2 + (y(i)-y(j))^2) + (z(i)-z(j))^2) potential(j) = potential(j) -G * M(j) * M(i)/ Rij endif enddo enddo
To do this in parallel, you will use the “assembly line” programming pattern. Assume you are running n particles over nproc processors