12.07.2015 Views

PGI User's Guide

PGI User's Guide

PGI User's Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 3. Optimizing & Parallelizingpgcc $(OPT) -c file1.cfile2.o: file2.cpgcc $(OPT) -c file2.cfile3.o: file3.cpgcc $(OPT) -c file3.cIt is then possible to type a single make command:% makeThe make utility determines which object files are out of date with respect to their corresponding source files,and invokes the compiler to recompile only those source files and to relink the executable. If you subsequentlyedit one or more source files, the executable can be rebuilt with the minimum number of recompilations usingthe same single make command.Building a Program with IPAInterprocedural analysis and optimization (IPA) by the <strong>PGI</strong> compilers alters the standard and make utilitycommand-level interfaces as little as possible. IPA occurs in three phases:• Collection: Create a summary of each function or procedure, collecting the useful information forinterprocedural optimizations. This is done during the compile step if the –Mipa switch is present on thecommand line; summary information is collected and stored in the object file.• Propagation: Process all the object files to propagate the interprocedural summary information acrossfunction and file boundaries. This is done during the link step, when all the object files are combined, if the–Mipa switch is present on the link command line.• Recompile/Optimization: Recompile each of the object files with the propagated interproceduralinformation, producing a specialized object file. This process is also performed during the link step whenthe –Mipa switch is present on the link command line.When linking with –Mipa, the <strong>PGI</strong> compilers automatically regenerate IPA-optimized versions of each objectfile, essentially recompiling each file. If there are IPA-optimized objects from a previous build, the compilerswill minimize the recompile time by reusing those objects if they are still valid. They will still be valid if the IPAoptimizedobject is newer than the original object file, and the propagated IPA information for that file has notchanged since it was optimized.After each object file has been recompiled, the regular linker is invoked to build the application with the IPAoptimizedobject files. The IPA-optimized object files are saved in the same directory as the original object files,for use in subsequent program builds.Building a Program with IPA - Single StepBy adding the –Mipa command line switch, several source files can be compiled and linked withinterprocedural optimizations with one command:% pgcc -Mipa=fast -o a.out file1.c file2.c file3.cJust like compiling without –Mipa, the driver executes several steps to produce the assembly and object filesto create the executable:% pgcc -Mipa=fast -S -o file1.s file1.c% as -o file1.o file1.s% pgcc -Mipa=fast -S -o file2.s file2.c41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!