Am 25.05.23 um 19:01 schrieb Steve Kargl:
On Thu, May 25, 2023 at 04:05:11PM +0000, Thompson, Matt (GSFC-610.1)[SCIENCE 
SYSTEMS AND APPLICATIONS INC] via Fortran wrote:
Thomas,

Well, the code did not change. Period. Neither did the compiler. It was 12.3. 
(We can't use GCC 13 because it seems not to like something in our advanced 
Fortran code (lots of OO, submodules, string fun...)).

And I did a run with essentially all the GNU checks on (our Debug build mode) 
and it happily runs!

That said, I did some further tests and I am *really* confused. This fails:

-O3 -march=haswell -mtune=generic -funroll-loops -g

And this works:

-O2 -march=haswell -mtune=generic -funroll-loops -g

Now I just tried:

-O2     -fgcse-after-reload    -fipa-cp-clone    -floop-interchange    
-floop-unroll-and-jam    -fpeel-loops    -fpredictive-commoning    
-fsplit-loops    -fsplit-paths    -ftree-loop-distribution    
-ftree-partial-pre    -funroll-completely-grow-size    -funswitch-loops    
-fversion-loops-for-strides  -march=haswell -mtune=generic -funroll-loops -g

which as far as I can see from the gcc man page:

        -O3 Optimize yet more.  -O3 turns on all optimizations specified by -O2 
and also turns on the following optimization flags:

            -fgcse-after-reload -fipa-cp-clone -floop-interchange 
-floop-unroll-and-jam -fpeel-loops -fpredictive-commoning -fsplit-loops 
-fsplit-paths -ftree-loop-distribution -ftree-partial-pre -funswitch-loops
            -fvect-cost-model=dynamic -fversion-loops-for-strides

means I am running essentially -O3.

But it works.

I'm...baffled. Is there something that *gfortran* enables with -O3 that isn't 
visible from the *gcc* man page?


When I look at the complete *difference* of
  gfortran-12 -c -Q --help=optimizers
between -O2 and -O3, I see other differing parameters:

-  -fvect-cost-model=[unlimited|dynamic|cheap|very-cheap]       very-cheap

+  -fvect-cost-model=[unlimited|dynamic|cheap|very-cheap]       dynamic

Could these be relevant?

Harald

  • ... Thompson, Matt (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC] via Fortran
    • ... Thomas Koenig via Fortran
      • ... Thompson, Matt (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC] via Fortran
        • ... Steve Kargl via Fortran
          • ... Harald Anlauf via Fortran

Reply via email to