Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28486 Discussions

Compilation Ok and program now runs ! Explanation.

xtof
Beginner
303 Views
Hi,

Briefly, in a previous post I explained that I tried to run my code written in F77 with Ifort under Suse 10.0 and that I faced some problems. In particular the compilation went ok but the code was not running at all, not even killed.

Today I was playing with the optimization options of the g77...and I remembered that when I create the library with the optimization option -O2, my code does not run at all although it compiles without any error...I thought...hmmm hmmm...looks like what I have with Ifort...

I decided then to check all the default options in Ifort...and I found out that -O2 is by default. Then I created my library with the option -O0 instead of the default one...and now the code runs !! And substantially faster than with g77 !

Ok, now could someone explain me why a code does not run when a library is created with -O2 ? Is it something general ?

Xtof

0 Kudos
5 Replies
Ron_Green
Moderator
303 Views

I have no idea. I think Steve L. suggested opening an issue on Premier Support (premier.intel.com) where you attach your code.

ron

0 Kudos
xtof
Beginner
303 Views
The point is that this code is doing that even with g77. If I create the librarie .a with -O2, the code does not run. The same occured with ifort which has -O2 by default. When I switched off this option when compiling the library, the code could run. The important thing would be to understand why it is so, with g77 and with ifort. But I leave that to specialists ! I am physicist !!

Xtof

0 Kudos
Steven_L_Intel1
Employee
303 Views
Without seeing the code, my guess would be that there is a coding error that is aggravated by optimization.
0 Kudos
oh_moose
Beginner
303 Views
I am a physicist, too. That is no excuse for not posting the code. :-)

0 Kudos
Steven_L_Intel1
Employee
303 Views
I will comment that one compiler's -O2 is different from another compiler's -O2. The set of optimizations done and not done vary by compiler. You can't compare optimization levels across different compilers.

If your code does not run with optimization, especially with two different compilers, that strongly suggests you have a bug in your code. You should avail yourself of the diagnostic capabilities of the compilers. I'll also comment that there's no reason to still be using g77 nowadays - use gfortran or g95 instead.
0 Kudos
Reply