Fortran compiler strangeness
Stefano Simonucci
stefano.simonucci@unicam.it
Wed May 9 15:12:00 GMT 2007
Hi.
I have used gfortran to compile a little program
with the command
gfortran -O2 prova.f
program prova
parameter(Nx=10000,Ny=10000)
real*8 A(Nx,Ny),X(Nx),Y(Ny)
do i=1,Nx
X(i)=2./(Nx+1)*i-1
end do
do i=1,Ny
Y(i)=2./(Ny+1)*i-1
end do
do i=1,Nx
do j=1,Ny
A(i,j)=sin(1.+i+j);
end do
end do
end program
then I have execute the program
time ./a.out
real 1m58.509s
user 1m57.035s
sys 0m0.792s
An analogous program in C takes 22 sec.
Then I have changed sin(1.+i+j) with sin(1.d0+i+j)
and I get the following execution time
real 0m23.868s
user 0m22.737s
sys 0m0.864s
This behaviour seems strange.
Thank you
--
Stefano Simonucci <stefano.simonucci@unicam.it>
More information about the Fortran
mailing list