Information Technology Reference
In-Depth Information
the parallelizable computations be increased such that we can achieve an improved
speedup
S
2
?
˘
Exercise 10.8.
The so-called “Ping-Pong” test is a well-used technique for measur-
ing the values of latency
and bandwidth
1=ˇ
, which are used in (10.19). More
specifically, a pair of processors keeps exchanging a message of length
L
1
sev-
eral times, using the
MPI Send
and
MPI Recv
commands. The measured time is
then divided by twice the number of repetitions that the message was bounced
between the two processors, giving rise to the actual cost of
t
C
.L
1
/
. Thereafter,
the Ping-Pong test is repeated for different values of
L
, resulting in measurements
of
t
C
.L
2
/
,
t
C
.L
3
/
, and so on. Write an MPI program that implements the above
Ping-Pong test, and then uses the method of least squares to estimate the values of
and
1=ˇ
.
˘
Exercise 10.9.
Implement a serial code that performs a matrix-vector multiplica-
tion, where the matrix is dense and of dimension
n n
, and the vector is of length
n
.
Parallelize the code using both OpenMP and MPI and compare the obtained speedup
results.
˘
Exercise 10.10.
Carry out the performance analysis of Algorithm
10.1
in the same
fashionasinExample
10.4
. The one-to-one message transfer cost model (10.19)
should be used in the analysis, while the actual values of
and
ˇ
are obtained from
Exercise
10.8
. Then, use the MPI program as described in Example
10.9
to verify
the actual speedup results. Based on the time measurements, can you quantify how
expensive it is to update one inner point
u
`C1
i
, relative to the value of
?
˘
10.5
Project: Parallel Solution of a 2D Diffusion Equation
Let us consider the following scaled diffusion equation in two space dimensions:
@
2
u
@x
2
@
2
u
@y
2
@
u
@t
D
C
C f .x; y; t/;
.x; y/ 2 .0; 1/ .0; 1/;
t > 0:
(10.22)
For the initial condition we have
u
.x;y;0/ D I.x; y/
, and the boundary conditions
are as follows:
u
.1;y;t/ D D
1
.y; t /;
t > 0;
u
.x;1;t/ D D
2
.x; t /;
t > 0;
@
@x
u
.0;y;t/ D N
3
.y; t /;
t > 0;
@
@y
u
.x;0;t/ D N
4
.x; t /;
t > 0: