Skip to content. Skip to navigation

ICTP Portal

Sections
You are here: Home Manuals on-line PGI Compiler pgiws_ug PGI Workstation User's Guide - 7 Command-line Options
Personal tools
Document Actions

PGI Workstation User's Guide - 7 Command-line Options

<< << " border=0> >> > " border=0> Title Contents Index Home Help

7 Command-line Options


This chapter describes the syntax and operation of each compiler option. The options are arranged in alphabetical order. On a command-line, options need to be preceded by a hyphen (-). If the compiler does not recognize an option, it passes the option to the linker.

This chapter uses the following notation:

[item]
Square brackets indicate that the enclosed item is optional.
{item | item}
Braces indicate that you must select one and only one of the enclosed items. A vertical bar (|) separates the choices.
...
Horizontal ellipses indicate that zero or more instances of the preceding item are valid.


NOTE

Some options do not allow a space between the option and its argument or within an argument. This fact is noted in the syntax section of the respective option.

Table 7-1 Generic PGI Compiler Options

Option

Description

-#


Display invocation information.


-###


Show but do not execute the driver commands (same as

-dryrun).


-byteswapio


Swap bytes from big-endian to little-endian or vice versa on input/output of unformatted data


-C


Perform array bounds checking.


-c


Stops after the assembly phase and saves the object code in filename.o.


-cyglibs


(Win32 only) link against the Cygnus libraries and use the Cygnus include files. You must have the full Cygwin32 environment installed in order to use this switch.


-D<arg>


Defines a preprocessor macro.


-dryrun


Show but do not execute driver commands.


-E


Stops after the preprocessing phase and displays the preprocessed file on the standard output.


-F


Stops after the preprocessing phase and saves the preprocessed file in filename.f (this option is only valid for the PGI Fortran compilers)


-f


Ignored


-fast


Generally optimal; equivalent to: -O -Munroll -Mnoframe


-flags


Display valid driver options.


-fpic


Generate position-independent code.


-fPIC


Equivalent to -fpic.


-G


(Solaris86 only) Passed to the linker. Instructs the linker to generate a shared object file.


-g


Includes debugging information in the object module.


-g77libs


Allow object files generated by g77 to be linked into PGI main programs.


-help


Display driver help message.


-I<arg>


Adds a directory to the search path for #include files.


-i


Passed to the linker


-i2


Treat INTEGER variables as 2 bytes.


-i4


Treat INTEGER variables as 4 bytes.


-i8


Treat INTEGER variables as 8 bytes and use 64-bits for INTEGER*8 operations.


-Kflag


Requests special compilation semantics with regard to conformance to IEEE 754.


-L


Specifies a library directory.


-l


Loads a library.


-Mpgflag


Selects variations for code generation and optimization.


-m


Displays a link map on the standard output


-module <moduledir>


Save/search for module files in directory <moduledir>; (only valid for the PGF90 and PGHPF compilers)


-mp


Interpret and process user-inserted shared-memory parallel programming directives (see Chapters 10 and 11).


-mslibs


(Win32 only) use the Microsoft linker and include files, and link against the Microsoft Visual C++ libraries. Microsoft Visual C++ must be installed in order to use this switch.


-msvcrt


(Win32 only) use Microsoft's msvcrt.dll at runtime rather than the default crtdll.dll.


-Olevel


Specifies code optimization level where level is 0, 1, or 2.


-o


Names the object file.


-P


Stops after the preprocessing phase and saves the preprocessed file in filename.i (only valid for the PGI C/C++ compilers)


-pc


Set precision for certain calculations.


-Q


Selects variations for compiler steps.


-R<directory>


(Linux and Solaris86 only) Passed to the Linker. Hard code <directory> into the search path for shared object files.


-r


Creates a relocatable object file.


-r4


Interpret DOUBLE PRECISION variables as REAL.


-r8


Interpret REAL variables as DOUBLE PRECISION.


-rc file


Specifies the name of the driver's startup file.


-S


Stops after the compiling phase and saves the assembly-language code in filename.s.


-s


Strips the symbol-table information from the object file.


-shared


(Linux only) Passed to the linker. Instructs the linker to generate a shared object file.


-show


Display driver's configuration parameters after startup.


-silent


Do not print warning messages.


-time


Print execution times for the various compilation steps.


-tp


Specify the type of the target processor; -tp p5 for Pentium processors, -tp p6 for Pentium Pro/II/III processors, and -tp px for blended p5/p6 code generation.


-U symbol


Undefine a preprocessor macro.


-u symbol


Initializes the symbol table with symbol, which is undefined for the linker. An undefined symbol triggers loading of the first member of an archive library.


-V


Displays the version messages and other information.


-v


Displays the compiler, assembler, and linker phase invocations.


-W


Passes arguments to a specific phase.


-w


Do not print warning messages.


Table 7-2 C and C++ -specific Compiler Options

Option

Description

-A


(pgCC only) Accept proposed ANSI C++.


--[no_]alternative_tokens


(pgCC only) Enable/disable recognition of alternative tokens. These are tokens that make it possible to write C++ without the use of the , , [, ], #, &, and ^ and characters. The alternative tokens include the operator keywords (e.g., and, bitand, etc.) and digraphs. The default is
--no_alternative_tokens.


-b


(pgCC only) Compile with cfront 2.1 compatibility. This accepts constructs and a version of C++ that is not part of the language definition but is accepted by cfront.


-b3


(pgCC only) Compile with cfront 3.0 compatibility. See -b above.


--[no_]bool


(pgCC only) Enable or disable recognition of bool. The default value is --bool.


--[no]builtin


Do/don't compile with math subroutine builtin support, which causes selected math library routines to be inlined. The default is --builtin.


--cfront_2.1


(pgCC only) Enable compilation of C++ with compatibility with cfront version 2.1.


--cfront_3.0


(pgCC only) Enable compilation of C++ with compatibility with cfront version 3.0.


--create_pch filename


(pgCC only) Create a precompiled header file with the name filename.


--dependencies


(pgCC only) Print makefile dependences to stdout.


--dependencies_to_file filename


(pgCC only) Print makefile dependences to file filename.


--diag_error tag


(pgCC only) Override the normal error severity of the specified diagnostic messages.


--diag_remark tag


(pgCC only) Override the normal error severity of the specified diagnostic messages.


--diag_suppress tag


(pgCC only) Override the normal error severity of the specified diagnostic messages.


--diag_warning tag


(pgCC only) Override the normal error severity of the specified diagnostic messages.


--display_error_number


(pgCC only) Display the error message number in any diagnostic messages that are generated.


--enumber


(pgCC only) Set the C++ front-end error limit to the specified number.


--[no_]exceptions


(pgCC only) Disable/enable exception handling support. The default is -exceptions


--gnu_extensions


(pgCC only) Allow GNU extensions like "include next" which are required to compile Linux system header files.


--instantiation_dir directory


(pgCC only) If --one_instantiation_per_object is used, define directory as the instantiation directory.


--[no]llalign


(pgCC only) Do/don't align long long integers on integer boundaries. The default is --llalign.


-M


Generate make dependence lists.


-MD


Generate make dependence lists.


-MD,filename


(pgCC only) Generate make dependence lists and print them to file filename.


--one_instantiation_per_object


(pgCC only) Put out each template instantiation (function or static data member) in a separate object file. The primary object file contains everything else in the compilation. Allows users of libraries to pull only the instantiations that are needed. Necessary for template libraries that rely on other template libraries.


--optk_allow_dollar_in_id_chars


(pgCC only) Accept dollar signs in identifiers.


--pch


(pgCC only) Automatically use and/or create a precompiled header file.


--pch_dir directory


(pgCC only) The directory in which to search for and/or create a precompiled header file.


--[no_]pch_messages


(pgCC only) Enable/ disable the display of a message indicating that a precompiled header file was created or used.


+p


(pgCC only) Disallow all anachronistic constructs.


-P


Stops after the preprocessing phase and saves the preprocessed file in filename.i.


--preinclude=<filename>


(pgCC only) Specify file to be included at the beginning of compilation; to set system-dependent macros, types, etc


--prelink_objects


(pgCC only) If --one_instantiation_per_object is used, create template instantiations for a set of objects that are about to become a template library. Required for template libraries that reference other template libraries.


-t


Control instantiation of template functions.


--use_pch filename


(pgCC only) Use a precompiled header file of the specified name as part of the current compilation.


--[no_]using_std


(pgCC only) Enable/disable implicit use of the std namespace when standard header files are included.


-X


(pgCC only) Generate cross reference information and place output in specified file.


-Xm


(pgCC only) Allow $ in names.


-xh


(pgCC only) Enable exception handling


-.suffix


(pgCC only) Use with -E, -F, or -P to save intermediate file in a file with the specified suffix.


7.1 Generic PGI Compiler Options


-#


Use the -# option to display the invocations of the compiler, assembler and linker. These invocations are command-lines created by the driver from your command-line input and the default values.

Default: The compiler does not display individual phase invocations.

Usage: The following command-line requests verbose invocation information.

$ pgf90 -# prog.f

Cross-reference: -Minfo, -V, -v.


-###


Use the -### option to display the invocations of the compiler, assembler and linker but do not execute them. These invocations are command-lines created by the compilation driver from the PGIRC files and the command-line options.

Default: The compiler does not display individual phase invocations.

Usage: The following command-line requests verbose invocation information.

$ pgf90 -### myprog.f

Cross-reference: -Minfo, -V, -dryrun.


-byteswapio


Use the -byteswapi ooption to swap the byte-order of data in unformatted Fortran data files on input/output. When this option is used, the order of bytes is swapped in both the data and record control words (the latter occurs in unformatted sequential files). Specifically, this option can be used to convert big-endian format data files produced by most RISC workstations and high-end servers to the little-endian format used on Intel Architecture systems on-the-fly during file reads/writes. This option assumes that the record layouts of unformatted sequential access and direct access files are the same on the systems. Also, the assumption is that the IEEE representation is used for floating-point numbers. In particular, the format of unformatted data files produced by PGI Fortran compilers is known to be identical to the format used on Sun and SGI workstations, which allows you to read and write unformatted Fortran data files produced on those platforms from a program compiled for an IA-32 platform using the -byteswapio option.

Default: The compiler does not byte-swap data on input/output.

Usage: The following command-line requests byte-swapping be performed on input/output.

$ pgf90 -byteswapio myprog.f


-C


Perform array bounds checking. If an array bounds violation occurs when a program is executed, an error message describing where the error occurred is printed and the program terminates.

Usage:

$ pgf90 -C myprog.f

The text of the error message includes the name of the array, the location where the error occurred (the source file and the line number in the source), and information about the subscript which is out of bounds (its value, its upper bound, and its dimension).

Cross-reference: -Mbounds, -Mnobounds.


-c


Stops after the assembling phase. Use the -c option to halt the compilation process after the assembling phase and write the object code to the file filename.o, where the input file is filename.f.

Default: The compiler produces an executable file (does not use the -c option).

Usage: In this example, the compiler produces the object file myprog.o in the current directory.

$ pgf90 -c myprog.f

Cross-reference: -E, -Mkeepasm, -o, and -S.


-cyglibs


(Win32 only) link against the Cygnus libraries and use the Cygnus include files. You must have the full Cygwin32 environment installed in order to use this switch.

Default: The compiler does not link against the Cygnus libraries.


-D


Defines a preprocessor macro. Use the -D option to create a macro with a given value. The value must be either an integer or a character string. You can use the -D option more than once on a compiler command line. The number of active macro definitions is limited only by available memory.

You can use macros with conditional compilation to select source text during preprocessing. A macro defined in the compiler invocation remains in effect for each module on the command line, unless you remove the macro with an #undef preprocessor directive or with the -U option. The compiler processes all of the -U options in a command line after processing the -D options.

Syntax:

-Dname[=value]

Where name is the symbolic name, and value is either an integer value or a character string.

Default: If you define a macro name without specifying a value the preprocessor assigns the string 1 to the macro name.

Usage: In the following example, the macro PATHLENGTH has the value 256 until a subsequent compilation. If the -D option is not used, PATHLENGTH's value is set to 128.

$ pgf90 -DPATHLENGTH=256 myprog.F

Where the source text is:

	#ifndef PATHLENGTH
#define PATHLENGTH 128
#endif
SUBROUTINE SUB
CHARACTER*PATHLENGTH path
...
END

Cross-reference: -U


-dryrun


Use the -dryrun option to display the invocations of the compiler, assembler and linker but do not execute them. These invocations are command lines created by the compilation driver from the PGIRC file and the command-line supplied with -dryrun.

Default: The compiler does not display individual phase invocations.

Usage: The following command-line requests verbose invocation information.

$ pgf90 -dryrun myprog.f

Cross-reference: -Minfo, -V, -###


-E


Stops after the preprocessing phase. Use the -E option to halt the compilation process after the preprocessing phase and display the preprocessed output on the standard output.

Default: The compiler produces an executable file.

Usage: In the following example the compiler displays the preprocessed myprog.f on the standard output.

$ pgf90 -E myprog.f

Cross-reference: See the options -C, -c, -Mkeepasm, -o, -F, -S.


-F


Stops compilation after the preprocessing phase. Use the -F option to halt the compilation process after preprocessing and write the preprocessed output to the file filename.f where the input file is filename.F.

Default: The compiler produces an executable file.

Usage: In the following example the compiler produces the preprocessed file myprog.f in the current directory.

$ pgf90 -F myprog.F

Cross-reference: -c,-E, -Mkeepasm, -o, -S


-fast


A generally optimal set of options is chosen depending on the target system. Always includes the options -O, -Munroll, and -Mnoframe on all IA-32 platforms. In addition, the -tp p5 or -tp p6 option is automatically included on Pentium and Pentium Pro/II/III platforms respectively. NOTE: auto-selection of the appropriate -tp option means that IA-32 programs built using the -fast option on a given system are not necessarily backward-compatible with older IA-32 systems.

Cross-reference: -O, -Munroll, -Mnoframe, -tp


-flags


Displays driver options on the standard output. Use this option with -v to list options that are
recognized and ignored, as well as the valid options.

Cross-reference: -#, -###, -v


-fpic


(Linux and Solaris86 only) Generate position-independent code suitable for inclusion in shared object (dynamically linked library) files.

Cross-reference: -shared, -G, -R


-fPIC


(Linux and Solaris86 only) Equivalent to -fpic. Provided for compatibility with other compilers.

Cross-reference: -fpic, -shared, -G, -R


-G


Valid only on Solaris86. Passed to the linker. Instructs the linker to produce a shared object (dynamically linked library) file.

Cross-reference: -fpic, -shared, -R


-g


The -g option instructs the compiler to include symbolic debugging information in the object module. Debuggers, such as PGDBG, require symbolic debugging information in the object module to display and manipulate program variables and source code. Note that including symbolic debugging information increases the size of the object module.

If you specify the -g option on the command-line, the compiler sets the optimization level to -O0 (zero), unless you specify the -O option. For more information on the interaction between the -g and -O options, see the -O entry. Symbolic debugging may give confusing results if an optimization level other than zero is selected.

Default: The compiler does not put debugging information into the object module.

Usage: In the following example the object file a.out will contain symbolic debugging information.

$ pgf90 -g myprog.f


-g77libs


Use the -g77lib soption on the link line if you are linking g77-compiled program units into a pgf90-compiled main program using the pgf90 driver. When this option is present, the pgf90 driver will search the necessary g77 support libraries to resolve references specific to g77-compiled program units. The g77 compiler must be installed on the system on which linking occurs in order for this option to function correctly.


Default:
The compiler does not search g77 support libraries to resolve references at link time.

Usage: The following command-line requests that g77 support libraries be searched at link time:

$ pgf90 -g77libs myprog.f g77_object.o


-help


Displays options recognized by the driver on the standard output.

Cross-reference: -#, -###, -show, -V, -flags


-I


Adds a directory to the search path for files that are included using the INCLUDE statement or the preprocessor directive #include. Use the -I option to add a directory to the list of where to search for the included files. The compiler searches the directory specified by the -I option before the default directories.

Syntax:

-Idirectory

Where directory is the name of the directory added to the standard search path for include files.

Usage: The Fortran INCLUDE statement directs the compiler to begin reading from another file. The compiler uses two rules to locate the file:

  1. If the file name specified in the INCLUDE statement includes a path name, the compiler begins reading from the file it specifies.
  2. If no path name is provided in the INCLUDE statement, the compiler searches (in order):
    • any directories specified using the -I option (in the order specified.)
    • the directory containing the source file
    • the current directory

For example, the compiler applies rule (1) to the following statements:

INCLUDE '/bob/include/file1' (absolute path name)
INCLUDE '../../file1' (relative path name)

and rule (2) to this statement:

INCLUDE 'file1'

Cross-reference: -Mnostdinc


-i2, -i4 and -i8


Treat INTEGER variables as either two, four, or eight bytes. INTEGER*8 values not only occupy 8 bytes of storage, but operations use 64 bits, instead of 32 bits.


-Kflag


Requests that the compiler provide special compilation semantics.

Syntax:

-Kflag

Where flag is one of the following:

ieee
Perform floating-point operations in strict conformance with the IEEE 754 standard. Some optimizations are disabled, and on some systems a more accurate math library is linked if -Kieee is used during the link step.
noieee
Use the fastest available means to perform floating-point operations, link in faster non-IEEE libraries if available, and disable underflow traps.
PIC
(Linux and Solaris86 only) Generate position-independent code. Equivalent to -fpic. Provided for compatibility with other compilers.
pic
(Linux and Solaris86 only) Generate position-independent code. Equivalent to -fpic. Provided for compatibility with other compilers.
trap=option[,option]...
This new option controls the behavior of the IA-32 processor when IA-32 floating-point exceptions occur. Possible options include:

fp
align (ignored)
inv
denorm
divz
ovf
unf
inexact

-Ktrap is only processed by the compilers when compiling main functions/programs. The options inv, denorm, divz, ovf, unf, and inexact correspond to the IA-32 processor's exception mask bits invalid operation, denormalized operand, divide-by-zero, overflow, underflow, and precision, respectively. Normally, the IA-32 processor's exception mask bits are on (floating point exceptions are masked - the IA-32 processor recovers from the exceptions and continues). If a floating point exception occurs and its corresponding mask bit is off (or "unmasked"), execution terminates with an arithmetic exception (C's SIGFPE signal). -Ktrap=fp is equivalent to -Ktrap=inv,divz,ovf.

Default: The default is -Knoieee.


-L


Specifies a directory to search for libraries. Use -L to add directories to the search path for library files. Multiple -L options are valid. However, the position of multiple -L options is important relative to -l options supplied.

Syntax:

-Ldirectory

Where directory is the name of the library directory.

Default: Search the standard library directory.

Usage: In the following example the library directory is /lib and the linker links in the standard libraries required by PGF90 from /lib.

$ pgf90 -L/lib myprog.f

In the following example the library directory /lib is searched for the library file libx.a and both the directories /lib and /libz are searched for liby.a.

$ pgf90 -L/lib -lx -L/libz -ly myprog.f


-l<library>


Loads a library. The linker searches <library> in addition to the standard libraries. Libraries specified with -l are searched in order of appearance and before the standard libraries.

Syntax:

-llibrary

Where library is the name of the library to search. The compiler prepends the characters lib to the library name and adds the .a extension following the library name.

Usage: In the following example if the standard library directory is /lib the linker loads the library /lib/libmylib.a, in addition to the standard libraries.

$ pgf90 myprog.f -lmylib


-Mpgflag


Selects options for code generation. The options are divided into the following categories:

  • * Code generation
  • Environment
  • Inlining
  • Fortran Language Controls
  • C/C++ Language Controls
  • Optimization
  • Miscellaneous

Table 7-2 lists and briefly describes the options alphabetically and includes a field showing the category.

Table 7-2 -M Options Summary

pgflag

Description

Category

anno


annotate the assembly code with source code.


Miscellaneous


[no]asmkeyword


specifies whether the compiler allows the asm keyword in C/C++ source files (pgcc and pgCC only).


C/C++ Language


[no]backslash


determines how the backslash character is treated in quoted strings (pgf77, pgf90, and pghpf only).


Fortran Language


[no]bounds


specifies whether array bounds checking is enabled or disabled.


Miscellaneous


[no]builtin


Do/don't compile with math subroutine builtin support, which causes selected math library routines to be inlined (pgcc and pgCC only).


Optimization


byteswapio


Swap byte-order (big-endian to little-endian or vice versa) during I/O of Fortran unformatted data.


Miscellaneous


cache_align


where possible, align data objects of size greater than or equal to 16 bytes on cache-line boundaries.


Optimization


chkfpstk


check for internal consistency of the x86 FP stack in the prologue of a function and after returning from a function or subroutine call.


Miscellaneous


chkptr


check for NULL pointers (pgf90 and pghpf only).


Miscellaneous


chkstk


check the stack for available space upon entry to and before the start of a parallel region. Useful when many private variables are declared.


Miscellaneous


concur


enable auto-concurrentization of loops. Multiple processors will be used to execute parallelizable loops (only valid on shared memory multi-CPU systems).


Optimization


cray


Force Cray Fortran (CF77) compatibility (pgf77, pgf90, and pghpf only).


Optimization


[no]dclchk


determines whether all program variables must be declared (pgf77, pgf90, and pghpf only).


Fortran Language


[no]defaultunit


determines how the asterisk character ("*") is treated in relation to standard input and standard output (regardless of the status of I/O units 5 and 6, pgf77, pgf90, and pghpf only).


Fortran Language


[no]depchk


checks for potential data dependences.


Optimization


[no]dlines


determines whether the compiler treats lines containing the letter "D" in column one as executable statements (pgf77, pgf90, and pghpf only).


Fortran Language


dollar


specifies the character to which the compiler maps the dollar sign code (pgf77, pgf90, and pghpf only).


Fortran Language


extend


the compiler accepts 132-column source code; otherwise it accepts 72-column code (pgf77, pgf90, and pghpf only).


Fortran Language


extract


invokes the function extractor.


Inlining


fcon


instructs the compiler to treat floating-point constants as float data types (pgcc and pgCC only).


C/C++ Language


[no]i4


determines how the compiler treats INTEGER variables (pgf77, pgf90, and pghpf only).


Optimization


info


print informational messages regarding optimization and code generation to standard output as compilation proceeds.


Miscellaneous


inform


specifies the minimum level of error severity that the compiler displays.


Miscellaneous


inline


invokes the function inliner.


Inlining


[no]iomutex


determines whether critical sections are generated around Fortran I/O calls (pgf77, pgf90, and pghpf only).


Fortran Language


keepasm


instructs the compiler to keep the assembly file.


Miscellaneous


[no]list


specifies whether the compiler creates a listing file.


Miscellaneous


neginfo


instructs the compiler to produce information on why certain optimizations are not performed.


Miscellaneous


noframe


eliminate operations that set up a true stack frame pointer for functions.


Optimization


nomain


when the link step is called, don't include the object file which calls the Fortran main program (pgf77, pgf90, and pghpf only).


Code Generation


noopenmp


when used in combination with the -mp option, causes the compiler to ignore OpenMP parallelization directives or pragmas, but still process SGI-style parallelization directives or pragmas.


Miscellaneous


nosgimp


when used in combination with the -mp option, causes the compiler to ignore SGI-style parallelization directives or pragmas, but still process OpenMP directives or pragmas.


Miscellaneous


nostartup


do not link in the standard startup routine (pgf77, pgf90, and pghpf only).


Environment


nostddef


instructs the compiler to not recognize the standard preprocessor macros.


Environment


nostdinc


instructs the compiler to not search the standard location for include files.


Environment


nostdlib


instructs the linker to not link in the standard libraries.


Environment


[no]onetrip


determines whether each DO loop executes at least once (pgf77, pgf90, and pghpf only).


Language


prof


set profile options; function-level and line-level profiling are supported.


Code Generation


[no]r8


determines whether the compiler promotes REAL variables and constants to DOUBLE PRECISION (pgf77, pgf90, and pghpf only).


Optimization


[no]r8intrinsics


determines how the compiler treats the intrinsics CMPLX and REAL (pgf77, pgf90, and pghpf only).


Optimization


[no]recursive


allocate (do not allocate) local variables on the stack, this allows recursion. SAVEd, data-initialized, or namelist members are always allocated statically, regardless of the setting of this switch (pgf77, pgf90, and pghpf only).


Code Generation


[no]reentrant


specifies whether the compiler avoids optimizations that can prevent code from being reentrant.


Code Generation


[no]ref_externals


do (don't) force references to names appearing in EXTERNAL statements (pgf77, pgf90, and pghpf only).


Code Generation


safeptr


instructs the compiler to override data dependences between pointers and arrays (pgcc and pgCC only).


Optimization


safe_lastval


In the case where a scalar is used after a loop, but is not defined on every iteration of the loop, the compiler does not by default parallelize the loop. However, this option tells the compiler it safe to parallelize the loop. For a given loop the last value computed for all scalars make it safe to parallelize the loop.


Code Generation


[no]save


determines whether the compiler assumes that all local variables are subject to the SAVE statement (pgf77, pgf90, and pghpf only).


Fortran Language


schar


specifies signed char for characters (pgcc and pgCC only - also see uchar).


C/C++ Language


[no]second_underscore


do (don't) add the second underscore to the name of a Fortran global if its name already contains an underscore (pgf77, pgf90, and pghpf only).


Code Generation


[no]signextend


specifies whether the compiler extends the sign bit, if it is set.


Code Generation


[no]single


convert float parameters to double parameters characters (pgcc and pgCC only).


C/C++ Language


standard


causes the compiler to flag source code that does not conform to the ANSI standard (pgf77, pgf90, and pghpf only).


Fortran Language


[no]stride0


the compiler generates (does not generate) alternate code for a loop that contains an induction variable whose increment may be zero (pgf77, pgf90, and pghpf only).


Code Generation


uchar


specifies unsigned char for characters (pgcc and pgCC only - also see schar).


C/C++ Language


unix


use UNIX calling and naming conventions for Fortran subprograms (pgf77, pgf90, and pghpf for Win32 only).


Code

Generation


[no]unixlogical


determines whether logical .TRUE. and .FALSE. are determined by non-zero (TRUE) and zero (FALSE) values for unixlogical. With nounixlogical, the default, -1 values are TRUE and 0 values are FALSE (pgf77, pgf90, and pghpf only).


Fortran Language


[no]unroll


controls loop unrolling.


Optimization


[no]upcase


determines whether the compiler allows uppercase letters in identifiers (pgf77, pgf90, and pghpf only).


Fortran Language


vect


invokes the code vectorizer.


Optimization



-Mpgflag Code Generation Controls


Syntax:

-Mnomain
instructs the compiler not to include the object file which calls the Fortran main program as part of the link step. This option is useful for linking programs in which the main program is written in C/C++ and one or more subroutines are written in Fortran (pgf77, pgf90, and pghpf only).
-Mprof[=option[,option,...]]
Set profile options. option can be any of the following:
func
perform PGI-style function-level profiling.
line
perform PGI-style line-level profiling.
-Mrecursive
instructs the compiler to allow Fortran subprograms to be called recursively.
-Mnorecursive
Fortran subprograms may not be called recursively.
-Mref_externals
force references to names appearing in EXTERNAL statements (pgf77, pgf90, and pghpf only).
-Mnoref_externals
do not force references to names appearing in EXTERNAL statements (pgf77, pgf90, and pghpf only).
-Mreentrant
instructs the compiler to avoid optimizations that can prevent code from being reentrant.
-Mnoreentrant
instructs the compiler not to avoid optimizations that can prevent code from being reentrant.
-Msecond_underscore
instructs the compiler to add a second underscore to the name of a Fortran global symbol if its name already contains an underscore. This option is useful for maintaining compatibility with object code compiled using g77, which uses this convention by default (pgf77, pgf90, and pghpf only).
-Mnosecond_underscore
instructs the compiler not to add a second underscore to the name of a Fortran global symbol if its name already contains an underscore (pgf77, pgf90, and pghpf only).
-Msignextend
instructs the compiler to extend the sign bit that is set as a result of converting an object of one data type to an object of a larger signed data type.
-Mnosignextend
instructs the compiler not to extend the sign bit that is set as the result of converting an object of one data type to an object of a larger data type.
-Msafe_lastval
In the case where a scalar is used after a loop, but is not defined on every iteration of the loop, the compiler does not by default parallelize the loop. However, this option tells the compiler it's safe to parallelize the loop. For a given loop the last value computed for all scalars make it safe to parallelize the loop.
-Mstride0
instructs the compiler to inhibit certain optimizations and to allow for stride 0 array references. This option may degrade performance and should only be used if zero-stride induction variables are possible.
-Mnostride0
instructs the compiler to perform certain optimizations and to disallow for stride 0 array references.
-Munix
use UNIX symbol and parameter passing conventions for Fortran subprograms (pgf77, pgf90, and pghpf for Win32 only).

Default: For arguments that you do not specify, the default code generation controls are as follows:

norecursive


nostride0


noreentrant


signextend


nosecond_underscore


noref_externals



-Mpgflag Environment Controls


Syntax:

-Mnostartup
instructs the linker not to link in the standard startup routine which contains the entry point (_start) for the program.
Note: If you use the -Mnostartup option and do not supply an entry point, the linker issues the following error message:
Warning: cannot find entry symbol _start
-Mnostdlib
instructs the linker not to link in the standard libraries libpgftnrtl.a, libm.a, libc.a and libpgc.a in the library directory lib within the standard directory. You can link in your own library with the -l option or specify a library directory with the -L option.

Default: For arguments that you do not specify, the default environment option depends on your configuration.

Cross-reference: -D, -I, -L, -l, -U


-Mpgflag Inlining Controls


This section describes the -Mpgflag options that control function inlining.

Syntax:

-Mextract[=option[,option,...]]
Extracts functions from the file indicated on the command line and creates or appends to the specified extract directory. option can be any of:
name:func
instructs the extractor to extract function func from
the file.
size:number
instructs the extractor to extract functions with
number or fewer, statements from the file.
lib:dirname
Use directory dirname as the extract directory (required in
order to save and re-use inline libraries).
If you specify both name and size, the compiler extracts functions that match func, or that have number or fewer statements. For examples of extracting functions, see Chapter 4, Function Inlining.
-Minline[=func | filename.ext | number | levels:number],...
This passes options to the function inliner where:
func
instructs the inliner to inline the function func. The func name should be a non-numeric string that does not contain a
period. You can also use a name: prefix followed by the
function name. If name: is specified, what follows is always
the name of a function.
filename.ext
instructs the inliner to inline the functions within the library file filename.ext. The compiler assumes that a filename.ext option containing a period is a library file. Create the library file using the -Mextract option. You can also use a lib: prefix followed by the library name. If lib: is specified, no period is necessary in the library name. Functions from the specified library are inlined. If no library is specified, functions are extracted from a temporary library created during an extract prepass.
number
instructs the inliner to inline functions with number or fewer,
statements. You can also use a size: prefix followed by a
number. If size: is specified, what follows is always taken as a
number.
levels:number
instructs the inliner to perform number levels of inlining. The
default number is 1.
If you specify both func and number, the compiler inlines functions that match the function name or have number or fewer statements. For examples of inlining functions, see Chapter 4, Function Inlining.

Usage: In the following example, the compiler extracts functions that have 500 or fewer statements from the source file myprog.f and saves them in the file extract.il.

	$ pgf90 -Mextract=500 -oextract.il myprog.f

In the following example, the compiler inlines functions with fewer than approximately 100 statements in the source file myprog.f and writes the executable code in the default output file a.out.

	$ pgf90 -Minline=size:100 myprog.f

Cross-reference: -o


-Mpgflag Fortran Language Controls


This section describes the -Mpgflag options that affect Fortran language interpretations by the PGI Fortran compilers. These options are only valid to the pgf77, pgf90, and pghpf compilation drivers.

Syntax:

-Mbackslash
the compiler treats the backslash as a normal character, and not as an escape character in quoted strings.
-Mnobackslash
the compiler recognizes a backslash as an escape character in quoted strings (in accordance with standard C usage).
-Mdclchk
the compiler requires that all program variables be declared.
-Mnodclchk
the compiler does not require that all program variables be declared.
-Mdefaultunit
the compiler treats "*" as a synonym for standard input for reading and standard output for writing.
-Mnodefaultunit
the compiler treats "*" as a synonym for unit 5 on input and unit 6 on output.
-Mdlines
the compiler treats lines containing "D" in column 1 as executable statements (ignoring the "D").
-Mnodlines
the compiler does not treat lines containing "D" in column 1 as executable statements (does not ignore the "D").
-Mdollar,char
char specifies the character to which the compiler maps the dollar sign. The compiler allows the dollar sign in names.
-Mextend
with -Mextend, the compiler accepts 132-column source code; otherwise it accepts 72-column code.
-Miomutex
the compiler generates critical section calls around Fortran I/O statements.
-Mnoiomutex
the compiler does not generate critical section calls around Fortran I/O statements.
-Monetrip
the compiler forces each DO loop to execute at least once.
-Mnoonetrip
the compiler does not force each DO loop to execute at least once. This option is useful for programs written for earlier versions of Fortran.
-Msave
the compiler assumes that all local variables are subject to the SAVE statement. Note that this may allow older Fortran programs to run, but it can greatly reduce performance.
-Mnosave
the compiler does not assume that all local variables are subject to the SAVE statement.
-Mstandard
the compiler flags non-ANSI-conforming source code.
-Munixlogical
directs the compiler to treat logical values as true if the value is non-zero and false if the value is zero (UNIX F77 convention.) When
-Munixlogical is enabled, a logical value or test that is non-zero is .TRUE., and a value or test that is zero is .FALSE.. In addition, the value of a logical expression is guaranteed to be one (1) when the result is .TRUE..
-Mnounixlogical
directs the compiler to use the VMS convention for logical values for true and false. Even values are true and odd values are false.
-Mupcase
the compiler allows uppercase letters in identifiers. With -Mupcase, the identifiers "X" and "x" are different, and keywords must be in lower case. This selection affects the linking process: if you compile and link the same source code using -Mupcase on one occasion and
-Mnoupcase on another, you may get two different executables (depending on whether the source contains uppercase letters). The standard libraries are compiled using the default -Mnoupcase.
-Mnoupcase
the compiler converts all identifiers to lower case. This selection affects the linking process: If you compile and link the same source code using -Mupcase on one occasion and -Mnoupcase on another, you may get two different executables (depending on whether the source contains uppercase letters). The standard libraries are compiled using -Mnoupcase.

Default: For arguments that you do not specify, the defaults are as follows:

nobackslash


noiomutex


nodclchk


noonetrip


nodefaultunit


nosave


nodlines


nounixlogical


dollar,_


noupcase



-Mpgflag C/C++ Language Controls


This section describes the -Mpgflag options that affect C/C++ language interpretations by the PGI C and C++ compilers. These options are only valid to the pgcc and pgCC compilation drivers.

Syntax:

-Masmkeyword
instructs the compiler to allow the asm keyword in C source files. The syntax of the asm statement is as follows:

asm("statement");
Where statement is a legal assembly-language statement. The quote marks are required.
-Mnoasmkeyword
instructs the compiler not to allow the asm keyword in C source files. If you use this option and your program includes the asm keyword, unresolved references will be generated
-Mdollar,char
char specifies the character to which the compiler maps the dollar sign ($). The PGCC compiler allows the dollar sign in names; ANSI C does not allow the dollar sign in names
-Mfcon
instructs the compiler to treat floating-point constants as float data types, instead of double data types. This option can improve the performance of single-precision code.
-Mschar
specifies signed char characters. The compiler treats "plain" char declarations as signed char.
-Msingle
do not to convert float parameters to double parameters in non-prototyped functions. This option can result in faster code if your program uses only float parameters. However, since ANSI C specifies that routines must convert float parameters to double parameters in non-prototyped functions, this option results in non-ANSI conformant code.
-Mnosingle
instructs the compiler to convert float parameters to double parameters in non-prototyped functions.
-Muchar
instructs the compiler to treat "plain" char declarations as unsigned char.

Default: For arguments that you do not specify, the defaults are as follows:

noasmkeyword


nosingle


dollar,_


schar



Usage:

In this example, the compiler allows the asm keyword in the source file.

	$ pgcc -Masmkeyword myprog.c

In the following example, the compiler maps the dollar sign to the dot character.

	$ pgcc -Mdollar,. myprog.c

In the following example, the compiler treats floating-point constants as float values.

	$ pgcc -Mfcon myprog.c

In the following example, the compiler does not convert float parameters to double parameters.

	$ pgcc -Msingle myprog.c

Without -Muchar or with -Mschar, the variable ch is a signed character:

	char ch;
signed char sch;

If -Muchar is specified on the command line:

	$ pgcc -Muchar myprog.c

char ch above is equivalent to:

    unsigned char ch;


-Mpgflag Optimization Controls


Syntax:

-Mcache_align
Align unconstrained objects of length greater than or equal to 16 bytes on cache-line boundaries. An unconstrained object is a data object that is not a member of an aggregate structure or common block. This option does not affect the alignment of allocatable or automatic arrays. NOTE: To effect cache-line alignment of stack-based local variables, the main program or function must be compiled with -Mcache_align.
-Mconcur[=option [,option,...]]
Instructs the compiler to enable auto-concurrentization of loops. If
-Mconcur is specified, multiple processors will be used to execute loops which the compiler determines to be parallelizable. Where option is one of the following:
altcode:n
Instructs the parallelizer to generate alternate
scalar code for parallelized loops.
If altcode is
specified without arguments, the parallelizer
determines an appropriate cutoff length and
generates scalar code to be executed whenever the
loop count is less than or equal to that length. If
altcode:n is specified, the scalar altcode is executed
whenever the loop count is less than or equal to n.
noaltcode
If noaltcode is specified, the parallelized version
of the loop is always executed regardless of the loop
count.
dist:block
Parallelize with block distribution (this is the
default).
Contiguous blocks of iterations of a
parallelizable loop are assigned to the available processors.
dist:cyclic
Parallelize with cyclic distribution. The
outermost parallelizable loop in any loop nest is
parallelized. If a parallelized loop is innermost, its
iterations are allocated to processors cyclically. For
example, if there are 3 processors executing a loop,
processor 0 performs iterations 0, 3, 6, etc.;
processor 1 performs iterations 1, 4, 7, etc.; and
processor 2 performs iterations 2, 5, 8, etc.
cncall
Calls in parallel loops are safe to parallelize.
Loops containing calls are candidates for
parallelization. Also, no minimum loop count
threshold must be satisfied before parallelization
will occur, and last values of scalars are assumed to
be safe.
noassoc
Disables parallelization of loops with reductions.
When linking, the -Mconcur switch must be specified or unresolved references will result. The NCPUS environment variable controls how many processors are used to execute parallelized loops.
Note: this option applies only on shared-memory multi-processor systems.
-Mcray[=option[,option,...]]
(pgf77 and pgf90 only) Force Cray Fortran (CF77) compatibility with respect to the listed options. Possible values of option include:
pointer
for purposes of optimization, it is assumed that pointer-based variables do not overlay the storage of any other variable.
-Mdepchk
instructs the compiler to assume unresolved data dependences actually conflict.
-Mnodepchk
instructs the compiler to assume potential data dependences do not conflict. However, if data dependences exist, this option can produce incorrect code.
-Mi4
(pgf77 and pgf90 only) the compiler treats INTEGER variables as INTEGER*4.
-Mnoi4
(pgf77 and pgf90 only) the compiler treats INTEGER variables as INTEGER*2.
-Mnoframe
Eliminates operations that set up a true stack frame pointer for every function. With this option enabled, you cannot perform a traceback on the generated code and you cannot access local variables.
-Mr8
(pgf77, pgf90 and pghpf only) the compiler promotes REAL variables and constants to DOUBLE PRECISION variables and constants, respectively. DOUBLE PRECISION elements are 8 bytes in length.
-Mnor8
(pgf77, pgf90 and pghpf only) the compiler does not promote REAL variables and constants to DOUBLE PRECISION. REAL variables will be single precision (4 bytes in length).
-Mr8intrinsics
(pgf77, and pgf90 only) the compiler treats the intrinsics CMPLX and REAL as DCMPLX and DBLE, respectively.
-Mnor8intrinsics

(pgf77, and pgf90 only) the compiler does not promote the intrinsics CMPLX and REAL to DCMPLX and DBLE, respectively.
-Msafeptr[=option[,option,...]]
(pgcc and pgCC only) instructs the C/C++ compiler to override data dependences between pointers of a given storage class. Possible values of option include:
arg
instructs the compiler that arrays and pointers are treated with the same copyin and copyout semantics as Fortran dummy arguments.
global
instructs the compiler that global or external pointers and arrays do not overlap or conflict with each other and are independent.
local/auto
instructs the compiler that local pointers and arrays do not overlap or conflict with each other and are independent.
static
instructs the compiler that static pointers and arrays do not overlap or conflict with each other and are independent.
-Munroll[=option [,option...]]
invokes the loop unroller. This also sets the optimization level to 2 if the level is set to less than 2. The option is one of the following:
c:m
instructs the compiler to completely unroll loops with a constant loop count less than or equal to m, a supplied constant. If this value is not supplied, the m count is set to 4.
n:u
instructs the compiler to unroll u times, a loop which is not completely unrolled, or has a non-constant loop count. If u is not supplied, the unroller computes the number of times a candidate loop is unrolled.
-Mnounroll
instructs the compiler not to unroll loops.
-Mvect[=option [,option,...]]
invokes the code vectorizer, where option is one of the following:
altcode:n
Instructs the vectorizer to generate alternate
scalar code for vectorized loops. If altcode is
specified without arguments, the vectorizer
determines an appropriate cutoff length and
generates scalar code to be executed whenever the
loop count is less than or equal to that length. If
altcode:n is specified, the scalar altcode is executed
whenever the loop count is less than or equal to n.
noaltcode
If noaltcode is specified, the vectorized version
of the loop is always executed regardless of the loop
count.
assoc
Instructs the vectorizer to enable certain associativity conversions that can change the results of a computation
due to roundoff error. A typical optimization is to change an arithmetic operation to an arithmetic operation that is mathematically correct, but can be computationally different, due to round-off error
noassoc
Instructs the vectorizer to disable associativity conversions.
cachesize:n
Instructs the vectorizer, when performing cache tiling optimizations, to assume a cache size of n. The default is
n = 262144.
smallvect[:n]
Instructs the vectorizer to assume that the maximum vector length is less than or equal to n. The vectorizer uses this information to eliminate generation of the stripmine loop for vectorized loops wherever possible. If the size n is omitted, the default is 100.
Note: no space is allowed on either side of the colon (:).
sse
Instructs the vectorizer to search for vectorizable loops and, where possible, make use of Pentium III SSE and prefetch instructions.
prefetch
Instructs the vectorizer to search for vectorizable loops and, where possible, make use of Pentium III or AMD Athlon prefetch instructions.

Default: For arguments that you do not specify, the default optimization control options are as follows:

depchk


nor8


i4


nor8intrinsics


If you do not supply an option to -Mvect, the compiler uses defaults that are dependent upon the target system.

Usage: In this example, the compiler invokes the vectorizer with idiom recognition for Pentium III SSE instructions enabled.

	$ pgf90 -Mvect=sse -Mcache_align myprog.f

Cross-reference: -g, -O


-Mpgflag Miscellaneous Controls


Syntax:

-Manno
annotate the generated assembly code with source code.
-Mbounds
enables array bounds checking. If an array is an assumed size array, the bounds checking only applies to the lower bound. If an array bounds violation occurs during execution, an error message describing the error is printed and the program terminates. The text of the error message includes the name of the array, the location where the error occurred (the source file and the line number in the source), and information about the out of bounds subscript (its value, its lower and upper bounds, and its dimension). For example:

PGFTN-F-Subscript out of range for array a (a.f: 2) subscript=3, lower bound=1, upper bound=2, dimension=2
-Mnobounds
disables array bounds checking.
-Mbyteswapio
swap byte-order from big-endian to little-endian or vice versa upon input/output of Fortran unformatted data files.
-Mchkfpstk
instructs the compiler to check for internal consistency of the x86 floating-point stack in the prologue of a function and after returning from a function or subroutine call. Floating-point stack corruption may occur in many ways, one of which is Fortran code calling floating-point functions as subroutines (i.e. with the CALL statement). If the PGI_CONTINUE environment variable is set upon execution of a program compiled with -Mchkfpstk, the stack will be automatically cleaned up and execution will continue. There is a performance penalty associated with the stack cleanup. If PGI_CONTINUE is set to verbose, the stack will be automatically cleaned up and execution will continue after printing of a warning message.
-Mchkptr
instructs the compiler to check for pointers that are de-referenced while initialized to NULL (pgf90 and pghpf only).
-Mchkstk
instructs the compiler to check the stack for available space in the prologue of a function and before the start of a parallel region. Prints a warning message and aborts the program gracefully if stack space is insufficient. Useful when many local and private variables are declared in an OpenMP program.
-Minfo[=option [,option,...]]
instructs the compiler to produce information on standard error, where option is one of the following:
all
instructs the compiler to produce all available -Minfo information.
inline
instructs the compiler to display information about extracted or inlined functions. This option is not useful without either the -Mextract or -Minline option.
loop
instructs the compiler to display information about loops, such as information on vectorization.
opt
instructs the compiler to display information about optimization.
time
instructs the compiler to display compilation statistics.
unroll
instructs the compiler to display information about loop unrolling.
-Mneginfo[=option [,option,...]]
instructs the compiler to produce information on standard error, where option is one of the following:
concur
instructs the compiler to produce all available information on why loops are not automatically parallelized. In particular, if a loop is not parallelized due to potential data dependence, the variable(s) that cause the potential dependence will be listed in the -Mneginfo messages.
loop
instructs the compiler to produce information on why memory hierarchy optimizations on loops are not performed.
-Minform,level
instructs the compiler to display error messages at the specified and higher levels, where level is one of the following:
fatal
instructs the compiler to display fatal error messages.
severe
instructs the compiler to display severe and fatal error messages.
warn
instructs the compiler to display warning, severe and fatal error messages.
inform
instructs the compiler to display all error messages (inform, warn, severe and fatal).
-Mkeepasm
instructs the compiler to keep the assembly file as compilation continues. Normally, the assembler deletes this file when it is finished. The assembly file has the same filename as the source file, but with a .s extension.
-Mlist
instructs the compiler to create a listing file. The listing file is filename.lst, where the name of the source file is filename.f.
-Mnolist
the compiler does not create a listing file. This is the default.
-Mnoopenmp
when used in combination with the -mp option, causes the compiler to ignore OpenMP parallelization directives or pragmas, but still process SGI-style parallelization directives or pragmas.
-Mnosgimp
when used in combination with the -mp option, causes the compiler to ignore SGI-style parallelization directives or pragmas, but still process OpenMP parallelization directives or pragmas.

Default: For arguments that you do not specify, the default miscellaneous options are as follows:

inform


warn


nolist


nobounds


Usage: In the following example the compiler includes Fortran source code with the assembly code.

	$ pgf90 -Manno -S myprog.f

In the following example the compiler displays information about inlined functions with fewer than approximately 20 source lines in the source file myprog.f.

	$ pgf90 -Minfo=inline -Minline=20 myprog.f

In the following example the assembler does not delete the assembly file myprog.s after the assembly pass.

	$ pgf90 -Mkeepasm myprog.f

In the following example the compiler creates the listing file myprog.lst.

	$ pgf90 -Mlist myprog.f

In the following example array bounds checking is enabled.

	$ pgf90 -Mbounds myprog.f

Cross-reference: -m, -S, -V, -v


-module <moduledir>


Use the -module option to specify a particular directory in which generated intermediate .mod files should be placed. If the -module <moduledir> option is present, and USE statements are present in a compiled program unit, <moduledir> will be searched for .mod intermediate files prior to the search in the default (local) directory.

Default: The compiler places .mod files in the current working directory, and searches only in the current working directory for pre-compiled intermediate .mod files.

Usage: The following command line requests that any intermediate module file produced during compilation of myprog.f be placed in the directory mymods (in particular, the file ./mymods/myprog.mod will be used):

$ pgf90 -module mymods myprog.f


-mp


Use the -mp option to instruct the compiler to interpret user-inserted OpenMP shared-memory parallel programming directives and generate an executable file which will utilize multiple processors in a shared-memory parallel system. See Chapter 10, OpenMP Parallelization Directives for Fortran, and Chapter 11, OpenMP Parallelization Pragmas for C and C++, for a detailed description of this programming model and the associated directives and pragmas.

Default: The compiler ignores user-inserted shared-memory parallel programming directives and pragmas.

Usage: The following command line requests processing of any shared-memory directives present in myprog.f:

$ pgf90 -mp myprog.f

Cross-reference: -Mconcur and -Mvect


-mslibs


(Win32 only) Use the -mslibs option to instruct the compiler to use the Microsoft linker and include files, and link against the Microsoft Visual C++ libraries. Microsoft Visual C++ must be installed in order to use this switch. This switch can be used to link Visual C++-compiled program units into PGI main programs on Win32.

Default: The compiler uses the PGI-supplied linker and include files and links against PGI-supplied libraries.

Cross-reference: -msvcrt


-msvcrt


(Win32 only) Use the -msvcrt option to instruct the compiler to use Microsoft's msvcrt.dll at runtime rather than the default crtdll.dll. These files contain the Microsoft C runtime library and the default mingw32 C runtime library respectively. It is recommended that you use the -msvcrt option in combination with the -mslibs option.

Default: The compiler uses crtdll.dll at runtime.

Cross-reference: -mslibs


-O


Invokes code optimization at the specified level.

Syntax:

-O [level]

Where level is one of the following:

0
creates a basic block for each statement. Neither scheduling nor global optimization is done. To specify this level, supply a 0 (zero) argument to the -O option.
1
schedules within basic blocks and performs some register allocations, but does no global optimization.
2
performs all level-1 optimizations, and also performs global scalar optimizations such as induction variable elimination and loop invariant movement.

Default: Table 7-3 shows the interaction between the -O option, -g option, and -Mvect options.

Table 7-3 Optimization and -O, -g, -Mvect, and -Mconcur Options

Optimize
Option

Debug
Option

-M
Option

Optimization Level

none


none


none


1


none


none


-Mvect


2


none


none


-Mconcur


2


none


-g


none


0


-O


none or -g


none


2


-Olevel


none or -g


none


level


-Olevel < 2


none or -g


-Mvect


2


-Olevel < 2


none or -g


-Mconcur


2



Unoptimized code compiled using the option -O0 can be significantly slower than code generated at other optimization levels. Like the -Mvect option, the -Munroll option sets the optimization level to level-2 if no -O or -g options are supplied. For more information on optimization, see Chapters 2 and 3.

Usage: In the following example, since no optimization level is specified and a -O option is specified, the compiler sets the optimization to level-2.

$ pgf90 -O myprog.f

Cross-reference: -g, -Mpgflag


-o


Names the executable file. Use the -o option to specify the filename of the compiler object file. The final output is the result of linking.

Syntax:

-o filename

Where filename is the name of the file for the compilation output. The filename must not have a .f extension.

Default: The compiler creates executable filenames as needed. If you do not specify the -o option, the default filename is the linker output file a.out.

Usage: In the following example, the executable file is myprog instead of the default a.out.

$ pgf90 myprog.f -o myprog

Cross-reference: -c ,-E, -F, -S


-pc


Syntax:

-pc { 32 | 64 | 80 }

The IA-32 architecture implements a floating-point stack using 8 80-bit registers. Each register uses bits 0-63 as the significand, bits 64-78 for the exponent, and bit 79 is the sign bit. This 80-bit real format is the default format (called the extended format). When values are loaded into the floating point stack they are automatically converted into extended real format. The precision of the floating point stack can be controlled, however, by setting the precision control bits (bits 8 and 9) of the floating control word appropriately. In this way, the programmer can explicitly set the precision to standard IEEE double-precision using 64 bits, or to single precision using 32 bits.[*] The default precision is system dependent. To alter the precision in a given program unit, the main program must be compiled with the same -pc option. The command line option -pc val lets the programmer set the compiler's precision preference. Valid values for val are:

32
single precision
64
double precision
80
extended precision

Operations performed exclusively on the floating-point stack using extended precision, without storing into or loading from memory, can cause problems with accumulated values within the extra 16 bits of extended precision values. This can lead to answers, when rounded, that do not match expected results.

For example, if the argument to sin is the result of previous calculations performed on the floating-point stack, then an 80-bit value used instead of a 64-bit value can result in slight discrepancies. Results can even change sign due to the sin curve being too close to an x-intercept value when evaluated. To maintain consistency in this case, the programmer can assure that the compiler generates code that calls a function. According to the IA-32 ABI, a function call must push its arguments on the stack (in this way memory is guaranteed to be accessed, even if the argument is an actual constant.) Thus, even if the called function simply performs the inline expansion, using the function call as a wrapper to sin has the effect of trimming the argument precision down to the expected size. Using the -Mnobuiltin option on the command line for C accomplishes this task by resolving all math routines in the library libm, performing a function call of necessity. The other method of generating a function call for math routines, but one which may still produce the inline instructions, is by using the -Kieee switch.

A second example illustrates the precision control problem using a section of code to determine machine precision:

        program find_precision  

w = 1.0
100 w=w+w
y=w+1
z=y-w
if (z .gt. 0) goto 100
C now w is just big enough that |((w+1)-w)-1| >= 1 ...
print*,w
end

In this case, where the variables are implicitly real*4, operations are performed on the floating-point stack where optimization removed unnecessary loads and stores from memory. The general case of copy propagation being performed follows this pattern:

         a = x
y = 2.0 + a

Instead of storing x into a, then loading a to perform the addition, the value of x can be left on the floating-point stack and added to 2.0. Thus, memory accesses in some cases can be avoided, leaving answers in the extended real format. If copy propagation is disabled, stores of all left-hand sides will be performed automatically and reloaded when needed. This will have the effect of rounding any results to their declared sizes.

For the above program, w has a value of 1.8446744E+19 when executed using default (extended) precision. If, however, -Kieee is set, the value becomes 1.6777216E+07 (single precision.) This difference is due to the fact that -Kieee disables copy propagation, so all intermediate results are stored into memory, then reloaded when needed. Copy propagation is only disabled for floating-point operations, not integer. With this particular example, setting the -pc switch will also adjust the result.

The switch -Kieee also has the effect of making function calls to perform all transcendental operations. Although the function still produces the IA-32 machine instruction for computation (unless in C the -Mnobuiltin switch is set), arguments are passed on the stack, which results in a memory store and load.

Finally, -Kieee also disables reciprocal division for constant divisors. That is, for a/b with unknown a and constant b, the expression is usually converted at compile time to a*(1/b), thus turning an expensive divide into a relatively fast scalar multiplication. However, numerical discrepancies can occur when this optimization is used.

Understanding and correctly using the -pc, -Mnobuiltin, and -Kieee switches should enable you to produce the desired and expected precision for calculations which utilize floating-point operations.

Usage:

$ pgf90 -pc 64 myprog.c


-Q


Selects variations for compilation. There are four uses for the -Q option.

Syntax:

-Qdirdirectory

The first variety, using the dir keyword, lets you supply a directory parameter that indicates the directory where the compiler driver is located.

-Qoptionprog,opt

The second variety, using the option keyword, lets you supply the option opt to the program prog. The prog parameter can be one of pgftn, as, or ld.

-Qpathpathname

The third -Q variety, using the path keyword, lets you supply an additional pathname to the search path for the compiler's required .o files.

-Qproducesourcetype

The fourth -Q variety, using the produce keyword, lets you choose a stop-after location for the compilation based on the supplied sourcetype parameter. Valid sourcetypes are: .i, .c, .s and .o. These indicate respectively, stop-after preprocessing, compiling, assembling, or linking.

Usage: The following examples show the different -Q options.

$ pgf90 -Qproduce .s hello.f
$ pgf90 -Qoption ld,-s hello.f
$ pgf90 -Qpath /home/test hello.f
$ pgf90 -Qdir /home/comp/new hello.f

Cross-reference: -p


-R<directory>


Valid only on Linux and Solaris86. Passed to the linker. Instructs the linker to hard-code the pathname <directory> into the search path for generated shared object (dynamically linked library) files. Note that there cannot be a space between R and <directory>.

Cross-reference: -fpic, -shared, -G


-r4 and -r8


Interpret DOUBLE PRECISION variables as REAL (-r4) or REAL variables as DOUBLE PRECISION (-r8).

Usage:

$ pgf90 -r4 myprog.f

Cross-reference: -i2, -i4, -i8


-rc


Specifies the name of the driver startup configuration file. If the file or pathname supplied is not a full pathname, the path for the configuration file loaded is relative to the $DRIVER path (the path of the currently executing driver). If a full pathname is supplied, that file is used for the driver configuration file.

Syntax:

-rc [path] filename

Where path is either a relative pathname, relative to the value of $DRIVER, or a full pathname beginning with "/". Filename is the driver configuration file.

Default: The driver uses the configuration file .pgirc.

Usage: In the following example, the file .pgf90rctest, relative to /usr/pgi/linux86/bin, the value of $DRIVER, is the driver configuration file.

$ pgf90 -rc .pgf90rctest myprog.f

Cross-reference: -show


-S


Stops compilation after the compiling phase and writes the assembly-language output to the file filename.s, where the input file is filename.f.

Default: The compiler produces an executable file.

Usage: In this example, pgf90 produces the file myprog.s in the current directory.

$ pgf90 -S myprog.f

Cross-reference: -c, -E, -F, -Mkeepasm, -o


-shared


Valid only on Linux. Passed to the linker. Instructs the linker to produce a shared object (dynamically linked library) file.

Cross-reference: -fpic, -G, -R


-show


Produce driver help information describing the current driver configuration.

Usage: In the following example, the driver displays configuration information to the standard output after processing the driver configuration file.

$ pgf90 -show myprog.f

Cross-reference: -V , -v, -###, -help, -rc


-silent


Do not print warning messages.

Usage: In the following example, the driver does not display warning messages.

$ pgf90 -silent myprog.f

Cross-reference: -v, -V, -w


-time


Print execution times for various compilation steps.

Usage: In the following example pgf90 prints the execution times for the various compilation steps.

$ pgf90 -time myprog.f

Cross-reference: -#


-tp


Set the target architecture. By default, the PGI compilers produce code specifically targeted to the type of processor on which the compilation is performed. In particular, the default is to use so-called p6 instructions wherever possible when compiling on Pentium Pro/II/III or AMD Athlon systems. These executables may not be useable on older generation systems (Pentium, i486, etc). Pentium-specific and Pentium Pro/II/III-specific optimizations can be specified explicitly by using the -tp p5 and -tp p6 options respectively. AMD Athlon-specific code generation can be specified explicitly by using the -tp athlon option. A blended p5/p6 style of code generation can be specified using the -tp px option. Executables produced using -tp px will run on any x86 system.

Syntax:

-tp {p5 | p6 | px | athlon}

Usage: In the following example pgf90 sets the target architecture to Pentium Pro/II/III:

$ pgf90 -tp p6 myprog.f

Default: The default style of code generation is auto-selected depending on the type of processor on which compilation is performed.


-U


Undefines a preprocessor macro. Use the -U option or the #undef preprocessor directive to undefine macros.

Syntax:

-Usymbol

Where symbol is a symbolic name.

Usage: The following examples undefine the macro test.

$ pgf90 -Utest  myprog.F
$ pgf90 -Dtest -Utest myprog.F

Cross-reference: -D,-Mnostdde.


-V


Displays additional information, including version messages.

Usage: The following command-line shows the output using the -V option.

$ pgf90 -V myprog.f

Cross-reference: -Minfo, -v


-v


Use the -v option to display the invocations of the compiler, assembler and linker. These invocations are command lines created by the compilation driver from the files and the -W options you specify on the compiler command-line.

Default: The compiler does not display individual phase invocations.

Cross-reference: -Minfo, -V


-W


Passes arguments to a specific phase. Use the -W option to specify options for the assembler, compiler or linker. Note: a given PGI compiler command invokes the compiler driver, which parses the command-line and generates the appropriate commands for the compiler, assembler and linker.

Syntax:

-W  {0 | a | l },option[,option...]

Where:

0
(the number zero) specifies the compiler.
a
specifies the assembler.
l
(lowercase letter l) specifies the linker.
option
is a string that is passed to and interpreted by the compiler, assembler or linker. Options separated by commas are passed as separate command line arguments.

NOTE: You cannot have a space between the -W and the single-letter pass identifier, between the identifier and the comma, or between the comma and the option.

Usage: In the following example the linker loads the text segment at address 0xffc00000 and the data segment at address 0xffe00000.

$ pgf90 -Wl,-k,-t,0xffc00000,-d,0xffe00000 myprog.f


-w


Do not print warning messages.

7.2 C and C++ -specific Compiler Options

The following options are specific to PGCC C and/or C++.


-A


(pgCC only) Using this option the PGCC C++ compiler accepts code conforming to the proposed ANSI C++ standard. Issue errors for non-conforming code.

Default: By default, the compiler accepts code conforming to the standard C++ Annotated Reference Manual.

Usage: The following command-line requests ANSI conforming C++.

	$ pgCC -A hello.cc

Cross-references: -b and +p.


--[no_]alternative_tokens


(pgCC only) Enable or disable recognition of alternative tokens. These are tokens that make it possible to write C++ without the use of the , , [, ], #, &, , ^, and characters. The alternative tokens include the operator keywords (e.g., and, bitand, etc.) and digraphs. The default behavior is --no_alternative_tokens.


-b


(pgCC only) Enable compilation of C++ with cfront 2.1 compatibility. This causes the compiler to accept language constructs that, while not part of the C++ language definition are accepted by the AT&T C++ Language System (cfront release 2.1). This option also enables acceptance of anachronisms.

Default: The compiler does not accept cfront language constructs that are not part of the C++ language definition.

Usage: In the following example the compiler accepts cfront constructs.

	$ pgCC -b myprog.cc

Cross-references: --cfront2.1, -b3 , --cfront3.0, +p, -A


-b3


(pgCC only) Enable compilation of C++ with cfront 3.0 compatibility. This causes the compiler to accept language constructs that, while not part of the C++ language definition are accepted by the AT&T C++ Language System (cfront release 3.0). This option also enables acceptance of anachronisms.

Default: The compiler does not accept cfront language constructs that are not part of the C++ language definition.

Usage: In the following example the compiler accepts cfront constructs.

	$ pgCC -b3 myprog.cc

Cross-references: --cfront2.1, -b , --cfront3.0 , +p, -A


--[no_]bool


(pgCC only) Enable or disable recognition of bool. The default value is --bool.


--cfront_2.1


(pgCC only) Enable compilation of C++ with cfront 2.1 compatibility. This causes the compiler to accept language constructs that, while not part of the C++ language definition are accepted by the AT&T C++ Language System (cfront release 2.1). This option also enables acceptance of anachronisms.

Default: The compiler does not accept cfront language constructs that are not part of the C++ language definition.

Usage: In the following example the compiler accepts cfront constructs.

	$ pgCC --cfront_2.1 myprog.cc

Cross-references: -b, -b3 , --cfront3.0, +p, -A


--cfront_3.0


(pgCC only) Enable compilation of C++ with cfront 3.0 compatibility. This causes the compiler to accept language constructs that, while not part of the C++ language definition are accepted by the AT&T C++ Language System (cfront release 3.0). This option also enables acceptance of anachronisms.

Default: The compiler does not accept cfront language constructs that are not part of the C++ language definition.

Usage: In the following example the compiler accepts cfront constructs.

	$ pgCC --cfront_3.0 myprog.cc

Cross-references: --cfront2.1, -b , -b3 , +p, -A


--create_pch filename


(pgCC only) If other conditions are satisfied, create a precompiled header file with the specified name. If --pch (automatic PCH mode) appears on the command line following this option, its effect is erased.


--diag_suppress tag


(pgCC only) Override the normal error severity of the specified diagnostic messages. The message(s) may be specified using a mnemonic error tag or using an error number.


--diag_remark tag


(pgCC only) Override the normal error severity of the specified diagnostic messages. The message(s) may be specified using a mnemonic error tag or using an error number.


--diag_warning tag


(pgCC only) Override the normal error severity of the specified diagnostic messages. The message(s) may be specified using a mnemonic error tag or using an error number.


--diag_error tag


(pgCC only) Override the normal error severity of the specified diagnostic messages. The message(s) may be specified using a mnemonic error tag or using an error number.


--display_error_number


(pgCC only) Display the error message number in any diagnostic messages that are generated. The option may be used to determine the error number to be used when overriding the severity of a diagnostic message.


--[no_]exceptions


(pgCC only) Enable/disable exception handling support. The default is --exceptions.


--instantiation_dir <dirname>


(pgCC only) Defines <dirname> as the instantiation directory. The directory must exist. This switch must appear on both the compile line and the link line. The compiler will not delete objects from this directory.


--[no]llalign


(pgCC only) Do/don't align long long integers on long long boundaries. The default is --llalign.


-M


Generate a list of make dependences and print them to stdout. Compilation stops after the pre-processing phase.


-MD


Generate a list of make dependences and print them to the file <file>.d, where <file> is the name of the file under compilation.


--one_instantiation_per_object


(pgCC only) By default, templates are instantiated in objects that reference them, and multiple instantiations are avoided by calling pgprelnk to modify the template instantiation file (an intermediate file with a .ii extension). This does not work well for template libraries, where the .ii files are not available to the archived .o files. As a result, each file in a template library has to have its own local copy of each template it instantiates.

With the --one_instantiation_per_object implementation, each template instantiation becomes an object in the instantiation directory, (default name: Template.dir). As a result, each template can be linked in independently. At link time, pgprelnk removes all the unnecessary instantiations in the local Template.dir objects, and passes the remaining objects to the linker. This is particularly useful in template libraries, where it results in only one instantiation of any template in the library.

The --one_instantiation_per_object flag must appear on both the compile line and the link line. It will create an additional .o in the instantiation directory for each instantiation. If --instantiation_dir is not used (see below), a temporary directory Template.dir is created and used as the instantiation directory, then deleted after linking of the executable.

If you use --one_instantiation_per_object to create your own template libraries, you must add the objects in the Template directory to the archive list. See the example below.

NOTE: Before using this switch for the first time, all .ii files should be removed. Old .ii files will cause unpredictable results. Note that the compiler also creates .ti files for use during instantiation.


--optk_allow_dollar_in_id_chars


(pgCC only) Accept dollar signs ($) in identifiers.


-P


Stops compilation after the preprocessing phase. Use the -P option to halt the compilation process after preprocessing and write the preprocessed output to the file filename.i, where the input file is filename.c or filename.cc.

Use the -.suffix option with this option to save the intermediate file in a file with the specified suffix (see the -.suffix description for details).

Default: The compiler produces an executable file.

Usage: In the following example, the compiler produces the preprocessed file myprog.i in the current directory.

	$ pgCC -P myprog.cc

Cross-references: -C,-c,-E, -Mkeepasm, -o, -S


--pch


(pgCC only) Automatically use and/or create a precompiled header file. If --use_pch or
--create_pch (manual PCH mode) appears on the command line following this option, its effect is erased.


--pch_dir directoryname


(pgCC only) The directory in which to search for and/or create a precompiled header file. This option may be used with automatic PCH mode (--pch) or manual PCH mode (--create_pch or --use_pch).


--[no_]pch_messages


(pgCC only) Enable or disable the display of a message indicating that a precompiled header file was created or used in the current compilation.


--preinclude=<filename>


(pgCC only) Specifies the name of a file to be included at the beginning of the compilation. This option can be used to set system-dependent macros and types, for example.


--prelink_objects


(pgCC only) Creates the necessary template instantiations for template libraries that reference other template libraries. In previous releases, for example, libraries that reference templates in the Rogue Wave STL, would generate undefined template references. Now, when the user builds the library object files with the --one_instantiation_per_object flag, and pre-links the object files with the command:

% pgCC --one_instantiation_per_object --prelink_objects *.o

the pre-linker will instantiate the templates required by the library.


--use_pch filename


(pgCC only) Use a precompiled header file of the specified name as part of the current compilation. If --pch (automatic PCH mode) appears on the command line following this option, its effect is erased.


--[no_]using_std


(pgCC only) Enable or disable implicit use of the std namespace when standard header files are included.

Default: The default is --using_std.

Usage: The following command-line disables implicit use of the std namespace:

	$ pgCC --no_using_std hello.cc


-t


(pgCC only) Control instantiation of template functions.

Syntax:

-t [arg]

where arg is one of the following:

all
Instantiates all functions whether or not they are used.
local
Instantiates only the functions that are used in this compilation, and forces those functions to be local to this compilation. Note: this may cause multiple copies of local static variables. IF this occurs, the program may not execute correctly.
none
Instantiates no functions. (this is the default)
used
Instantiates only the functions that are used in this compilation.

Usage: In the following example all templates are instantiated.

	$ pgCC -tall myprog.cc


[*]

According to Intel documentation, this only affects the operations of add, subtract, multiply, divide, and square root.


<< << " border=0> >> > " border=0> Title Contents Index Home Help

Powered by Plone This site conforms to the following standards: