Fortran compiler strangeness

Brian Barnes bcbarnes@artsci.wustl.edu
Wed May 9 16:30:00 GMT 2007


I have reproduced his error on one of two machines I tested.  First, the
system where everything is okay.  On this system, ifort and gfortran give
the same timings for his code, using "1.d0" "1.e0" or "1." inside his sin
function.  Each run takes about 15 seconds.

[barnes@grapes ~/temp]$ uname -a
Linux grapes.wustl.edu 2.6.20-1.2944.fc6 #1 SMP Tue Apr 10 18:46:45 EDT
2007 i686 i686 i386 GNU/Linux
[barnes@grapes ~/temp]$ ifort -v
Version 8.0
[barnes@grapes ~/temp]$ gfortran -v
Target: i386-redhat-linux
[edit for space, FC6 machine]
gcc version 4.1.1 20070105 (Red Hat 4.1.1-51)
[barnes@grapes ~/temp]$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Pentium(R) 4 CPU 2.80GHz
stepping        : 9
cpu MHz         : 2800.261
cache size      : 512 KB
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca
cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid xtpr
[edited for space]
processor       : 1
(same as processor 0)

On my other system, my desktop, things are not nice at all!  Also, during
the runs, memory use explodes.  Consequences of a 10000x10000 real*8
array.  Both machines I tested have 1 gig of RAM.  The program takes
~773meg.

using 1.d0:
[barnes@granta ~/temp]$ time ./a.out
38.414u 2.148s 0:41.86 96.8%    0+0k 0+0io 1pf+0w

using 1.e0:
[barnes@granta ~/temp]$ time ./a.out
127.569u 1.955s 2:09.75 99.8%   0+0k 0+0io 0pf+0w

using plain 1.:
[barnes@granta ~/temp]$ time ./a.out
128.645u 2.251s 2:11.24 99.7%   0+0k 0+0io 0pf+0w

All timings are __significantly__ slower than the 2.8 GHz Intel machine,
although my processor in this machine is a top of the line Opteron.  One
difference between installs is that the slower machine is x86_64, and the
Intel is completely i386 linux.  Here are the details:

[barnes@granta ~]$ uname -a
Linux granta.wustl.edu 2.6.18-8.1.1.el5 #1 SMP Mon Apr 9 09:43:24 EDT 2007
x86_64 x86_64 x86_64 GNU/Linux

[barnes@granta ~]$ gfortran -v
[CentOS5 machine]
gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)

[barnes@granta ~]$ cat /proc/cpuinfo
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 35
model name      : Dual Core AMD Opteron(tm) Processor 170
stepping        : 2
cpu MHz         : 2009.800
cache size      : 1024 KB
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm
3dnowext 3dnow pni lahf_lm cmp_legacy
[clip for space]
processor       : 1
(same as processor 0)


As you can see, the machines are using the same build date of gfortran,
and have the same RAM.  The main differences are x86_64 vs i386 and AMD vs
Intel.  The x86_64/AMD machine displays the really slow runtimes and
irregular 1.d0 vs 1.e0 vs 1. behavior.

I am a bit concerned about this personally, as we use quite a bit legacy
of Fortran77 code which contains pieces with style similar to Stefano's
testcase.

-Brian



More information about the Fortran mailing list