PROGRAM MATMUL_TIME C INTEGER I, J, K INTEGER SIZE, NTIMES, M, N, P PARAMETER (SIZE=2000) 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*8 OMP_GET_WTIME REAL*8 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 = OMP_GET_WTIME() 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 = OMP_GET_WTIME() DO I = 1, NTIMES CALL DUMMY(C) ENDDO TIME2 = OMP_GET_WTIME() C WALLTIME = ((TIME1 - TIME0) - (TIME2 - TIME1)) / REAL(NTIMES) MFLOPS = (M*P*(2.0*N-1.0)) / (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