questions on gfortran
Luca Trevisani
lucatrv@hotmail.com
Fri May 11 13:42:00 GMT 2007
Hi François,
first of all... sorry for the late answer...
> The gcc.exe file in that package is the C compiler that comes from the
> same build as the Fortran compiler. It should work. Can you explain how
> it fails?
I've checked again, if I compile the classic "hello world" code, I get
the following message:
"hello.c:1:19: error: stdio.h: No such file or directory"
Now I understand it's a path search problem, but I'm not sure if it's better
to add the folder gfortran/include (and its subfolders) to the PATH
variable, or add them to the INCLUDE variable, or otherwise if
it's better to correct the problem in the binaries themselves.
>> Third, from my tries (although not 100% sure yet), I think I found that
>> flags like -march=pentium4 and -mfpmath=sse don't give significant
>> performance gains with gfortran under windows, while they do under linux
>> (I know, I should do some deeper testing before telling this...).
>> However, do you know if they are activated also in the windows binaries?
>
> I'm not very good with optimization flags, so I hope other people here
> can help you... But don't you also need -msse with -mfpmath=sse?
>
For all I know, the right -msse2 flag should be already activated since I
use -march=pentium4:
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options
Since I saw on this mailing list a code that has already been used for
benchmarks by some people, I tried the following (little) different one
(which is more similar to how I usually write code in f95):
PROGRAM PROVA
IMPLICIT NONE
INTEGER, PARAMETER :: WP = KIND(1.0D0)
INTEGER, PARAMETER :: NX=10000, NY=10000
INTEGER :: I, J
REAL(WP) :: A(NX,NY), X(NX), Y(NY)
REAL(WP) :: T1, T2
CALL CPU_TIME(T1)
DO I=1,NX
X(I)=2.0_WP/REAL((NX+1)*I-1,WP)
END DO
DO I=1,NY
Y(I)=2.0_WP/REAL((NY+1)*I-1,WP)
END DO
DO J=1,NY
DO I=1,NX
A(I,J)=SIN(1.0_WP+REAL(I+J,WP))
END DO
END DO
CALL CPU_TIME(T2)
PRINT *, 'Execution time:', T2-T1
END PROGRAM PROVA
I tried to compile and run it with different flags, under win32 and
linux (gentoo). Note that linux is actually running under vmware on the same
machine. Moreover, note that onder win32 I use the last experimental
binaries (version 4.3.0), while under linux I use gfortran version 4.1.1
I made different benchmarks using KIND(1.0D0) (double precision) and with
KIND(1.0) (real).
These are the results (D 10.0/11.0 means: results using double precision, 10
s under win32 and 11s under linux)
gfortran
D 27.0/21.7
R 8.9/10.0
gfortran -O2
D 26.5/19.5
R 8.0/9.9
gfortran -O2 -march=pentium4
D 26.5/19.0
R 7.9/9.3
gfortran -O2 -march=pentium4 -mfpmath=sse
D 26.6/19.0
R 7.9/9.5
gfortran -O2 -march=pentium4 -mfpmath=sse -fomit-frame-pointer
D 26.6/18.9
R 7.8/9.7
gfortran -O3 -march=pentium4 -mfpmath=sse -fomit-frame-pointer
D 26.6/19.4
R 7.8/9.6
gfortran -O3 -march=pentium4 -mfpmath=sse -fomit-frame-pointer -ftree-vectorize
D 26.5/19.9
R 7.9/9.8
In conclusion, now it seems to me that actually all flags other than -O2 are
almost uninfluential on the execution speed, both under win32 and under
linux...
Thank you, bye.
Luca
PS. regarding the new gfortran binaries for windows, I would have 3 other
(not really important) questions...
1) is the msys-1.0.dll file still required now?
2) I noticed that the installer only sets the user PATH variable. It would
be better to ask if installing for the user or for all, and changing the
relative variable accordingly. If that is difficult, my idea is that
probably it would be better to modify only the system PATH.
3) Would it be possible to add the uninstaller to the list of Add/Remove
applications?
More information about the Fortran
mailing list