At 17:48 06-12-00 +0100, Roland Schilling wrote:
>I was just trying out FFT routines from Numerical Recipes.
>To my great surprise I made the observation that the old
>F77 routine 'realft' (for an array of 1024 real data points)
>is twice as fast as the newer F90 version of it. I compiled
>both with the same NAGWare f95 compiler and run it on a
>233 MHz Pentium-I PC. I know that the F90 versions are
>written with regard to effective use on parallel processors,
>but didn't expect such a dramatic loss of performance on a
>single processor machine.
>
>Can anybody comment on this or has made similar experience?
>
>Thanks in advance for any reply,
>Roland
Just a few days ago I found an example from an old question
about performance 77 <--> 90/95
I retried it and had the following results:
! t-reshape.f90
program t_resh
COMPLEX :: cdata(4096)
integer :: it1, it2, i, r
real :: t1, t2
call system_clock(it1, r)
call cpu_time(t1)
do i = 1, 5000
call toto( .true.)
end do
call system_clock(it2)
print *, (it2 - it1) / real(r)
call cpu_time(t2)
print *, t2 - t1
do i = 1, 1000
call toto( .false.)
end do
call system_clock(it1)
print *, (it1 - it2) / real(r)
call cpu_time(t1)
print *, t1 - t2
contains
! Hello,
! In the subroutine:
SUBROUTINE TOTO(s)
! COMPLEX :: cdata(*)
logical :: s
integer :: N, n1, n2
COMPLEX :: cdat(64, 64)
N = 4096 ! size(cdata)
N1 = nint(sqrt(real(N)))
N2 = n / n1 ! ceiling(sqrt(real(N)))
if(s) then
! The statement:
cdat = RESHAPE(cdata, shape(cdat))
! is equivalent to:
else
! DO n = 1, n2
! cdat(:, n) = cdata((n-1)*n1+1 : n*n1)
! END DO
FORall(n = 1: n2)
cdat(:, n) = cdata((n-1)*n1+1 : n*n1)
END FORall
end if
! In fact it appears that the DO loop is faster (50%) than the RESHAPE.
! I've tested it on Sun and Cray (SunSoft and Cray compilers).
! [JvO] Salford FTN95 5 times faster (7 with /optimize)
! [JvO] Absoft V6 2 times faster (2.5 with -O[012])
! Salford 1.32 0.27 / 1.22 0.17 (Same with FORALL)
! Absoft 3.5 1.8 / 2.8 1.1
! Is there any explaination to that ?
end SUBROUTINE TOTO
end program t_resh
Best regards,
--
Jan van Oosterwijk
Computing Centre
Delft University of Technology
Phone: +31 15 278 5017
mailto:[log in to unmask]
http://huizen.dto.tudelft.nl/vanOosterwijk/
|