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

Optimization puzzle

nvaneck
New Contributor I
1,385 Views
I have 43 major routines in a project. Only one of them always gets a long list of inline objects and vectorization reports, but only with the x64 release. Normally I specify maximize speed, favor fast code, whole program optimization, no interprocedural optimization for Fortran, interprocedural optimization for the Linker, and no inlining, no parallelization. In trying to figure out why this is happening, I turned off all optimization except favor fast code and maximize speed and still get (apparently) the same report. Can anyone explain why this is? Why only this routine? Why only in X64 configuration? Does the inlining report mean these files were inlined? Attachment contains the long optimization report with no optimization except the favor fast code and maximize speed.
0 Kudos
13 Replies
jimdempseyatthecove
Honored Contributor III
1,385 Views

>>no interprocedural optimization for Fortran, interprocedural optimization for the Linker

Isn't this an oxymoron?

Meaning, in order for the Linker to perform interprocedural optimizations, the object modules must have the interprocedural annotations (meaning the Fortran file must have been compiled with multi-file IPO). The linker can still do IPO with library files also build with IPO. Possibly you are seeing this.

Jim Dempsey

0 Kudos
nvaneck
New Contributor I
1,386 Views
I suppose, but I found it in my project specs when I looked, but the question remains as I get the same when all interproc stuff is turned off.
0 Kudos
Steven_L_Intel1
Employee
1,386 Views

I'd like to see your .vfproj file as I think you are a bit confused as to what is being set. Whole program optimization (IPO) has two steps. First, it needs to be enabled on the compile step to generate intermediate code rather than object code. Then it has to also be enabled on the link step, so that the compiler runs again across all the intermediate code. In project settings, this is done in the Fortran property Optimization > Interprocedural Optimization > Whole Program (/Qipo). This tells the Fortran build system in VS to add /Qipo to the compile phase and then to run xilink (the Intel wrapper around link) to do the actual optimization. (In reality, xilink is always used.)

My guess is that one of your sources is still being built with /Qipo and the others are not, defeating the general usefulness of the option.

0 Kudos
TimP
Honored Contributor III
1,386 Views

Most Fortrans offer inter-procedural optimizations within a single source file (or even a group of files in a single compilation), as well as link-time inter-procedural optimizations (which are meant sometimes by "whole-program").  The single file IP may be set by default to more aggressive in X64 as there may be less chance of running out of memory.

Aggressiveness of IP default settings varies also with compiler release and with certain other optimization settings.

single-file IP may be partial in-lining. If you can persuade ifort to do the symbols right with -debug:inline-debug-info, you can see how it is working in VTune.

0 Kudos
nvaneck
New Contributor I
1,386 Views
Well, I've tried all combinations of the 3 possible settings multiple times. I just did a rebuild with the attached project file and got the IPO report on only the one routine with inline, vectorization, etc. I understand better now from Steve's response how the settings are supposed to interact. Before today, I only got a small IPO report, so perhaps I change a setting without remembering it. The original project settings I used set whole program, no interproc under Fortran, but interproc under linker which is not consistent per Steve's explanation. What I wanted to achieve is best optimization without any inlining, but under one of my trials it seems some inlining intruded anyway. The real puzzle for me is why I get an IPO report for only one of the routines, when others are more complex, and only in X64 configurations..
0 Kudos
Steven_L_Intel1
Employee
1,386 Views

It's because the default project option is to disable optimization reports, but in the x64 configuration, that one file has /Qopt-report specified under "Additional Options" on the Fortran Command Line property page.

0 Kudos
nvaneck
New Contributor I
1,386 Views
Yes, Steve, I see it when I open the project file with notepad. How would it have gotten there? Is editing with notepad the only way to get rid of it?
0 Kudos
IanH
Honored Contributor II
1,386 Views

nvaneck wrote:
...The original project settings I used set whole program, no interproc under Fortran...

Doesn't that mean you are asking "please may I have interprocedural optimisation" at the same time as asking "please don't do interprocedural optimisation"?  Who wins?

0 Kudos
nvaneck
New Contributor I
1,386 Views
Sure does, Ian, and is wasn't me that won :) I didn't know I had it set that way, and I understand the interprocedural settings now after Steve's excellent explanation. BTW, editing out the offending additional options with notepad didn't work--led to VS crashing....
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,386 Views

Editing the project file is problematic.

In the Solution Explorer, Right-Click on the first project of interests (you may have multiple projects in your solution) and select Properties. Then select the configuration of interest (usually Debug is not IPO'd). On the Platform, select the platform of interest (Win32, x64, some other, All Platforms). Then pick the options you want. This will set the default options for all the files within the Project.

If you have special requirements for individual files, you can then subsequently modify the properties for that file alone (Solution Explorer, right-click on file, properties, enter properties for file). It is not unusual to compile Release build with full optimizations on all files except for the one file you wish to debug. When a file has options selected that differ from the Project settings, the VS Solution Explorer places a check mark on the file (indicating something differs from the default). And when you browse the properties of a file, the options that differ from the project default are highlighted with bold typeface.

Jim Dempsey

0 Kudos
Steven_L_Intel1
Employee
1,386 Views

Don't use notepad! This was manually entered as a project property in VS. Right click on USTATS.F90 in Solution Explorer, select Properties. Go to Fortran > Command Line. Select the Release x64 configuration. Delete the text in the Additional Options field and click OK.

0 Kudos
nvaneck
New Contributor I
1,386 Views
Thanks all! I understand this now. I found 2 other programs with additional settings and found the easiest way to clean them up was to delete them from the project, save the project, and add them back in. I think I'm in good shape now. Neal
0 Kudos
FortranFan
Honored Contributor III
1,385 Views

Steve,

This reminds me of wanting to look further into improvements in optimization reports in Compiler 15 (and 14).  Can you please provide a quick primer on how to setup the "Optimization Diagnostics" section under Diagnostics under Fortran for projects in Visual Studio?  Specifically, what are the suggested settings if one wants to output the report to a specific file for the whole project (say proja.optrept for project A).  And when one wants file-specific reports (e.g., foo.optrep for foo.90 file, etc.).  Last tried I didn't get very far and was running into problems, but then I didn't play around enough.

Thanks,

0 Kudos
Reply