Hi,
There was a similar question to the Lahey Fortran list just recently. The reply
was that doing timing the way you do it is wrong, since you never use the
arrays y1 and y2 afterwards, the optimizer is likely to just not even execute
the statement y1=y2**2. Maybe for some reason the optimizer did not do this for
the corresponding x statement.
I suggest making a dummy external routine which accepts x1 and x2 or y1 and y2
as arguments and does nothing, and calling it before and after the timing test:
interface
subroutine dummy(y1,y2) ! Do nothing!
real, dimension(:,:), intent(inout)::y1,y2
end subroutine dummy
end interface
call cpu_time(t_start) ! Check syntax in Handbooks!
call dummy(y1,y2)
y2=y1**2
call dummy(y1,y2)
call cpu_time(t_end) ! You better use cpu_time for good timing!
Try it and see. Also, just printing one element of the result, y2, as in
write(*,*) y2(56,23)
after y2=y1**2, should omit such optimizations.
I think that there should be no difference between x and y arrays in this
program, or at least not a measurable one. I don't know of any arguments or
reasons why static arrays should always be faster (yet alone by 10%)...
Hope it helps,
Aleksandar
--
__________________________________
Aleksandar Donev
Complex Materials Theory Group (http://cherrypit.princeton.edu/)
Princeton Materials Institute & Program in Applied and Computational
Mathematics
@ Princeton University
Address:
419 Bowen Hall, 70 Prospect Avenue
Princeton University
Princeton, NJ 08540-5211
E-mail: [log in to unmask]
WWW: http://atom.princeton.edu/donev
Phone: (609) 258-2775
Fax: (609) 258-6878
__________________________________
|