1 (edited by designer 2025-06-29 16:37:09)

Topic: optimization settings for gfortran

I was playing with Claude AI, comparing its Fortran 95 code to ChatGPT - to be run on the Apple M4. Claude assumed I was using Intel's gfortran and suggested three settings for optimization. Something set to -03 for maximum optimization. Something set to -flto for link-time optimization. Something set to -march=native.

I didn't see those gfortran choices in SimplyFortran's Settings so maybe they are already set for the compiler?

So far, I've been running my routines after the Build - not compiling them to stand-alone apps. Would running a routine as a compiled stand-alone app execute way faster than running from the development environment after a Build, or just a little better (because it's the same code)?

Re: optimization settings for gfortran

All the settings you've mentioned are available in the Project Options window under the Code Generation category except the link-time optimizations.  Using Extreme as your optimization setting is the equivalent of -O3, and selecting native for the CPU and clicking Compile strictly for selection is the same as -march=native.  We don't offer link-time optimization because the GNU Fortran <-> Apple Linker compatibility doesn't really support it on any macOS platform regardless of CPU.   

And just to clarify, Fortran is always compiled to a standalone executable by Simply Fortran.  When you run it from Simply Fortran, the input/output of the executable is piped into Simply Fortran's window.  The executable is just sitting in your project directory (presumably, unless you've specified some other location), and it can be run from macOS's Terminal completely separate from Simply Fortran.  There would be no computational speed difference launching it from Simply Fortran versus launching it from the macOS Terminal.

Jeff Armstrong
Approximatrix, LLC

Re: optimization settings for gfortran

Thank you. Changes made; though it was already super fast.