| [<< home] [Lab 1] [Lab 2] [Lab 3] |
Note: students will present their solution for the exercices on the computer during the class.
You must first install iscc, that you can find in
the Barvinok
package.
For the following code, write the ISCC program in order to:
A.
for (i = 0; i < N; ++i)
for (j = 0; j < N; ++j)
for (k = 0; k < N; ++k)
C[i][j] += A[i][k] * B[k][j];
Note: students will present their solution for the exercices on the computer during the class.
Write an algorithm that creates automatically the (sequence of)
transformations, in the form of a scattering function, to tile a loop
nest of a given depth. The algorithm takes as an input (1) the number
of loops d in a perfectly nested, permutable loop nest;
(2) a tile size (scalar) s; and (3) a scattering function
that maps some input space into a 2d+1 output space.
Apply the algorithm of the previous exercise to compute the tiling
transformation for matrix-multiply, where the input scattering
permutes the loops i and k.
for (i = 0; i < N; ++i)
for (j = 0; j < N; ++j)
for (k = 0; k < N; ++k)
C[i][j] += A[i][k] * B[k][j];
Note: students will present their solution for the exercises on the computer during the class.
Write the algorithm(s) to automatically create and place communications from main memory to a local buffer, for a program that is perfectly nested and contains only permutable loops. The program has to be tiled by your algorithm, and the communications must be at the granularity of a tile (that is, all elements required by a tile are copied before a tile executes).
Your algorithm must:
d loops), using square tiles of
size TsApply the algorithm of the previous exercise to tile and compute communications for matrix-multiply.
for (i = 0; i < N; ++i)
for (j = 0; j < N; ++j)
for (k = 0; k < N; ++k)
C[i][j] += A[i][k] * B[k][j];
Apply the algorithm of the previous exercise to tile and compute
communications for jacobi-1d. A pre-transformation is required to make
tiling legal: { s1[t,i] -> [t,2t+i,0]; s2[t,i] -> [t, 2t+i+1, 1]}.
for (t = 0; t < tsteps; t++)
{
for (i = 1; i < n - 1; i++)
B[i] = 0.33333 * (A[i-1] + A[i] + A[i + 1]);
for (i = 1; i < n - 1; i++)
A[i] = B[i];
}