program matmul_time c integer i, j, k integer size, ntimes, m, n, p parameter (size=1000) parameter (m=size,n=size,p=size) parameter (ntimes=1) real*8 a, b, c, arow dimension a(m,n), b(n,p), c(n,p), arow(n) c integer l real walltime, mflops integer hz, clock0, clock1, clock2 real etime real tarray(2), time0, time1, time2 c do i = 1, m do j = 1, n a(i,j) = 1.0 enddo enddo do i = 1, n do j = 1, p b(i,j) = 1.0 enddo enddo c time0 = etime(tarray) do l = 1, ntimes !$omp parallel !$omp do do j = 1, p do i = 1, m c(i,j) = 0.0 enddo enddo do i = 1, m !$omp do do ii = 1, n arow(ii) = a(i,ii) enddo !$omp do do j = 1, p do k = 1, n c(i,j) = c(i,j) + arow(k) * b(k,j) enddo enddo enddo !$omp end parallel call dummy(c) enddo time1 = etime(tarray) do i = 1, ntimes call dummy(c) enddo time2 = etime(tarray) c walltime = ((time1 - time0) - (time2 - time1)) / real(ntimes) mflops = (m*p*(2*n-1)) / (walltime * 1.0e+06) print *, walltime, time0, time1, time2 c print *, "M =",M,", N =",N,", P =",P print *, "MFLOPS = ", mflops print *, "c(1,1) = ", c(1,1) c end c subroutine dummy(c) real*8 c return end