Posted by Jellby on February 02, 2007 at 10:52:53:
In Reply to: Re: Compilation with gfortran posted by Tobias Burnus on January 31, 2007 at 01:18:09:
: : in case you really want to compile molcas with gfortran - you should use a special configuration file:
: : ./configure -compiler gf
: : (Note, that gf.comp was developed for 32-bit OS, if you are using 64-bit computer - like AMD64 - some modifications should be made for compilation options, and GATARGET should be set to LINUX64)
: Note that the option "-malign-double" causes a lot of trouble as it changes the Application Binary Interface (ABI). This makes libgfortran (which contains the IO routines) incompatible with the program itself!
Indeed, I had to remove the -malign-double flag in the gf.comp file. Some other changes I suggest:
- The script detects only versions 3.x of gcc, so that the current versions (4.x) don't get CPU-specific flags (-march=athlon, -march=pentium). Using "tmp=`echo $CVERSION| grep '\b[34]\.'`" could be enough.
- The "fast" flags include -fexpensive-optimizations, which is already turned on by -O2 (and -O3), so it's useless to specify it there. On the other hand, by turning on -funsafe-math-optimizations (implicit in -ffast-math), the resulting test calculation hangs forever. It would be better something like: F77FLAGS="-O3 -Wall $i386FLAGS $ARCH -ffast-math -fno-unsafe-math-optimizations -funroll-loops"
- Additionaly, the file src/util/pack.f contains the line "DATA IONES/ Z'FFFFFFFF' /", which triggers an overflow error with 4-byte integers, the gfortran flag "-fno-range-check" can be used to prevent this.
: : However, you should be aware that gfortran generates a code which is 30-40% slower
: : than g77.
: I don't have any g77 numbers, but at least with the proper options, gfortran for the Polyhedron test suite only 6% slower than the Intel Fortran Compiler and only 15% slower than Pathscale which is seemingly the fastest compiler for AMD64. Thus I don't think this is generally true.
: gfortran -O is however slower than g77 -O, but with -O2 or -O3 -fvectorize-tree, gfortran outperforms g77 for the most programs.
With the above changes (and -march=athlon-xp) I get all tests run (molcas verify) in 18:40 minutes, whereas with g77 it's 22:20 (both configured with -speed fast).