- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Forgive the possibly naive question. I am working with a program that mixes some C++ and Fortran code. I had been messing around with the Project options and when building I received a message I hadn't seen before. (I will fully admit it may have always been there, but I just didn't notice it). When it goes to link the Fortran project with the C++ library, I see the following message:
"ProjectLibrary.lib(FunctionInProjectLibrary.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance"
I trace this down to the options for 'Whole Program optimization', under the C++ library my option for 'Whole Program Optimization' is set to 'Use Link Time Code Generation' (I presume this is /LCTG). I go over to my Fortran project in the same solution and under Configuration Properties -> General, I have 'Whole Program Optimization' which is simply set to 'No'. I tried changing this to Yes, but all it seemed to do was take the Linking step much longer to occur, and I still got the same message during the re-build.
I guess my question is, what exactly does this do, and is it worth it? Right now, I have the /GL option on in the C++ library (I suppose it has always been set that way, because I haven't touched it) and Whole program optimization turned back to 'Off' in the Fortran portion. As it is, things run just fine. Would tweaking these settings help in any appreciable way? Thanks.
EDIT: Looking back in my company's wayback code machine, it seems this option has always been there, but it is only active in the 'Release' configuration. So that would explain why I don't see the message when doing my debug builds. My question still stands, should I enable this option on the Fortran projects as well, will I see any benefit from doing so?
"ProjectLibrary.lib(FunctionInProjectLibrary.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance"
I trace this down to the options for 'Whole Program optimization', under the C++ library my option for 'Whole Program Optimization' is set to 'Use Link Time Code Generation' (I presume this is /LCTG). I go over to my Fortran project in the same solution and under Configuration Properties -> General, I have 'Whole Program Optimization' which is simply set to 'No'. I tried changing this to Yes, but all it seemed to do was take the Linking step much longer to occur, and I still got the same message during the re-build.
I guess my question is, what exactly does this do, and is it worth it? Right now, I have the /GL option on in the C++ library (I suppose it has always been set that way, because I haven't touched it) and Whole program optimization turned back to 'Off' in the Fortran portion. As it is, things run just fine. Would tweaking these settings help in any appreciable way? Thanks.
EDIT: Looking back in my company's wayback code machine, it seems this option has always been there, but it is only active in the 'Release' configuration. So that would explain why I don't see the message when doing my debug builds. My question still stands, should I enable this option on the Fortran projects as well, will I see any benefit from doing so?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As the Microsoft whole program /GL option isn't compatible with the Intel compiler equivalent IPO optimization, you normally would build any objects made with VC by setting /GL- ; then you can take your choice (file by file, if appropriate) whether to use IPO for the Intel built objects.
These optimizations are most likely to be helpful where you have procedure calls inside DO loops which can be vectorized by taking advantage of interprocedural analysis. Many applications are designed so as to permit full optimization without IPO. The only possibility for interprocedural optimization of a cross-language function call is with the wpo/ipo/lto facility of Fortran and C compilers supporting the same method (Intel IPO, gnu lto,...).
There are generally more opportunities for whole program optimization to help in C or C++ than in Fortran, due in part to the typical Windows C++ compilers not supporting the typed aliasing rules or restrict pointers to permit optimizations which are inherently possible in Fortran.
These optimizations are most likely to be helpful where you have procedure calls inside DO loops which can be vectorized by taking advantage of interprocedural analysis. Many applications are designed so as to permit full optimization without IPO. The only possibility for interprocedural optimization of a cross-language function call is with the wpo/ipo/lto facility of Fortran and C compilers supporting the same method (Intel IPO, gnu lto,...).
There are generally more opportunities for whole program optimization to help in C or C++ than in Fortran, due in part to the typical Windows C++ compilers not supporting the typed aliasing rules or restrict pointers to permit optimizations which are inherently possible in Fortran.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page