PGI Optimization-Related Compiler Options. STMicroelectronics PGI
Reklama
Reklama
Chapter 16. Command-Line Options Reference
Option
–Mprof= time
Description
(–tp px/p5/p6/piii targets only) Set precision globally for x87 floating-point calculations; must be used when compiling the main program. <val> may be one of 32, 64 or 80.
Instrument the generated executable to produce a gprof-style gmon.out sample-based profiling trace file (–qp is also supported, and is equivalent).
PGI Optimization-Related Compiler Options
The options included in the following table are the ones you typically use when you are optimizing your program or application code.
Option
–Mprof=time
Table 16.3. Optimization-Related PGI Compiler Options
Description
Generally optimal set of flags for targets that support SSE capability.
Generally optimal set of flags for targets that include SSE/SSE2 capability.
Selects variations for code generation and optimization.
Interpret and process user-inserted shared-memory parallel programming directives (see Chapters 5 and 6).
Specifies code optimization level where <level> is 0, 1, 2, 3, or 4.
(–tp px/p5/p6/piii targets only) Set precision globally for x87 floating-point calculations; must be used when compiling the main program. <val> may be one of 32, 64 or 80.
Instrument the generated executable to produce a gprof-style gmon.out sample-based profiling trace file (-qp is also supported, and is equivalent).
PGI Linking and Runtime-Related Compiler Options
The options included in the following table are the ones you typically use to define parameters related to linking and running your program or application code.
Option
Table 16.4. Linking and Runtime-Related PGI Compiler Options
Description
Compiles for and links to the DLL version of the PGI runtime libraries.
Compiles for and links to the static version of the PGI runtime libraries.
(Fortran only) Swap bytes from big-endian to little-endian or vice versa on input/output of unformatted data
203
C and C++ Compiler Options
Option
Description
(Linux only) Generate position-independent code.
(Linux only) Equivalent to –fpic.
(Linux only) Passed to the linker. Instructs the linker to produce a shared object file.
–i2
(Linux only) Allow object files generated by g77 to be linked into
PGI main programs.
Treat INTEGER variables as 2 bytes.
–i4
–i8
Treat INTEGER variables as 4 bytes.
Treat INTEGER and LOGICAL variables as 8 bytes and use 64-bits for
INTEGER*8 operations.
Requests special compilation semantics with regard to conformance to IEEE 754.
Selects variations for code generation and optimization.
(–tp k8-64 and –tp p7-64 targets only) Generate code which supports the medium memory model in the linux86-64 environment.
(Linux only) Passed to the linker. Instructs the linker to generate a shared object file. Implies –fpic.
Pass the soname option and its argument to the linker.
– ta=nvidia(,nvidia_suboptions),host
Specify the target accelerator.
Specify the type(s) of the target processor(s).
C and C++ Compiler Options
There are a large number of compiler options specific to the PGCC and PGC++ compilers, especially PGC+
+. The next table lists several of these options, but is not exhaustive. For a complete list of available options, including an exhaustive list of PGC++ options, use the –help command-line option. For further detail on a given option, use –help and specify the option explicitly. The majority of these options are related to building your program or application.
Option
Table 16.5. C and C++ -specific Compiler Options
Description
(pgcpp only) Accept proposed ANSI C++, issuing errors for non-conforming code.
(pgcpp only) Accept proposed ANSI C++, issuing warnings for non-conforming code.
204
Chapter 16. Command-Line Options Reference
Option
--dependencies (see
--dependencies_to_file filename
Description
(pgcpp 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.
Allow C++ comments (using //) in C source.
(pgcpp 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. EDG option.
(pgcpp only) Compile with cfront 3.0 compatibility. See
–b.
(pgcpp only) Enable or disable recognition of bool. The default value is ––bool.
Do/don’t compile with math subroutine builtin support, which causes selected math library routines to be inlined. The default is ––builtin.
(pgcpp only) Enable compilation of C++ with compatibility with cfront version 2.1.
(pgcpp only) Enable compilation of C++ with compatibility with cfront version 3.0.
(pgcpp only) Create a precompiled header file with the name filename.
(pgcc only) Prints additional information from the preprocessor.
(pgcpp only) Print makefile dependencies to stdout.
(pgcpp only) Print makefile dependencies to file filename
.
(pgcpp only) Display the error message number in any diagnostic messages that are generated.
(pgcpp only) Override the normal error severity of the specified diagnostic messages.
(pgcpp only) Override the normal error severity of the specified diagnostic messages.
(pgcpp only) Override the normal error severity of the specified diagnostic messages.
(pgcpp only) Override the normal error severity of the specified diagnostic messages.
205
C and C++ Compiler Options
Option
,filename
--optk_allow_dollar_in_id_chars
Description
(pgcpp only) Set the C++ front-end error limit to the specified <number>.
(pgcpp only) Disable/enable exception handling support. The default is ––exceptions
(pgcpp only) Allow GNU extensions like "include next" which are required to compile Linux system header files.
(pgcpp only) Sets the GNU C++ compatibility version.
(pgcpp only) Do/don’t align longlong integers on integer boundaries. The default is ––llalign.
Generate make dependence lists.
Generate make dependence lists.
(pgcpp only) Generate make dependence lists and print them to file filename.
Sets the Microsoft C++ compatibility version.
(pgcpp only) Accept dollar signs in identifiers.
Stops after the preprocessing phase and saves the preprocessed file in filename.i.
(pgcpp only) Disallow all anachronistic constructs.
cfront option
(pgcpp only) Automatically use and/or create a precompiled header file.
(pgcpp only) The directory dirname in which to search for and/or create a precompiled header file.
(pgcpp only) Enable/ disable the display of a message indicating that a precompiled header file was created or used.
(pgcpp only) Specify file to be included at the beginning of compilation so you can set system-dependent macros, types, and so on.
Control instantiation of template functions. EDG option
(pgcpp only) Use a precompiled header file of the specified name as part of the current compilation.
(pgcpp only) Enable/disable implicit use of the std namespace when standard header files are included.
(pgcpp only) Allow $ in names.
206
Chapter 16. Command-Line Options Reference
Generic PGI Compiler Options
The following descriptions are for all the PGI options. For easy reference, the options are arranged in alphabetical order. For a list of options by tasks, refer to the tables in the beginning of this chapter as well as to
.
–#
Displays the invocations of the compiler, assembler and linker.
Default:
The compiler does not display individual phase invocations.
Usage:
The following command-line requests verbose invocation information.
$ pgf95 -# prog.f
Description:
The –# option displays 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 value.
Related options:
–Minfo, –V, –v.
–###
Displays the invocations of the compiler, assembler and linker, but does not execute them.
Default:
The compiler does not display individual phase invocations.
Usage:
The following command-line requests verbose invocation information.
$ pgf95 -### myprog.f
Description:
Use the –### option to display the invocations of the compiler, assembler and linker but not to execute them. These invocations are command lines created by the compiler driver from the rc
files and the command-line options.
Related options:
–#, –dryrun, –Minfo, –V
–Bdynamic
Compiles for and links to the DLL version of the PGI runtime libraries.
Default:
The compiler uses static libraries.
Usage:
You can create the DLL obj1.dll
and its import library obj1.lib
using the following series of commands:
% pgf95 -Bdynamic -c object1.f
% pgf95 -Mmakedll object1.obj -o obj1.dll
Then compile the main program using this command:
$ pgf95 -# prog.f
For a complete example, refer to Example 9.1, “Build a DLL: Fortran,” on page 123
.
207
Generic PGI Compiler Options
Description:
Use this option to compile for and link to the DLL version of the PGI runtime libraries. This flag is required when linking with any DLL built by the PGI compilers. This flag corresponds to the
/MD
flag used by Microsoft’s cl compilers.
Note
On Windows,
–Bdynamic
must be used for
both
compiling and linking.
When you use the PGI compiler flag
–Bdynamic
to create an executable that links to the DLL form of the runtime, the executable built is smaller than one built without
–Bdynamic
. The PGI runtime DLLs, however, must be available on the system where the executable is run. The
–Bdynamic
flag must be used when an executable is linked against a DLL built by the PGI compilers.
Related options:
–Bstatic, –Mmakedll
–Bstatic
Compiles for and links to the static version of the PGI runtime libraries.
Default:
The compiler uses static libraries.
Usage:
The following command line explicitly compiles for and links to the static version of the PGI runtime libraries:
% pgf95 -Bstatic -c object1.f
Description:
You can use this option to explicitly compile for and link to the static version of the PGI runtime libraries.
Note
On Windows,
–Bstatic
must be used for
both
compiling and linking.
.
Related options:
–Bdynamic, –Bstatic_pgi, –Mdll
–Bstatic_pgi
Linux only. Compiles for and links to the static version of the PGI runtime libraries. Implies
–Mnorpath
.
Default:
The compiler uses static libraries.
Usage:
The following command line explicitly compiles for and links to the static version of the PGI runtime libraries:
% pgf95 -Bstatic -c object1.f
Description:
You can use this option to explicitly compile for and link to the static version of the PGI runtime libraries.
208
Chapter 16. Command-Line Options Reference
–byteswapio
Swaps the byte-order of data in unformatted Fortran data files on input/output.
Default:
The compiler does not byte-swap data on input/output.
Usage:
The following command-line requests that byte-swapping be performed on input/output.
$ pgf95 -byteswapio myprog.f
Description:
Use the
–byteswapio
option 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.
You can use this option to convert big-endian format data files produced by most RISC workstations and highend servers to the little-endian format used on x86 or x64 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. It further assumes that the IEEE representation is used for floating-point numbers. In particular, the format of unformatted data files produced by PGI Fortran compilers is identical to the format used on Sun and SGI workstations; this format allows you to read and write unformatted Fortran data files produced on those platforms from a program compiled for an x86 or x64 platform using the
–byteswapio option.
Related options:
None.
–C
Note
On Linux,
–Bstatic_pgi
results in code that runs on most Linux systems without requiring a
Portability package.
.
Related options:
–Bdynamic, –Bstatic, –Mdll
Enables array bounds checking. This option only applies to the PGI Fortran compilers.
Default:
The compiler does not enable array bounds checking.
Usage:
In this example, the compiler instruments the executable produced from myprog.f
to perform array bounds checking at runtime:
$ pgf95 -C myprog.f
Description:
Use this option to enable 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
209
Generic PGI Compiler Options the source), and information about the out of bounds subscript (its value, its lower and upper bounds, and its dimension).
Related options:
–M[no]bounds.
–c
–d<arg>
Prints additional information from the preprocessor. [Valid only for c (pgcc)]
Default:
No additional information is printed from the preprocessor.
Syntax:
-d[D|I|M|N]
-dD
Print macros and values from source files.
-dI
Print include file names.
-dM
Print macros and values, including predefined and command-line macros.
-dN
Print macro names from source files.
Usage:
In the following example, the compiler prints macro names from the source file.
$ pgf95 -dN myprog.f
Description:
Use the -d<arg> option to print additional information from the preprocessor.
Related options:
–E, –D, –U.
–D
Halts the compilation process after the assembling phase and writes the object code to a file.
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.
$ pgf95 -c myprog.f
Description:
Use the –c option to halt the compilation process after the assembling phase and write the object code to a file. If the input file is filename.f
, the output file is filename.o
.
Related options:
–E, –Mkeepasm, –o, and –S.
Creates a preprocessor macro with a given value.
210
Chapter 16. Command-Line Options Reference
Note
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.
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 is set to 128.
$ pgf95 -DPATHLENGTH=256 myprog.F
The source text in myprog.F
is this:
#ifndef PATHLENGTH
#define PATHLENGTH 128
#endif
SUBROUTINE SUB
CHARACTER*PATHLENGTH path
...
END
Description:
Use the –D option to create a preprocessor macro with a given value. The value must be either an integer or a character string.
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.
Related options:
–U
–dryrun
Displays the invocations of the compiler, assembler, and linker but does not execute them.
Default:
The compiler does not display individual phase invocations.
Usage:
The following command line requests verbose invocation information.
$ pgf95 -dryrun myprog.f
Description:
Use the
–dryrun
option to display the invocations of the compiler, assembler, and linker but not have them executed. These invocations are command lines created by the compiler driver from the rc
files and the command-line supplied with
–dryrun
.
Related options:
–Minfo, –V, –###
211
Generic PGI Compiler Options
–drystdinc
Displays the standard include directories and then exits the compiler.
Default:
The compiler does not display standard include directores.
Usage:
The following command line requests a display for the standard include directories.
$ pgf95 -drystdinc myprog.f
Description:
Use the
–drystdinc
option to display the standard include directories and then exit the compiler.
Related options:
None.
–dynamiclib
Invokes the libtool
utility program provided by Mac OS X to so you can create a dynamic library.
Default:
The compiler does not invoke the libtool utility.
Usage:
The following command line builds a dynamic library:
% pgf95 -dynamiclib world.f90 -o world.dylib
Description:
Use the –dynamiclib option to invoke the libtool
utility program provided by Mac OS X to so you can create a dynamic library. For a complete example, refer to
“Creating and Using Dynamic Libraries on
.
For more information on libtool
, refer to the libtool
man page.
Related options:
–Bdynamic, –Bstatic
–E
Halts the compilation process after the preprocessing phase and displays 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.
$ pgf95 -E myprog.f
Description:
Use the –E option to halt the compilation process after the preprocessing phase and display the preprocessed output on the standard output.
Related options:
–C, –c, –Mkeepasm, –o, –F, –S.
–F
Stops compilation after the preprocessing phase.
212
Chapter 16. Command-Line Options Reference
Default:
The compiler produces an executable file.
Usage:
In the following example the compiler produces the preprocessed file myprog.f
in the current directory.
$ pgf95 -F myprog.F
Description:
Use the –F option to halt the compilation process after preprocessing and write the preprocessed output to a file. If the input file is filename.F
, then the output file is filename.f
.
Related options:
–c,–E, –Mkeepasm, –o, –S
–fast
Enables vectorization with SSE instructions, cache alignment, and flushz for 64-bit targets.
Default:
The compiler enables vectorization with SSE instructions, cache alignment, and flushz.
Usage:
In the following example the compiler produces vector SSE code when targeting a 64-bit machine.
$ pgf95 -fast vadd.f95
Description:
When you use this option, a generally optimal set of options is chosen for targets that support
SSE capability. In addition, the appropriate
–tp
option is automatically included to enable generation of code optimized for the type of system on which compilation is performed. This option enables vectorization with SSE instructions, cache alignment, and flushz.
Note
Auto-selection of the appropriate
–tp
option means that programs built using the
–fastsse
option on a given system are not necessarily backward-compatible with older systems.
Note
C/C++ compilers enable
–Mautoinline
with
–fast
.
Related options:
–O, –Munroll, –Mnoframe, –Mscalarsse, –Mvect, –Mcache_align, –tp, -M[no]autoinline
–fastsse
Synonymous with –fast.
--flagcheck
Causes the compiler to check that flags are correct then exit without any compilation occuring.
Default:
The compiler begins a compile without the additional step to first validate that flags are correct.
Usage:
In the following example the compiler checks that flags are correct, and then exits.
$ pgf95 --flagcheck myprog.f
213
Generic PGI Compiler Options
Description:
Use this option to make the compiler check that flags are correct and then exit. If flags are all correct then the compiler returns a zero status. No compilation occurs.
Related options:
None
–flags
Displays driver options on the standard output.
Default:
The compiler does not display the driver options.
Usage:
In the following example the user requests information about the known switches.
$ pgf95 -flags
Description:
Use this option to display driver options on the standard output. When you use this option with
–v, in addition to the valid options, the compiler lists options that are recognized and ignored.
Related options:
–#, –###, –v
–fpic
(Linux only) Generates position-independent code suitable for inclusion in shared object (dynamically linked library) files.
Default:
The compiler does not generate position-independent code.
Usage:
In the following example the resulting object file, myprog.o
, can be used to generate a shared object.
$ pgf95 -fpic myprog.f
(Linux only) Use the -fpic option to generate position-independent code suitable for inclusion in shared object
(dynamically linked library) files.
Related options:
–shared, –fPIC, –G, –R
–fPIC
(Linux only) Equivalent to –fpic. Provided for compatibility with other compilers.
–G
(Linux only) Instructs the linker to produce a shared object file.
Default:
The compiler does not instruct the linker to produce a shared object file.
Usage:
In the following example the linker produces a shared object file.
$ pgf95 -G myprog.f
Description:
(Linux only) Use this option to pass information to the linker that instructs the linker to produce a shared object file.
Related options:
–fpic, –shared, –R
214
Chapter 16. Command-Line Options Reference
–g
Instructs the compiler to include symbolic debugging information in the object module.
Default:
The compiler does not put debugging information into the object module.
Usage:
In the following example, the object file myprog.o
contains symbolic debugging information.
$ pgf95 -c -g myprog.f
Description:
Use the –g option to instruct 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.
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.
Note
Including symbolic debugging information increases the size of the object module.
Related options:
–O, –gopt
–gopt
Instructs the compiler to include symbolic debugging information in the object file, and to generate optimized code identical to that generated when –g is not specified.
Default:
The compiler does not put debugging information into the object module.
Usage:
In the following example, the object file myprog.o
contains symbolic debugging information.
$ pgf95 -c -gopt myprog.f
Description:
Using
–g
alters how optimized code is generated in ways that are intended to enable or improve debugging of optimized code. The
–gopt
option instructs the compiler to include symbolic debugging information in the object file, and to generate optimized code identical to that generated when –g is not specified.
Related options:
–g, –M<pgflag>
–g77libs
(Linux only) Used on the link line, this option instructs the pgf95 driver to search the necessary g77 support libraries to resolve references specific to g77 compiled program units.
Note
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.
215
Generic PGI Compiler Options
Usage:
The following command-line requests that g77 support libraries be searched at link time:
$ pgf95 -g77libs myprog.f g77_object.o
Description:
(Linux only) Use the –g77libs option on the link line if you are linking g77-compiled program units into a pgf95-compiled main program using the pgf95 driver. When this option is present, the pgf95 driver searches the necessary g77 support libraries to resolve references specific to g77 compiled program units.
Related options:
–pgf77libs
–help
Used with no other options, –help displays options recognized by the driver on the standard output. When used in combination with one or more additional options, usage information for those options is displayed to standard output.
Default:
The compiler does not display usage information.
Usage:
In the following example, usage information for
–Minline
is printed to standard output.
$ pgcc -help -Minline
-Minline[=lib:<inlib>|<func>|except:<func>|
name:<func>|size:<n>|levels:<n>]
Enable function inlining
lib:<extlib> Use extracted functions from extlib
<func> Inline function func
except:<func> Do not inline function func
name:<func> Inline function func
size:<n> Inline only functions smaller than n
levels:<n> Inline n levels of functions
-Minline Inline all functions that were extracted
In the following example, usage information for –help shows how groups of options can be listed or examined according to function.
$ pgcc -help -help
-help[=groups|asm|debug|language|linker|opt|other|
overall|phase|prepro|suffix|switch|target|variable]
Description:
Use the –help option to obtain information about available options and their syntax. You can use
–help in one of three ways:
• Use
–help
with no parameters to obtain a list of all the available options with a brief one-line description of each.
• Add a parameter to –help to restrict the output to information about a specific option. The syntax for this usage is this:
-help <command line option>
• Add a parameter to –help to restrict the output to a specific set of options or to a building process. The syntax for this usage is this:
-help=<subgroup>
The following table lists and describes the subgroups available with –help.
216
Chapter 16. Command-Line Options Reference
Table 16.6. Subgroups for –help Option
Use this –help option To get this information...
–help=asm
–help=debug
–help=groups
–help=language
–help=linker
–help=opt
–help=other
–help=overall
–help=phase
–help=prepro
–help=suffix
–help=switch
–help=target
–help=variable
A list of options specific to the assembly phase.
A list of options related to debug information generation.
A list of available switch classifications.
A list of language-specific options.
A list of options specific to link phase.
A list of options specific to optimization phase.
A list of other options, such as ANSI conformance pointer aliasing for C.
A list of options generic to any PGI compiler.
A list of build process phases and to which compiler they apply.
A list of options specific to the preprocessing phase.
A list of known file suffixes and to which phases they apply.
A list of all known options; this is equivalent to usage of –help without any parameter.
A list of options specific to target processor.
A list of all variables and their current value. They can be redefined on the command line using syntax VAR=VALUE.
For more examples of –help, refer to “Help with Command-line Options,” on page 18
.
Related options:
–#, –###, –show, –V, –flags
–I
Adds a directory to the search path for files that are included using either the INCLUDE statement or the preprocessor directive #include.
Default:
The compiler searches only certain directories for included files.
• For gcc-lib includes:
/usr/lib64/gcc-lib
• For system includes:
/usr/linclude
Syntax:
-Idirectory
Where directory is the name of the directory added to the standard search path for include files.
Usage:
In the following example, the compiler first searches the directory mydir
and then searches the default directories for include files.
$ pgf95 -Imydir
217
Generic PGI Compiler Options
Description:
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.
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'
Related options:
–Mnostdinc
–i2, –i4 and –i8
Treat INTEGER and LOGICAL variables as either two, four, or eight bytes.
Default:
The compiler treats INTERGER and LOGICAL variables as four bytes.
Usage:
In the following example, using the –i8 switch causes the integer variables to be treated as 64 bits.
$ pgf95 -i8 int.f int.f
is a function similar to this: int.f
print *, "Integer size:", bit_size(i)
end
Description:
Use this option to treat INTEGER and LOGICAL 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.
Related options:
None
–K<flag>
Requests that the compiler provide special compilation semantics.
Default:
The compiler does not provide special compilation semantics.
218
Chapter 16. Command-Line Options Reference
Syntax:
–K<flag>
Where flag is one of the following: ieee noieee
PIC pic trap=option
[,option]...
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.
Default flag. Use the fastest available means to perform floating-point operations, link in faster non-IEEE libraries if available, and disable underflow traps.
(Linux only) Generate position-independent code. Equivalent to –fpic.
Provided for compatibility with other compilers.
(Linux only) Generate position-independent code. Equivalent to –fpic.
Provided for compatibility with other compilers.
Controls the behavior of the processor when floating-point exceptions occur.
Possible options include:
• fp
• align (ignored)
• inv
• denorm
• divz
• ovf
• unf
• inexact
Usage:
In the following example, the compiler performs floating-point operations in strict conformance with the IEEE 754 standard
$ pgf95 -Kieee myprog.f
Description:
Use
–K
to instruct the compiler to provide special compilation semantics.
The default is
–Knoieee
.
–Ktrap
is only processed by the compilers when compiling main functions or programs. The options inv, denorm, divz, ovf, unf, and inexact correspond to the processor’s exception mask bits: invalid operation, denormalized operand, divide-by-zero, overflow, underflow, and precision, respectively. Normally, the processor’s exception mask bits are
on
, meaning that floating-point exceptions are masked—the 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.
219
Generic PGI Compiler Options
Note
The PGI compilers do not support exception-free execution for
–Ktrap=inexact
. The purpose of this hardware support is for those who have specific uses for its execution, along with the appropriate signal handlers for handling exceptions it produces. It is not designed for normal floating point operation code support.
Related options:
None.
--keeplnk
(Windows only.) Preserves the temporary file when the compiler generates a temporary indirect file for a long linker command.
Usage:
In the following example the compiler preserves each temporary file rather than deleting it.
$ pgf95 --keeplnk myprog.f
Description:
If the compiler generates a temporary indirect file for a long linker command, use this option to instruct the compiler to preserve the temporary file instead of deleting it.
Related options:
None.
–L
Specifies a directory to search for libraries.
Note
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:
The compiler searches the standard library directory.
Usage:
In the following example, the library directory is
/lib
and the linker links in the standard libraries required by PGF95 from this directory.
$ pgf95 -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
.
$ pgf95 -L/lib -lx -L/libz -ly myprog.f
Use the –L option to specify a directory to search for libraries. Using –L allows you to add directories to the search path for library files.
Related options:
-l
220
Chapter 16. Command-Line Options Reference
–l<library>
Instructs the linker to load the specified library. The linker searches <library> in addition to the standard libraries.
Note
The linker searches the libraries specified with –l in order of appearance
before
searching the standard libraries.
Syntax:
-llibrary
Where library is the name of the library to search.
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.
$ pgf95 myprog.f -lmylib
Description:
Use this option to instruct the linker to load the specified library. The compiler prepends the characters lib to the library name and adds the .a extension following the library name. The linker searches each library specifies before searching the standard libraries.
Related options:
–L
–m
Displays a link map on the standard output.
Default:
The compiler does display the link map and does not use the –m option.
Usage:
When the following example is executed on Windows, pgf95 creates a link map in the file myprog.map
.
$ pgf95 -m myprog.f
Description:
Use this option to display a link map.
• On Linux, the map is written to stdout
.
• On Windows, the map is written to a
.map
file whose name depends on the executable. If the executable is myprog.f
, the map file is in myprog.map
.
Related options:
–c, –o, -s, –u
–M<pgflag>
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
221
Generic PGI Compiler Options
222
The following table lists and briefly describes the options alphabetically and includes a field showing the category. For more details about the options as they relate to these categories, refer to
.
pgflag
allocatable=95|03 anno
[no]autoinline
[no]
[no]
[no] asmkeyword backslash bounds
byteswapio cache_align chkfpstk chkptr chkstk concur cpp cray
Table 16.7. –M Options Summary
Description Category
Controls whether to use Fortran 95 or Fortran 2003 semantics in allocatable array assignments.
Annotate the assembly code with source code.
C/C++ when a function is declared with the inline keyword, inline it at –O2 and .
Specifies whether the compiler allows the asm keyword in C/C++ source files (pgcc and pgcpp only).
Determines how the backslash character is treated in quoted strings (pgf77, pgf95, and pghpf only).
Specifies whether array bounds checking is enabled or disabled.
Fortran Language
Miscellaneous
Inlining
C/C++ Language
Fortran Language
Miscellaneous
Do/don’t compile with math subroutine builtin support, which causes selected math library routines to be inlined (pgcc and pgcpp only).
Optimization
Swap byte-order (big-endian to little-endian or vice versa) during I/O of Fortran unformatted data.
Where possible, align data objects of size greater than or equal to 16 bytes on cache-line boundaries.
Miscellaneous
Optimization
Check for internal consistency of the x87 FP stack in the prologue of a function and after returning from a function or subroutine call (–tp px/p5/p6/ piii targets only).
Miscellaneous
Check for NULL pointers (pgf95 and pghpf only).
Miscellaneous
Check the stack for available space upon entry to and before the start of a parallel region. Useful when many private variables are declared.
Enable auto-concurrentization of loops. Multiple processors or cores will be used to execute parallelizable loops.
Miscellaneous
Optimization
Run the PGI cpp-like preprocessor without performing subsequent compilation steps.
Force Cray Fortran (CF77) compatibility (pgf77, pgf95, and pghpf only).
Miscellaneous
Optimization
pgflag
[no] daz
[no] dclchk
[no]
[no]
[no]
[no] defaultunit depchk dse dlines dll dollar,char
[no]dwarf dwarf1 dwarf2 dwarf3 extend extract
[no]m128 fixed
[no] flushz
[no]fpapprox
[no] f[=option]
Chapter 16. Command-Line Options Reference
Description
Do/don’t treat denormalized numbers as zero.
Determines whether all program variables must be declared (pgf77, pgf95, and pghpf only).
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, pgf95, and pghpf only).
Checks for potential data dependencies.
Enables [disables] dead store elimination phase for programs making extensive use of function inlining.
Determines whether the compiler treats lines containing the letter "D" in column one as executable statements (pgf77, pgf95, and pghpf only).
Link with the DLL version of the runtime libraries
(Windows only).
Specifies the character to which the compiler maps the dollar sign code (pgf77, pgf95, and pghpf only).
Specifies not to add DWARF debug information.
When used with –g, generate DWARF1 format debug information.
When used with –g, generate DWARF2 format debug information.
When used with –g, generate DWARF3 format debug information.
Instructs the compiler to accept 132-column source code; otherwise it accepts 72-column code (pgf77, pgf95, and pghpf only).
invokes the function extractor.
Instructs the compiler to treat floating-point constants as float data types (pgcc and pgcpp only).
Instructs the compiler to assume F77-style fixed format source code (pgf95 and pghpf only).
Do/don’t set SSE flush-to-zero mode
Specifies not to use low-precision fp approximation operations.
Perform certain floating point intrinsic functions using relaxed precision.
Category
Code Generation
Fortran Language
Fortran Language
Optimization
Optimization
Fortran Language
Miscellaneous
Fortran Language
Code Generation
Code Generation
Code Generation
Code Generation
Fortran Language
Inlining
C/C++ Language
Fortran Language
Code Generation
Optimization
Optimization
223
Generic PGI Compiler Options
[no]loop32
[no] lre list
[no]m128 makedll makeimplib mpi=option
pgflag
free func32 gccbug[s] info inform inline instrumentation
[no]
[no] ipa iomutex keepasm largeaddressaware
[no] large_arrays lfs
Description
Instructs the compiler to assume F90-style free format source code (pgf95 and pghpf only).
Category
Fortran Language
The compiler aligns all functions to 32-byte boundaries.
Matches behavior of certain gcc bugs
Prints informational messages regarding optimization and code generation to standard output as compilation proceeds.
Code Generation
Miscellaneous
Miscellaneous
Specifies the minimum level of error severity that the compiler displays.
Miscellaneous
Invokes the function inliner.
Generates code to enable instrumentation of functions.
Inlining
Miscellaneous
Invokes interprocedural analysis and optimization.
Optimization
Determines whether critical sections are generated around Fortran I/O calls (pgf77, pgf95, and pghpf only).
Fortran Language
Miscellaneous
Code Generation
Instructs the compiler to keep the assembly file.
Enables support for 64-bit indexing and single static data objects of size larger than 2GB.
Enables support for 64-bit indexing and single static data objects of size larger than 2GB.
Links in libraries that allow file I/O to files of size larger than 2GB on 32-bit systems (32-bit Linux only).
Code Generation
Environment
Aligns/does not align innermost loops on 32 byte boundaries with –tp barcelona
Disable/enable loop-carried redundancy elimination.
Code Generation
Optimization
Specifies whether the compiler creates a listing file. Miscellaneous
Recognizes [ignores] __m128, __m128d, and
__m128i datatypes. (C only)
Code Generation
Miscellaneous Generate a dynamic link library (DLL) (Windows only).
Passes the -def switch to the librarian without a deffile, when used without
–def:deffile
.
Miscellaneous
Link to MPI libraries: MPICH1, MPICH2, or
Microsoft MPI libraries
Code Generation
224
pgflag
neginfo noframe noi4 nomain noopenmp nopgdllmain norpath nosgimp
[no]stddef nostdinc nostdlib
[no] onetrip novintr pfi pre
[no]pre
[no] prefetch
Chapter 16. Command-Line Options Reference
Description
Instructs the compiler to produce information on why certain optimizations are not performed.
Eliminates operations that set up a true stack frame pointer for functions.
Determines how the compiler treats INTEGER variables (pgf77, pgf95, and pghpf only).
Category
Miscellaneous
Optimization
Optimization
When the link step is called, don’t include the object file that calls the Fortran main program. (pgf77, pgf95, and pghpf only).
When used in combination with the –mp option, the compiler ignores OpenMP parallelization directives or pragmas, but still processes SGI-style parallelization directives or pragmas.
Code Generation
Miscellaneous
Do not link the module containing the default
DllMain() into the DLL (Windows only).
Miscellaneous
On Linux, do not add –rpath paths to the link line.
Miscellaneous
When used in combination with the –mp option, the compiler ignores SGI-style parallelization directives or pragmas, but still processes OpenMP directives or pragmas.
Miscellaneous
Instructs the compiler to not recognize the standard preprocessor macros.
Environment
Environment Instructs the compiler to not search the standard location for include files.
Instructs the linker to not link in the standard libraries.
Environment
Determines whether each DO loop executes at least once (pgf77, pgf95, and pghpf only).
Disable idiom recognition and generation of calls to optimized vector functions.
Language
Optimization
Instrument the generated code and link in libraries for dynamic collection of profile and data information at runtime.
Optimization
Read a pgfi.out trace file and use the information to enable or guide optimizations.
Force/disable generation of non-temporal moves and prefetching.
Optimization
Code Generation
Enable/disable generation of prefetch instructions.
Optimization
225
Generic PGI Compiler Options
pgflag
preprocess
Description
Perform cpp-like preprocessing on assembly language and Fortran input source files.
Category
Miscellaneous prof
[no]
[no]
[no]
[no]
[no] r8 r8intrinsics recursive reentrant ref_externals
Set profile options; function-level and line-level profiling are supported.
Determines whether the compiler promotes REAL variables and constants to DOUBLE PRECISION
(pgf77, pgf95, and pghpf only).
Determines how the compiler treats the intrinsics
CMPLX and REAL (pgf77, pgf95, and pghpf only).
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, pgf95, and pghpf only).
Specifies whether the compiler avoids optimizations that can prevent code from being reentrant.
Do/don’t force references to names appearing in
EXTERNAL statements (pgf77, pgf95, and pghpf only).
Code Generation
Optimization
Optimization
Code Generation
Code Generation
Code Generation safeptr safe_lastval
[no] save
Instructs the compiler to override data dependencies between pointers and arrays (pgcc and pgcpp only).
Optimization
Code Generation 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 is safe to parallelize the loop. For a given loop, the last value computed for all scalars make it safe to parallelize the loop.
Determines whether the compiler assumes that all local variables are subject to the SAVE statement
(pgf77, pgf95, and pghpf only).
Fortran Language
Optimization [no] schar scalarsse Do/don’t use SSE/SSE2 instructions to perform scalar floating-point arithmetic.
Specifies signed char for characters (pgcc and pgcpp only - also see uchar).
[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, pgf95, and pghpf only).
[no] signextend Do/don’t extend the sign bit, if it is set.
C/C++ Language
Code Generation
Code Generation
226
Chapter 16. Command-Line Options Reference
pgflag
[no]
[no] smart
[no]smartalloc [=huge| huge:<n>|hugebss] standard
[no] uchar unix
[no]
[no]
[no] single stride0 unixlogical unroll upcase varargs
[no]vect
Description
Do/don’t convert float parameters to double parameter characters (pgcc and pgcpp only).
Category
C/C++ Language
Do/don’t enable optional post-pass assembly optimizer.
Optimization
Add a call to the routine mallopt in the main routine.
Supports large TLBs on Linux and Windows.
Tip.
To be effective, this switch must be specified when compiling the file containing the Fortran, C, or C++ main program.
Environment
Causes the compiler to flag source code that does not conform to the ANSI standard(pgf77, pgf95, and pghpf only).
Do/do not generate alternate code for a loop that contains an induction variable whose increment may be zero (pgf77, pgf95, and pghpf only).
Specifies unsigned char for characters (pgcc and pgcpp only - also see schar).
Fortran Language
Code Generation
C/C++ Language
Uses UNIX calling and naming conventions for
Fortran subprograms (pgf77, pgf95, and pghpf for
Win32 only).
Determines how the compiler treats logical values.
(pgf77, pgf95, and pghpf only).
Controls loop unrolling.
Code Generation
Fortran Language
Optimization
Fortran Language Determines whether the compiler preserves uppercase letters in identifiers. (pgf77, pgf95, and pghpf only).
Forces Fortran program units to assume calls are to
C functions with a varargs type interface (pgf77 and pgf95 only).
Do/don’t invoke the code vectorizer.
Code Generation
Optimization
–mcmodel=medium
(For use only on 64-bit Linux targets) Generates code for the medium memory model in the linux86-64 execution environment. Implies –Mlarge_arrays.
Default: The compiler generates code for the small memory model.
Usage:
The following command line requests position independent code be generated, and the option
– mcmodel=medium
be passed to the assembler and linker:
$ pgf95 -mcmodel=medium myprog.f
227
Generic PGI Compiler Options
Description:
The default small memory model of the linux86-64 environment limits the combined area for a user’s object or executable to 1GB, with the Linux kernel managing usage of the second 1GB of address for system routines, shared libraries, stacks, and so on. Programs are started at a fixed address, and the program can use a single instruction to make most memory references.
The medium memory model allows for larger than 2GB data areas, or .bss sections. Program units compiled using either
–mcmodel=medium
or
–fpic
require additional instructions to reference memory. The effect on performance is a function of the data-use of the application. The
–mcmodel=medium
switch must be used at both compile time and link time to create 64-bit executables. Program units compiled for the default small memory model can be linked into medium memory model executables as long as they are compiled with the option
–fpic
, or position-independent.
The linux86-64 environment provides static libxxx.a
archive libraries, that are built both with and without
–fpic
, and dynamic libxxx.so
shared object libraries that are compiled
–fpic
. Using the link switch
–mcmodel=medium
implies the
–fpic
switch and utilizes the shared libraries by default. The
$PGI/ linux86-64/<rel>/lib
directory contains the libraries for building small memory model codes; and the
$PGI/linux86-64/<rel>/libso
directory contains shared libraries for building both
–fpic
and
– mcmodel=medium
executables.
Note
–mcmodel=medium -fpic
is not allowed to create shared libraries. However, you can create static archive libraries (.a) that are
–fpic
.
Related options:
–Mlarge_arrays
–module <moduledir>
Allows you to specify a particular directory in which generated intermediate
.mod
files should be placed.
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
; specifically, the file
./mymods/myprog.mod
is used.
$ pgf95 -module mymods myprog.f
Description:
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, then <moduledir> is searched for
.mod
intermediate files
prior
to a search in the default local directory.
Related options:
None.
–mp[=all, align,bind,[no]numa]
Instructs the compiler to interpret user-inserted OpenMP shared-memory parallel programming directives and pragmas, and to generate an executable file which will utilize multiple processors in a shared-memory parallel system.
228
Chapter 16. Command-Line Options Reference
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
:
$ pgf95 -mp myprog.f
Description:
Use the
–mp option to instruct the compiler to interpret user-inserted OpenMP shared-memory parallel programming directives and to generate an executable file which utilizes multiple processors in a shared-memory parallel system.
The sub-options are one or more of the following: align
Forces loop iterations to be allocated to OpenMP processes using an algorithm that maximizes alignment of vector sub-sections in loops that are both parallelized and vectorized for SSE. This allocation can improve performance in program units that include many such loops. It can also result in load-balancing problems that significantly decrease performance in program units with relatively short loops that contain a large amount of work in each iteration. The numa suboption uses libnuma on systems where it is available.
allcores
Instructs the compiler to all available cores. You specify this sub-option at link time.
bind
Instructs the compiler to bind threads to cores. You specify this sub-option at link time.
[no]numa
Uses [does not use] libnuma on systems where it is available.
For a detailed description of this programming model and the associated directives and pragmas, refer to
.
Related options:
–Mconcur, –Mvect
–noswitcherror
Issues warnings instead of errors for unknown switches. Ignores unknown command line switches after printing a warning message.
Default:
The compiler prints an error message and then halts.
Usage:
In the following example, the compiler ignores unknown command line switches after printing a warning message.
$ pgf95 -noswitcherror myprog.f
Description:
Use this option to instruct the compiler to ignore unknown command line switches after printing an warning message.
Tip
You can configure this behavior in the siterc
file by adding: set NOSWITCHERROR=1.
229
Generic PGI Compiler Options
Related options:
None.
–O<level>
Invokes code optimization at the specified level.
Default:
The compiler optimizes at level 2.
Syntax:
–O [level]
Where level is an integer from 0 to 4.
Usage:
In the following example, since no –O option is specified, the compiler sets the optimization to level 1.
$ pgf95 myprog.f
In the following example, since no optimization level is specified and a –O option is specified, the compiler sets the optimization to level 2.
$ pgf95 -O myprog.f
Description:
Use this option to invoke code optimization at the specified level - 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.
3 level-three specifies aggressive global optimization. This level performs all level-one and level-two optimizations and enables more aggressive hoisting and scalar replacement optimizations that may or may not be profitable.
4 level-four performs all level-one, level-two, and level-three optimizations and enables hoisting of guarded invariant floating point expressions.
shows the interaction between the
–O
option,
–g
option,
–Mvect
, and
–Mconcur
options.
Table 16.8. Optimization and –O, –g, –Mvect, and –Mconcur Options
Optimize Option Debug Option –M Option Optimization Level
none none none none none
–Mvect
1
2
230
Chapter 16. Command-Line Options Reference
Optimize Option Debug Option –M Option Optimization Level
none none none
–g
–Mconcur none
2
0
–O
–Olevel
–Olevel < 2
–Olevel < 2 none or –g none or –g none or –g none or –g none none
–Mvect
–Mconcur
2 level
2
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. The
–gopt
option is recommended for generation of debug information with optimized code. For more information on optimization, see Chapter 3, “
Optimizing & Parallelizing
” .
Related options:
–g, –M<pgflag>, –gopt
–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.outmyprog.exe
.
$ pgf95 myprog.f -o myprog
Related options:
–c, –E, –F, –S
–pc
Note
This option is available only for –tp px/p5/p6/piii targets.
Allows you to control the precision of operations performed using the x87 floating point unit, and their representation on the x87 floating point stack.
Syntax:
–pc { 32 | 64 | 80 }
Usage:
$ pgf95 -pc 64 myprog.f
231
Generic PGI Compiler Options
Description:
The x87 architecture implements a floating-point stack using 8 80-bit registers. Each register uses bits 0-63 as the significant, 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, you can explicitly set the precision to standard IEEE double-precision using 64 bits, or to single precision using 32 bits.
1
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
Extended Precision Option – 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, you can assure that the compiler generates code that calls a function. According to the x86 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 that 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 removes unnecessary loads and stores from memory. The general case of copy propagation being performed follows this pattern:
1
According to Intel documentation, this only affects the x87 operations of add, subtract, multiply, divide, and square root. In particular, it does not appear to affect the x87 transcendental instructions.
232
Chapter 16. Command-Line Options Reference
- -pedantic
Prints warnings from included <system header files> .
Syntax:
-- pedantic
Default:
The compiler prints the warnings from the included system header files.
Usage:
In the following example, the compiler prints the warnings from the included system header files.
$ pgf95 --pedantic myprog.f
Related options:
–pg
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 floatingpoint 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.
When executed using default (extended) precision, the find_precision program has a value of 1.8446744E
+19. 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
–Kieee
switch also has the effect of making function calls to perform all transcendental operations.
Except when the
–Mnobuiltin
switch is set in C, the function still produces the x86 machine instruction for computation, and 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.
Related options:
–Kieee, –Mnobuiltin
(Linux only) Instructs the compiler to instrument the generated executable for gprof-style sample-based profiling.
Usage:
In the following example the program is compiled for profiling using pgdbg or gprof.
$ pgf95 -pg myprog.c
Default:
The compiler does not instrument the generated executable for gprof-style profiling.
233
Generic PGI Compiler Options
Description:
Use this option to instruct the compiler to instrument the generated executable for gprof-style sample-based profiling. You must use this option at both the compile and link steps. A gmon.out
style trace is generated when the resulting program is executed, and can be analyzed using gprof or pgprof.
–pgcpplibs
Instructs the compiler to append C++ runtime libraries to the link line for programs built using either PGF90 or PGF77.
Default:
The C/C++ compilers do not append the C++ runtime libraries to the link line.
Usage:
In the following example the C++ runtime libraries are linked with an object file compiled with pgf77.
$ pgf90 main.f90 mycpp.o -pgcpplibs
Description:
Use this option to instruct the compiler to append C++ runtime libraries to the link line for programs built using either PGF90 or PGF77.
Related options:
–pgf90libs, –pgf77libs
–pgf77libs
Instructs the compiler to append PGF77 runtime libraries to the link line.
Default:
The C/C++ compilers do not append the PGF77 runtime libraries to the link line.
Usage:
In the following example a .c main program is linked with an object file compiled with pgf77.
$ pgcc main.c myf77.o -pgf77libs
Description:
Use this option to instruct the compiler to append PGF77 runtime libraries to the link line.
Related options:
–pgcpplibs, –pgf90libs
–pgf90libs
Instructs the compiler to append PGF90/PGF95 runtime libraries to the link line.
Default:
The C/C++ compilers do not append the PGF90/PGF95 runtime libraries to the link line.
Usage:
In the following example a .c main program is linked with an object file compiled with pgf95.
$ pgcc main.c myf95.o -pgf90libs
Description:
Use this option to instruct the compiler to append PGF90/PGF95 runtime libraries to the link line.
Related options:
–pgcpplibs, –pgf77libs
–R<directory>
(Linux only) Instructs the linker to hard-code the pathname <directory> into the search path for generated shared object (dynamically linked library) files.
Note
There cannot be a space between R and <directory>.
234
Chapter 16. Command-Line Options Reference
Usage:
In the following example, at runtime the a.out executable searches the specified directory, in this case
/home./Joe/myso
, for shared objects.
$ pgf95 -Rm/home/Joe/myso myprog.f
Description:
Use this option to instruct the compiler to pass information to the linker to hard-code the pathname <directory> into the search path for shared object (dynamically linked library) files.
Related options:
–fpic, –shared, –G
–r
–r4 and –r8
Interprets DOUBLE PRECISION variables as REAL (–r4), or interprets REAL variables as DOUBLE PRECISION
(–r8).
Usage:
In this example, the double precision variables are interpreted as REAL.
$ pgf95 -r4 myprog.f
Description:
Interpret DOUBLE PRECISION variables as REAL (–r4) or REAL variables as DOUBLE
PRECISION (–r8).
Related options:
–i2, –i4, –i8, –nor8
–rc
Linux only. Creates a relocatable object file.
Default:
The compiler does not create a relocatable object file and does not use the –r option.
Usage:
In this example, pgf95 creates a relocatable object file.
$ pgf95 -r myprog.f
Description:
Use this option to create a relocatable object file.
Related options:
–c, –o, –s, –u
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
.pgf95rctest
, relative to
/usr/pgi/linux86/bin
, the value of $DRIVER, is the driver configuration file.
$ pgf95 -rc .pgf95rctest myprog.f
235
Generic PGI Compiler Options
–rpath
(Linux only) Specifies the name of the driver startup configuration file.
Syntax:
-rpath path <ldarg> where path is either a relative pathname, or a full pathname beginning with "/".
Default:
The driver uses the configuration file
.pgirc
.
Usage:
In the following example, the file
.pgf95rctest
, relative to
/usr/pgi/linux86/bin
, the value of $DRIVER, is the driver configuration file.
$ pgf95 -rc .pgf95rctest myprog.f
Description:
Use this option to specify 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.
With the ldarg option (Linux only), the ldarg information is passed to the linker and the directory is added to the runtime shared library search path.
Related options:
–show
–s
Description:
Use this option to specify 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.
Related options:
–show
(Linux only) Strips the symbol-table information from the executable file.
Default:
The compiler includes all symbol-table information and does not use the –s option.
Usage:
In this example, pgf95 strips symbol-table information from the a.out
. executable file.
$ pgf95 -s myprog.f
Description:
Use this option to strip the symbol-table information from the executable.
Related options:
–c, –o, –u
–S
Stops compilation after the compiling phase and writes the assembly-language output to a file.
Default:
The compiler does not produce a
.s
file.
Usage:
In this example, pgf95 produces the file myprog.s
in the current directory.
$ pgf95 -S myprog.f
236
Chapter 16. Command-Line Options Reference
Description:
Use this option to stop compilation after the compiling phase and then write the assemblylanguage output to a file. If the input file is filename.f
, then the output file is filename.s
.
Related options:
–c, –E, –F, –Mkeepasm, –o
–shared
(Linux only) Instructs the compiler to pass information to the linker to produce a shared object (dynamically linked library) file.
Default:
The compiler does not pass information to the linker to produce a shared object file.
Usage:
In the following example the compiler passes information to the linker to produce the shared object file: myso.so
.
$ pgf95 -shared myprog.f -o myso.so
Description:
Use this option to instruct the compiler to pass information to the linker to produce a shared object (dynamically linked library) file.
Related options:
–fpic, –G, –R
–show
Produces driver help information describing the current driver configuration.
Default:
The compiler does not show driver help information.
Usage:
In the following example, the driver displays configuration information to the standard output after processing the driver configuration file.
$ pgf95 -show myprog.f
Description:
Use this option to produce driver help information describing the current driver configuration.
Related options:
–V, –v, –###, –help, –rc
–silent
Do not print warning messages.
Default:
The compiler prints warning messages.
Usage:
In the following example, the driver does not display warning messages.
$ pgf95 -silent myprog.f
Description:
Use this option to suppress warning messages.
Related options:
–v, –V, –w
–soname
(Linux only.) The compiler recognizes the –soname option and passes it through to the linker.
Default:
The compiler does not recognize the –soname option.
237
Generic PGI Compiler Options
Usage:
In the following example, the driver passes the soname option and its argument through to the linker.
$ pgf95 -soname library.so myprog.f
Description:
Use this option to instruct the compiler to recognize the –soname option and pass it through to the linker.
Related options:
–stack
(Windows only.) Allows you to explicitly set stack properties for your program.
Default:
If
–stack
is not specified, then the defaults are as followed:
Win32
Setting is
-stack:2097152,2097152
, which is approximately 2MB for reserved and committed bytes.
Win64
No default setting
Syntax:
-stack={ (reserved bytes)[,(committed bytes)] }{, [no]check }
Usage:
The following example demonstrates how to reserve 524,288 stack bytes (512KB), commit 262,144 stack bytes for each routine (256KB), and disable the stack initialization code with the nocheck argument.
$ pgf95 -stack=524288,262144,nocheck myprog.f
Description:
Use this option to explicitly set stack properties for your program. The
–stack
option takes one or more arguments: (reserved bytes), (committed bytes), [no]check.
reserved bytes
Specifies the total stack bytes required in your program.
committed bytes
Specifies the number of stack bytes that the Operating System will allocate for each routine in your program. This value must be less than or equal to the stack
reserved bytes
value.
Default for this argument is 4096 bytes
[no]check
Instructs the compiler to generate or not to generate stack initialization code upon entry of each routine.
Check is the default, so stack initialization code is generated.
Stack initialization code is required when a routine's stack exceeds the
committed bytes
size. When your
committed bytes
is equal to the
reserved bytes
or equal to the stack bytes required for each routine, then you can turn off the stack initialization code using the
-stack=nocheck
compiler option. If you do this, the compiler assumes that you are specifying enough committed stack space; and therefore, your program does not have to manage its own stack size.
For more information on determining the amount of stack required by your program, refer to
–Mchkstk
compiler option, described in “Miscellaneous Controls”
.
238
Chapter 16. Command-Line Options Reference
Note
-stack=(reserved bytes),(committed bytes)
are linker options.
-stack=[no]check
is a compiler option.
If you specify
-stack=(reserved bytes),(committed bytes)
on your compile line, it is only used during the link step of your build. Similarly,
-stack=[no]check
can be specified on your link line, but its only used during the compile step of your build.
Related options:
–Mchkstk
–ta=nvidia(,nvidia_suboptions),host
Defines the target accelertator.
Note this flag is valid only for Fortran and C.
Default:
The compiler uses NVIDIA .
Usage:
In the following example, NVIDEA is the accelerator target architecture and the accelerator generates code for compute capability 1.3.
$ pgf95 -ta=nvidia(cc13)
Description:
Use this option to select the accelerator target and, optionally, to define the type of code to genertate.
The
–ta
flag has the following options: nvidia
Select NVIDIA accelerator target. This option has the following nvidia-suboptions: nvidia
Select NVIDIA accelerator target.
analysis
Perform loop analysis only; do not generate GPU code.
cc10
Generate code for compute capability 1.0.
cc11
Generate code for compute capability 1.1.
cc13
Generate code for compute capability 1.3.
fastmath
Use routines from the fast math library.
keepgpu
Keep the kernel source files.
239
Generic PGI Compiler Options keepptx
Keep the portable assembly (.ptx) file for the GPU code.
maxregcount:n
Specify the maximum number of registers to use on the GPU. Leaving this blank indicates no limit.
mul24
Use 24-bit multiplication for subscripting.
nofma
Do not generate fused multiply-add instructions.
time
Link in a limited-profiling library, as described in
“Profiling Accelerator Kernels,” on page 100 .
host
.
Related options:
–#
–time
Print execution times for various compilation steps.
Default:
The compiler does not print execution times for compilation steps.
Usage:
In the following example, pgf95 prints the execution times for the various compilation steps.
$ pgf95 -time myprog.f
Description:
Use this option to print execution times for various compilation steps.
Related options:
–#
–tp <target> [,target...]
Sets the target architecture.
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 all supported instructions wherever possible when compiling on a given system.
The default style of code generation is auto-selected depending on the type of processor on which compilation is performed. Further, the –tp x64 style of unified binary code generation is only enabled by an explicit –tp x64 option.
Note
Executables created on a given system may not be usable on previous generation systems. (For example, executables created on a Pentium 4 may fail to execute on a Pentium III or Pentium II.)
Usage:
In the following example, pgf95 sets the target architecture to EM64T:
240
Chapter 16. Command-Line Options Reference
$ pgf95 -tp p7-64 myprog.f
Description:
Use this option to set the target architecture. By default, the PGI compiler uses all supported instructions wherever possible when compiling on a given system. As a result, executables created on a given system may not be usable on previous generation systems. For example, executables created on a Pentium 4 may fail to execute on a Pentium III or Pentium II.
Processor-specific optimizations can be specified or limited explicitly by using the
–tp
option. Thus, it is possible to create executables that are usable on previous generation systems. With the exception of k8-64, k8-64e, p7-64, and x64, any of these sub-options are valid on any x86 or x64 processor-based system. The k8-64, k8-64e, p7-64 and x64 options are valid only on x64 processor-based systems.
The
–tp x64
option generates unified binary object and executable files, as described in the section called
“Using –tp to Generate a Unified Binary”
.
The following list contains the possible sub-options for
–tp
and the processors that each sub-option is intended to target: athlon generate 32-bit code for AMD Athlon XP/MP and compatible processors.
barcelona generate 32-bit code for AMD Opteron/Quadcore and compatible processors.
barcelona-32 generate 32-bit code for AMD Opteron/Quadcore and compatible processors. Same as bareclona suboption.
barcelona-64 generate 64-bit code for AMD Opteron/Quadcore and compatible processors.
core2 generate 32-bit code for Intel Core 2 Duo and compatible processors.
core2-32 generate 32-bit code for Intel Core 2 Duo and compatible processors. Same as core2 option.
core2-64 generate 64-bit code for Intel Core 2 Duo EM64T and compatible processors.
istanbul generate 32-bit code that is usable on any Istanbul processor-based system.
istanbul-32 generate 32-bit code that is usable on any Istanbul processor-based system.
istanbul-64 generate 64-bit code that is usable on any Istanbul processor-based system.
k8-32 generate 32-bit code for AMD Athlon64, AMD Opteron and compatible processors.
k8-64 generate 64-bit code for AMD Athlon64, AMD Opteron and compatible processors.
241
Generic PGI Compiler Options
242 k8-64e generate 64-bit code for AMD Opteron Revision E, AMD Turion, and compatible processors.
nehalem generate 32-bit code that is usable on any Nehalem processor-based system.
nehalem-32 generate 32-bit code that is usable on any Nehalem processor-based system.
nehalem-64 generate 64-bit code that is usable on any Nehalem processor-based system.
p6 generate 32-bit code for Pentium Pro/II/III and AthlonXP compatible processors.
p7 generate 32-bit code for Pentium 4 and compatible processors.
p7-32 generate 32-bit code for Pentium 4 and compatible processors. Same as p7 option.
p7-64 generate 64-bit code for Intel P4/Xeon EM64T and compatible processors.
penryn generate 32-bit code for Intel Penryn Architecture and compatible processors.
penryn-32 generate 32-bit code for Intel Penryn Architecture and compatible processors. Same as penryn suboption.
penryn-64 generate 64-bit code for Intel Penryn Architecture and compatible processors.
piii generate 32-bit code for Pentium III and compatible processors, including support for single-precision vector code using SSE instructions.
px generate 32-bit code that is usable on any x86 processor-based system.
px-32 generate 32-bit code that is usable on any x86 processor-based system. Same as px suboption.
shanghai generate 32-bit code that is usable on any AMD Shanghai processor-based system.
shanghai-32 generate 32-bit code that is usable on any AMD Shanghai processor-based system.
shanghai-64 generate 64-bit code that is usable on any AMD Shanghai processor-based system.
x64 generate 64-bit unified binary code including full optimizations and support for both AMD and Intel x64 processors.
Chapter 16. Command-Line Options Reference
Refer to the PGI Release Notes for a concise list of the features of these processors that distinguish them as separate targets when using the PGI compilers and tools.
The syntax for 64-bit and 32-bit targets is similar, even though the target information varies.
Syntax for 64-bit targets:
-tp {k8-64 | k8-64e | p7-64 | core2-64 | x64}
Syntax for 32-bit targets:
-tp {k8-32 | p6 | p7 | core2 | piii | px}
Using –tp to Generate a Unified Binary
Different processors have differences, some subtle, in hardware features such as instruction sets and cache size. The compilers make architecture-specific decisions about such things as instruction selection, instruction scheduling, and vectorization. Any of these decisions can have significant effects on performance and compatibility. PGI unified binaries provide a low-overhead means for a single program to run well on a number of hardware platforms.
You can use the –tp option to produce PGI Unified Binary programs. The compilers generate, and combine into one executable, multiple binary code streams, each optimized for a specific platform. At runtime, this one executable senses the environment and dynamically selects the appropriate code stream.
The target processor switch, –tp, accepts a comma-separated list of 64-bit targets and will generate code optimized for each listed target. For example, the following switch generates optimized code for three targets: k8-64, p7-64, and core2-64.
Syntax for optimizing for multiple targets:
-tp k8-64,p7-64,core2-64
The –tp k8-64 and –tp k8-64e options result in generation of code supported on and optimized for AMD x64 processors, while the –tp p7-64 option results in generation of code that is supported on and optimized for
Intel x64 processors. Performance of k8-64 or k8-64e code executed on Intel x64 processors, or of p7-64 code executed on AMD x64 processors, can often be significantly less than that obtained with a native binary.
The special –tp x64 option is equivalent to –tp k8-64,p7-64. This switch produces PGI Unified Binary programs containing code streams fully optimized and supported for
both
AMD64 and Intel EM64T processors.
For more information on unified binaries, refer to “Processor-Specific Optimization & the Unified Binary,” on page 38 .
Related options:
–M<pgflag> options that control environments
–u
Initializes the symbol-table with <symbol>, which is undefined for the linker.
Default:
The compiler does not use the –u option.
Syntax:
243
Generic PGI Compiler Options
-usymbol
Where
symbol
is a symbolic name.
Usage:
In this example, pgf95 initializes symbol-table with test
.
$ pgf95 -utest myprog.f
Description:
Use this option to initialize the symbol-table with <symbol>, which is undefined for the linker.
An undefined symbol triggers loading of the first member of an archive library.
Related options:
–c, –o, –s
–U
–V[release_number]
Displays additional information, including version messages. Further, if a release_number
is appended, the compiler driver attempts to compile using the specified release instead of the default release.
Note
There can be no space between
-V
and release_number
.
Default:
The compiler does not display version information and uses the release specified by your path to compile.
Usage:
The following command-line shows the output using the
-V
option.
% pgf95 -V myprog.f
The following command-line causes PGF95 to compile using the 5.2 release instead of the default release.
% pgcc -V5.2 myprog.c
Description:
Use this option to display additional information, including version messages or, if a release_number is appended, to instruct the compiler driver to attempt to compile using the specified release instead of the default release.
244
Undefines a preprocessor macro.
Syntax:
-Usymbol
Where
symbol
is a symbolic name.
Usage:
The following examples undefine the macro test.
$ pgf95 -Utest myprog.F
$ pgf95 -Dtest -Utest myprog.F
Description:
Use this option to undefine a preprocessor macro. You can also use the #undef preprocessor directive to undefine macros.
Related options:
–D, –Mnostddef.
Chapter 16. Command-Line Options Reference
The specified release must be co-installed with the default release, and must have a release number greater than or equal to 4.1, which was the first release that supported this functionality.
Related options:
–Minfo, –v
–v
Displays the invocations of the compiler, assembler, and linker.
Default:
The compiler does not display individual phase invocations.
Usage:
In the following example you use –v to see the commands sent to compiler tools, assembler, and linker.
$ pgf95 -v myprog.f90
Description:
Use the –v option to display the invocations of the compiler, assembler, and linker. These invocations are command lines created by the compiler driver from the files and the –W options you specify on the compiler command-line.
Related options:
–dryrun, –Minfo, –V, –W
–W
Passes arguments to a specific phase.
Syntax:
-W{0 | a | l },option[,option...]
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.
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.
Usage:
In the following example the linker loads the text segment at address
0xffc00000
and the data segment at address
0xffe00000
.
$ pgf95 -Wl,-k,-t,0xffc00000,-d,0xffe00000 myprog.f
245
Generic PGI Compiler Options
–w
–Xs
Use legacy standard mode for C and C++.
Default:
None.
Usage:
In the following example the compiler uses legacy standard mode.
$ pgcc -Xs myprog.c
Description:
Use this option to use legacy standard mode for C and C++. Further, this option implies alias=traditional.
Related options:
–alias, –Xt
–Xt
Do not print warning messages.
Default:
The compiler prints warning messages.
Usage:
In the following example no warning messages are printed.
$ pgf95 -w myprog.f
Description:
Use the –w option to not print warning messages. Sometimes the compiler issues many warning in which you may have no interest. You can use this option to not issue those warnings.
Related options:
–silent
Use legacy transitional mode for C and C++.
Default:
None.
Usage:
In the following example the compiler uses legacy transitional mode.
$ pgcc -Xt myprog.c
Description:
Use this option to use legacy transitional mode for C and C++. Further, this option implies alias=traditional.
Related options:
–alias, –Xs
246
Description:
Use this option to pass arguments to a specific phase. You can 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.
Related options:
–Minfo, –V, –v
Chapter 16. Command-Line Options Reference
C and C++ -specific Compiler Options
There are a large number of compiler options specific to the PGCC and PGC++ compilers, especially PGC+
+. This section provides the details of several of these options, but is not exhaustive. For a complete list of available options, including an exhaustive list of PGC++ options, use the –help command-line option. For further detail on a given option, use –help and specify the option explicitly, as described in
–A
(pgcpp only) Instructs the PGC++ compiler to accept code conforming to the proposed ANSI C++ standard, issuing 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++.
$ pgcpp -A hello.cc
Description:
Use this option to instruct the PGC++ compiler to accept code conforming to the proposed ANSI
C++ standard and to issues errors for non-conforming code.
Related options:
–a, –b and +p.
–a
(pgcpp only) Instructs the PGC++ compiler to accept code conforming to the proposed ANSI C++ standard, issuing warnings 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++, issuing warnings for non-conforming code.
$ pgcpp -a hello.cc
Description:
Use this option to instruct the PGC++ compiler to accept code conforming to the proposed ANSI
C++ standard and to issues warnings for non-conforming code.
Related options:
–A, –b and +p.
–alias
select optimizations based on type-based pointer alias rules in C and C++.
Syntax:
-alias=[ansi|traditional]
Default:
None.
Usage:
The following command-line enables optimizations.
$ pgcpp -alias=ansi hello.cc
247
C and C++ -specific Compiler Options
Description:
Use this option to select optimizations based on type-based pointer alias rules in C and C++.
ansi
Enable optimizations using ANSI C type-based pointer disambiguation traditional
Disable type-based pointer disambiguation
Related options:
–Xt
--[no_]alternative_tokens
(pgcpp only) Enables or disables recognition of alternative tokens. These are tokens that make it possible to write C++ without the use of the comma (,) , [, ], #, &, ^, and characters. The alternative tokens include the operator keywords (e.g., and, bitand, etc.) and digraphs.
Default:
. The default behavior is --no_alternative_tokens, that is, to disable recognition of alternative tokens.
Usage:
The following command-line enables alternative token recognition.
$ pgcpp --alternative_tokens hello.cc
(pgcpp only) Use this option to enable or disable recognition of alternative tokens. These tokens make it possible to write C++ without the use of the comma (,), [, ], #, &, ^, and characters. The alternative tokens include digraphs and the operator keywords, such as
and
,
bitand
, and so on. The default behavior is disabled recognition of alternative tokens: --no_alternative_tokens.
Related options:
–B
(pgcc and pgcpp only) Enables use of C++ style comments starting with // in C program units.
Default:
The PGCC ANSI and K&R C compiler does not allow C++ style comments.
Usage:
In the following example the compiler accepts C++ style comments.
$ pgcc -B myprog.cc
Description:
Use this option to enable use of C++ style comments starting with // in C program units.
Related options:
–Mcpp
–b
(pgcpp only) Enables compilation of C++ with cfront 2.1 compatibility and 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.
$ pgcpp -b myprog.cc
248
Chapter 16. Command-Line Options Reference
Description:
Use this option to enable compilation of C++ with cfront 2.1 compatibility. The compiler then accepts 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.
Related options:
––cfront2.1, –b3 , ––cfront3.0, +p, –A
–b3
(pgcpp only) Enables compilation of C++ with cfront 3.0 compatibility and 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.
$ pgcpp -b3 myprog.cc
Description:
Use this option to enable compilation of C++ with cfront 3.0 compatibility. The compiler then accepts 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.
Related options:
––cfront2.1, –b, ––cfront3.0, +p, –A
--[no_]bool
(pgcpp only) Enables or disables recognition of bool.
Default:
The compile recognizes bool: --bool.
Usage:
In the following example, the compiler does not recognize bool.
$ pgcpp --no_bool myprog.cc
Description:
Use this option to enable or disable recognition of bool.
Related options:
None.
--[no_]builtin
Compile with or without math subroutine builtin support.
Default:
The default is to compile with math subroutine support: --builtin.
Usage:
In the following example, the compiler does not build with math subroutine support.
$ pgcpp --no_builtin myprog.cc
Description:
Use this option to enable or disable compiling with math subroutine builtin support. When you compile with math subroutine builtin support, the selected math library routines are inlined.
Related options:
249
C and C++ -specific Compiler Options
--cfront_2.1
(pgcpp only) Enables compilation of C++ with cfront 2.1 compatibility and 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.
$ pgcpp --cfront_2.1 myprog.cc
Description:
Use this option to enable compilation of C++ with cfront 2.1 compatibility. The compiler then accepts 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.
Related options:
–b, –b3, ––cfront3.0, +p, –A
--cfront_3.0
(pgcpp only) Enables compilation of C++ with cfront 3.0 compatibility and 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.
$ pgcpp --cfront_3.0 myprog.cc
Description:
Use this option to enable compilation of C++ with cfront 3.0 compatibility. The compiler then accepts 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.
Related options:
--cfront2.1, –b, –b3, +p, –A
--compress_names
Compresses long function names in the file.
Default:
The compiler does not compress names: --no_compress_names.
Usage:
In the following example, the compiler compresses long function names.
$ pgcpp --ccmpress_names myprog.cc
Description:
Use this option to specify to compress long function names. Highly nested template parameters can cause very long function names. These long names can cause problems for older assemblers. Users encountering these problems should compile all C++ code, including library code with the switch
-compress_names
. Libraries supplied by PGI work with --compress_names.
Related options:
None.
250
Chapter 16. Command-Line Options Reference
--create_pch filename
(pgcpp only) If other conditions are satisfied, create a precompiled header file with the specified name.
Note
If --pch (automatic PCH mode) appears on the command line following this option, its effect is erased.
Default:
The compiler does not create a precompiled header file.
Usage:
In the following example, the compiler creates a precompiled header file, hdr1
.
$ pgcpp --create_pch hdr1 myprog.cc
Description:
If other conditions are satisfied, use this option to create a precompiled header file with the specified name.
Related options:
--pch
--diag_error tag
(pgcpp only) Overrides the normal error severity of the specified diagnostic messages.
Default:
The compiler does not override normal error severity.
Description:
Use this option to 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.
Related options:
--diag_remark tag, --diag_suppress tag, --diag_warning tag, --display_error_number
--diag_remark tag
(pgcpp only) Overrides the normal error severity of the specified diagnostic messages.
Default:
The compiler does not override normal error severity.
Description:
Use this option to 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.
Related options:
--diag_error tag, --diag_suppress tag, --diag_warning tag, --display_error_number
--diag_suppress tag
(pgcpp only) Overrides the normal error severity of the specified diagnostic messages.
Default:
The compiler does not override normal error severity.
Usage:
In the following example, the compiler overrides the normal error severity of the specified diagnostic messages.
$ pgcpp --diag_suppress error_tag prog.cc
Description:
Use this option to 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.
251
C and C++ -specific Compiler Options
Related options:
--diag_error tag, --diag_remark tag, --diag_warning tag, --diag_error_number
--diag_warning tag
(pgcpp only) Overrides the normal error severity of the specified diagnostic messages.
Default:
The compiler does not override normal error severity.
Usage:
In the following example, the compiler overrides the normal error severity of the specified diagnostic messages.
$ pgcpp --diag_suppress an_error_tag myprog.cc
Description:
Use this option to 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.
Related options:
--diag_error tag, --diag_remark tag, --diag_suppress tag, --diag_error_number
--display_error_number
(pgcpp only) Displays 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.
Default:
The compiler does not display error message numbers for generated diagnostic messages.
Usage:
In the following example, the compiler displays the error message number for any generated diagnostic messages.PLEASE PROVIDE ONE
$ pgcpp --display_error_number myprog.cc
Description:
Use this option to display the error message number in any diagnostic messages that are generated. You can use this option to determine the error number to be used when overriding the severity of a diagnostic message.
Related options:
--diag_error tag, --diag_remark tag, --diag_suppress tag, --diag_warning tag
-e<number>
(pgcpp only) Set the C++ front-end error limit to the specified <number>.
--[no_]exceptions
(pgcpp only) Enables or disables exception handling support.
Default:
The compiler provides exception handling support: --exceptions.
Usage:
In the following example, the compiler does not provide exception handling support. PLEASE PROVIDE
ONE
$ pgcpp --no_exceptions myprog.cc
Description:
Use this option to enable or disable exception handling support.
Related options:
--zc_eh
252
Chapter 16. Command-Line Options Reference
--gnu_extensions
(pgcpp only) Allows GNU extensions.
Default:
The compiler does not allow GNU extensions.
Usage:
In the following example, the compiler allows GNU extensions.
$ pgcpp --gnu_extensions myprog.cc
Description:
Use this option to allow GNU extensions, such as "include next", which are required to compile
Linux system header files.
Related options:
--zc_eh, --gnu_version
--gnu_version <num>
(pgcpp only) Sets the GNU C++ compatibility version.
Default:
The compiler uses the latest version.
Usage:
In the following example, the compiler sets the GNU version to 4.3.4.
$ pgcpp --gnu_version 4.3.4 myprog.cc
Description:
Use this option to set the GNU C++ compatibility version to use when you compile.
Related options:
--gnu_extensions
--[no]llalign
(pgcpp only) Enables or disables alignment of long long integers on long long boundaries.
Default:
The compiler aligns long long integers on long long boundaries: --llalign.
Usage:
In the following example, the compiler does not align long long integers on long long boundaries.
$ pgcpp --nollalign myprog.cc
Description:
Use this option to allow enable or disable alignment of long long integers on long long boundaries.
Related options:
–Mipa=[no]align
–M
Generates a list of make dependencies and prints them to stdout.
Note
The compilation stops after the preprocessing phase.
Default:
The compiler does not generate a list of make dependencies.
Usage:
In the following example, the compiler generates a list of make dependencies.
253
C and C++ -specific Compiler Options
$ pgcpp -M myprog.cc
Description:
Use this option to generate a list of make dependencies and prints them to stdout.
Related options:
–MD, –P
–MD
Generates a list of make dependencies and prints them to a file.
Default:
The compiler does not generate a list of make dependencies.
Usage:
In the following example, the compiler generates a list of make dependencies and prints them to the file myprog.d.
$ pgcpp -MD myprog.cc
Description:
Use this option to generate a list of make dependencies and prints them to a file. The name of the file is determined by the name of the file under compilation.dependencies_file<file>.
Related options:
–M, –P
--optk_allow_dollar_in_id_chars
(pgcpp only) Accepts dollar signs ($) in identifiers.
Default:
The compiler does not accept dollar signs ($) in identifiers.
Usage:
In the following example, the compiler allows dollar signs ($) in identifiers.
$ pgcpp -optk_allow_dollar_in_id_chars myprog.cc
Description:
Use this option to instruct the compiler to accept dollar signs ($) in identifiers.
- -microsoft_version <num>
Sets the Microsoft C++ compatibility version.
Default:
The compiler uses the latest version.
Usage:
In the following example, the compiler sets the Microsoft C++ version to 1.5.
$ pgcpp -microsoft_version 1.5 myprog.cc
Description:
Use this option to set the GNU C++ compatibility version to use when you compile.
Related options:
--gnu_extensions
–P
Halts the compilation process after preprocessing and writes the preprocessed output to a file.
Default:
The compiler produces an executable file.
Usage:
In the following example, the compiler produces the preprocessed file myprog.i in the current directory.
254
Chapter 16. Command-Line Options Reference
$ pgcpp -P myprog.cc
Description:
Use this option to halt the compilation process after preprocessing and write the preprocessed output to a file. If the input file is filename.c
or filename.cc.
, then the output file is filename.i
.
Related options:
–C,–c,–E, –Mkeepasm, –o, –S
-+p
(pgcpp only) Disallow all anachronistic constructs.
Default:
The compiler disallows all anachronistic constructs.
Usage:
In the following example, the compiler disallows all anachronistic constructs.
$ pgcpp -+p myprog.cc
Description:
Use this option to disallow all anachronistic constructs.
Related options:
None.
--pch
(pgcpp only) Automatically use and/or create a precompiled header file.
Note
If --use_pch or --create_pch (manual PCH mode) appears on the command line following this option, this option has no effect.
Default:
The compiler does not automatically use or create a precompiled header file.
Usage:
In the following example, the compiler automatically uses a precompiled header file.
$ pgcpp --pch myprog.cc
Description:
Use this option to automatically use and/or create a precompiled header file.
Related options:
--create_pch, --pc_dir, --use_pch
--pch_dir directoryname
(pgcpp only) Specifies the directory in which to search for and/or create a precompiled header file.
The compiler searches your PATH for precompiled header files / use or create a precompiled header file.
Usage:
In the following example, the compiler searches in the directory myhdrdir
for a precompiled header file.
$ pgcpp --pch_dir myhdrdir myprog.cc
Description:
Use this option to specify the directory in which to search for and/or create a precompiled header file. You may use this option with automatic PCH mode (--pch) or manual PCH mode (--create_pch or
--use_pch).
255
C and C++ -specific Compiler Options
Related options:
--create_pch, --pch, --use_pch
--[no_]pch_messages
(pgcpp only) Enables or disables the display of a message indicating that the current compilation used or created a precompiled header file.
The compiler displays a message when it uses or creates a precompiled header file.
In the following example, no message is displayed when the precompiled header file located in myhdrdir
is used in the compilation.
$ pgcpp --pch_dir myhdrdir --no_pch_messages myprog.cc
Description:
Use this option to enable or disable the display of a message indicating that the current compilation used or created a precompiled header file.
Related options:
--pch_dir
--preinclude=<filename>
(pgcpp only) Specifies the name of a file to be included at the beginning of the compilation.
In the following example, the compiler includes the file incl_file.c
at the beginning of the compilation.
me
$ pgcpp --preinclude=incl_file.c myprog.cc
Description:
Use this option to specify the name of a file to be included at the beginning of the compilation.
For example, you can use this option to set system-dependent macros and types.
Related options:
None.
--use_pch filename
(pgcpp only) Uses a precompiled header file of the specified name as part of the current compilation.
Note
If --pch (automatic PCH mode) appears on the command line following this option, its effect is erased.
Default:
The compiler does not use a precompiled header file.
In the following example, the compiler uses the precompiled header file, hdr1
as part of the current compilation.
$ pgcpp --use_pch hdr1 myprog.cc
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.
Related options:
--create_pch, --pch_dir, --pch_messages
256
Chapter 16. Command-Line Options Reference
--[no_]using_std
(pgcpp only) Enables or disables implicit use of the std namespace when standard header files are included.
Default:
The compiler uses std namespace when standard header files are included: --using_std.
Usage:
The following command-line disables implicit use of the std namespace:
$ pgcpp --no_using_std hello.cc
Description:
Use this option to enable or disable implicit use of the std namespace when standard header files are included in the compilation.
Related options:
–M[no]stddef
–t
(pgcpp only) Control instantiation of template functions.
–t [arg]
Default:
No templates are instantiated.
Usage:
In the following example, all templates are instantiated.
$ pgcpp -tall myprog.cc
Description:
Use this option to control instantiation of template functions. The argument 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.
$ pgcpp
-tall myprog.cc
–X
(pgcpp only) Generates cross-reference information and places output in the specified file.
Syntax:
257
–M Options by Category
–Xfoo where foo is the specifies file for the cross reference information.
Default:
The compiler does not generate cross-reference information.
Usage:
In the following example, the compiler generates cross-reference information, placing it in the file: xreffile
.
$ pgcpp -Xxreffile myprog.cc
Description:
Use this option to generate cross-reference information and place output in the specified file.
This is an EDG option.
Related options:
None.
--zc_eh
(Linux only) Generates zero-overhead exception regions.
Default:
The compiler does not use --zc_eh but instead uses --sjlj_eh, which implements exception handling with setjmp and longjmp.
Usage:
The following command-line enables zero-overhead exception regions:
$ pgcpp --zc_eh ello.cc
Description:
Use this option to generate zero-overhead exception regions. The --zc_eh option defers the cost of exception handling until an exception is thrown. For a program with many exception regions and few throws, this option may lead to improved run-time performance.
This option is compatible with C++ code that was compiled with previous version if PGI C++.
Note
The --zc_eh option is available only on newer Linux systems that supply the system unwind libraries in libgcc_eh and on Windows.
Related options:
--[no]exceptions.
–M Options by Category
This section describes each of the options available with –M by the categories:
Code generation Fortran Language Controls Optimization
C/C++ Language Controls Inlining Miscellaneous
Environment
For a complete alphabetical list of all the options, refer to “ –M Options Summary,” on page 222 .
The following sections provide detailed descriptions of several, but not all, of the –M<pgflag> options. For a
are grouped according to categories and are listed with exact syntax, defaults, and notes concerning similar or
258
Stiahnuť
Reklama