Turn off optimizations for specific functions

Turn off optimizations for specific functions


Is there an equivalent of C compilers #pragma optimize("", off) in Fortran?
If not, is there any way to achieve the same effect?

thanks & regards,

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

There have been requests for ability to plant compiler options by subroutine in the source file, but no action. That C pragma has limited usefulness. You're welcome to submit a premier.intel.com feature request.

I've adopted the fsplit/f90split method. You could set up the Makefile to split the functions automatically and apply options to individual files as necessary. If you do this in a separate directory, it's easy to recombine them into a library, or possibly an object file. Some say that the overall build process is faster this way; it does reduce memory requirement. Evidently, it eliminatescompile-time interprocedural analysis.

Along a line similar to what you asked are the command line options
ifort -[Q]from_rtn 1 -[Q]to_rtn 9 file.f
which applies optimization only to the first 9 functions in the file. The primary use of that is for debugging. prefix -Q for windows, just - for linux. This does not necessarily shut the other functions all the way down to -O0 or /Od, but it does shut off back-end optimizations.

Leave a Comment

Please sign in to add a comment. Not a member? Join today