This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gfortran vs ifort


Girish Kulkarni wrote:
> Hi Tim,
> 
> Thanks for your reply.  I managed to improve the factor of five
> comparison to factor of two.  (Described in another message that I
> just posted to this list.)
> 
> On Fri, 22 May 2009, Tim Prince wrote:
>> If you choose your compiler according to whether you like the
>> default options, you won't get good results.
> 
> Right, noted.  The compiler options you provided improve gfortran
> performance relative to ifort, but they are still not comparable.
> auto-vectorization doesn't help either.  These might partly be issues
> with my code.
> 
>> Comparison of math function accuracy and performance is a
>> complicated issue.
> 
> Moreover comparing accuracy in my case is hard.  Both compilers give
> similar numbers for all easy test cases but they differ by as much as
> 20% in the really complicated case (which is the purpose of the code).

If you have such large differences, supposing that they go away with the
ifort options I suggested, this would indicate that you shouldn't use
aggressive options which don't adhere to standards. The ifort default
options will perform algebraic simplifications in violation of
parentheses; I suggested options which are more consistent with gfortran.

On the other hand, if you wish to set gfortran options which resemble the
ifort default, I would suggest
-O3 -ffast-math -funroll-loops --param max-unroll-times=4
plus, (for Core i7), -mtune=barcelona -msse4.

Also, ifort is more aggressive about eliminating dead code and
interchanging loops; in such a case, you might resolve the differences in
your source code.
Beyond that, you will want to set the verbose options, such as
gfortran -ftree-vectorizer-verbose=2
ifort -vec-report2
so as to see the compiler diagnoses about differences in auto-vectorization.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]