Code:
subroutine fillMat(Mat,n)
implicit none
integer :: i, j
integer :: n
real*8 :: Mat(n,n)
do j=1,n,1
do i=1,n,1
call random_number(Mat(i,j))
end do
end do
end subroutine fillMat
program main
implicit none
integer :: n
integer :: seed(30)
integer :: c1, c2, count_rate, count_max
real*8 :: alpha, beta
real*8, allocatable :: A(:,:), B(:,:), C(:,:)
seed=1
call random_seed(put=seed)
do n=100,4900,300
allocate(A(n,n),B(n,n),C(n,n))
call fillMat(A,n); call fillMat(B,n); call fillMat(C,n)
call random_number(alpha); call random_number(beta)
CALL SYSTEM_CLOCK(c1,count_rate,count_max)
call dgemm('N','N',n,n,n,alpha,A,n,B,n,beta,C,n)
CALL SYSTEM_CLOCK(c2,count_rate,count_max)
write(*,*) n, dfloat(c2-c1)/dfloat(count_rate)
deallocate(A,B,C)
end do
end program main