PPT Slide
subroutine ijk ( A, ii, jj, lda, B, kk, ldb, C, ldc )
double precision A(lda, *), B(ldb, *), C(ldc, *)
integer = i, j, k
do i = 1, ii
do j = 1, jj
do k = 1, kk
A(i,j) = A(i,j) + B(i,k) * C(k,j)
enddo
enddo
enddo
return
end
Instructions: For this exercise, use the files provided in the directory matmul1-f. You will need to work on the file matmul.f. Again, if you are extremely stressed, consult matmul.f.ANS, where there is one possible solution.
(a) Compile the code: make matmul and run the code, recording the Mflops values in a table like the one on the next page.
(b) Edit matmul.f and alter the orderings of the loops, make, run and repeat for the various loop orderings. Complete a table like the one below, which shows the orderings of the loops for each set of randomly generated matrices A, B, and C, or order Order. Enter the Mflops achieved while computing A = A + B * C using each of the four different ways to perform matrix multiplication..