IPA with libraries

Hi All,

I have a library (lib.a) consisting of libfile1.f and libfile2.f. I form the library as follows:

pgf90 -c -fast -Mipa=fast,libopt -Minfo=ccff -tp=sandybridge-64 libfile1.f
pgf90 -c -fast -Mipa=fast,libopt -Minfo=ccff -tp=sandybridge-64 libfile2.f
ar rcv lib.a libfile1.o libfile2.o
ar -s lib.a

I have other source files which I compile as follows:

pgf90 -c -fast -Mipa=fast,libopt -Minfo=ccff -tp=sandybridge-64 file1.f
pgf90 -c -fast -Mipa=fast,libopt -Minfo=ccff -tp=sandybridge-64 file2.f
pgf90 -c -fast -Mipa=fast,libopt -Minfo=ccff -tp=sandybridge-64 file3.f

I link everything using

pgf90 -o fast.exe -fast -Mipa=fast,libopt -Minfo=ccff -tp=sandybridge-64 file1.o file2.o file3.o lib.a

at which point the compiler starts the IPA optimizations and prints something like:

IPA: Recompiling file1.o: new IPA information
IPA: Recompiling file2.o: new IPA information
IPA: Recompiling file3.o: new IPA information
IPA: Recompiling from lib.a: libfile1.o
IPA: Recompiling from lib.a: libfile2.o

IPA objects file1_ipa6_gamess.oo, file2_ipa6_gamess.oo and file3_ipa6_gamess.oo are created for the non-library files in the current working directory while files like libfile1.ooZFbQoxtxy0T.ipa and libfile2.o_ZFb6drTN6Cp.ipa are created in /tmp/ for the library files.

All good so far…

If I relink using

pgf90 -o fast.exe -fast -Mipa=fast,libopt -Minfo=ccff -tp=sandybridge-64 file1.o file2.o file3.o lib.a

the compiler does not recompile the non-library files but does recompile the library files:

IPA: IPA information unchanged for 3 source files
IPA: Recompiling from lib.a: libfile1.o
IPA: Recompiling from lib.a: libfile2.o

even though neither the library nor the files of which it is comprised have changed. AFAIK this is an unavoidable consequence of the libopt option to -Mipa.

If possible, I’d like to avoid the unnecessary recompilation of the library files, but I still want to benefit from the IPA optimizations.

So my questions are:

  1. Is it possible to build an IPA library (a library with IPA objects)? If it is, please provide an example.
  2. Would this IPA library and other objects that use it still benefit from IPA optimizations at link time if libopt is removed from -Mipa or safe:lib.a is added to -Mipa? I think the answer to this should be yes because in my experience if subroutines/functions from file1.o are used in file2.o and only file1.o is modified, only file1.o is recompiled at link time with a message similar to:
IPA: Recompiling file1.o: stale object file
IPA: IPA information unchanged for 2 source files
IPA: Recompiling from lib.a: libfile1.o
IPA: Recompiling from lib.a: libfile2.o

Apologies for the extremely long post.

Cheers,
Kyle

It’s awfully lonely in here… :\

Hi Kyle,

Sorry for the late response. I needed to send this to engineering for comment. With a major snow storm here in Portland, things have been a bit slower.

This is the first time we’ve had this request and not something our engineers had considered. The problem being that the “*.oo” files are specific for a binary so couldn’t just be included in the library. They think they might be able do something to help, but I would need justification to put this on their work plans. Is the problem just the extra compilation time or is there a larger issue?

  • Mat

Hi Mat,

Thanks for responding and I hope the weather improves soon.

The “problem” is just the extra compilation time; so it’s not really a problem. I was just making sure that there wasn’t an existing solution to this.

Cheers,
Kyle

Hi Kyle,

The big thaw is happening and it looks like things are starting to get back to normal.

I went ahead an put in a feature request (TPR#19836) for this.

  • Mat

We are reviewing old TPRs and have decided not to implement this one. I’ve gone ahead and closed it.