[Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode
program arraymult
  implicit none
  integer, parameter:: N=2000
  integer :: i,j
  real(16),  dimension(N,N):: a=0._16, b=0._16,  c0=0._16, c1=0._16
!  real(16), dimension(N*N):: aa=0, bb=0, cc=0
  character (len=20):: date,time 
  real :: tt0,tt1
   call date_and_time(date,time)
   print *, "date=", date, ";  time=", time 
   call cpu_time(tt0)
   a=reshape([(50._16-(N**2-1._16)/2.+i,i=1,N**2)],[N,N])
   b=reshape([(100._16-(N**2-1._16)/2.+i,i=1,N**2)],[N,N])
!   aa=reshape(a,[N*N])
!   bb=reshape(b,[N*N])
   call cpu_time(tt1)
   print *, "date=", date, ";  time=", time 
   print *, "reshape spend=", tt1-tt0
   call date_and_time(date,time)
   print *, "date=", date, ";  time=", time 
   call cpu_time(tt0)
   c0=matmul(a,b)
!   c0=matmul(c0,b)
!   c0=matmul(c0,b)
!   c0=matmul(c0,b)
!   c0=matmul(c0,b)
!   c0=matmul(c0,b)
!   c0=matmul(c0,b)
!   c0=matmul(c0,b)
   call date_and_time(date,time)
   call cpu_time(tt1)
   print *, "date=", date, ";  time=", time 
   print *, "multi spend=", tt1-tt0
!  print *,"complete first"
end program