Sun Fortran Compiler Options |
3 |
![]() |
f77 [options] list_of_files [-lx] |
f90 [options] list_of_files [-lx] |
Items in square brackets indicate optional parameters. The brackets are not part of the command. The options are a list of option keywords prefixed by dash (-). Some keyword options take the next item in the list as an argument. The list_of_files is a list of source, object, or library file names separated by blanks.
Options Syntax
Typical compiler option formats are:
|
Syntax Format |
Example |
|
|
|
|
|
|
|
|
Brackets, pipe, and ellipsis are meta characters used in the descriptions of the options and are not part of the options themselves.
Do not queue the license request.
-noqueue
Show license server user IDs.
-xlicinfo
Debugging Options
For the following debugging options, the most useful are listed first.
Floating-Point Options
For the following floating-point options, the most significant are listed first.
Library Options
For the following library linking options, the most useful are listed first.
Licensing Options
The following options are for licensing.
Table 3-7 Licensing Options
Action
Option
Details
Performance Options
For the following performance options, those with the greatest significance are listed first.
Parallelization Options
For the following parallelization options, those with the greatest impact in most situations are listed first.Parallelization options require a WorkShop license. See the Fortran README files for details
Profiling Options
The following options enable runtime profiling in the compiled program. Depending on the options, profiling is done at either the basic block, procedure, or loop level.
Alignment Options
The following options are for specifying data alignment strategies.
Backward Compatibility and Legacy Options
The following options are provided for backward compatibility with earlier compiler releases, and certain Fortran legacy capabilities.
Obsolescent Options
The following options are no longer functional in the current release of the f77 and f90 compilers. Their appearance on a compiler command does not cause an error, and no action is taken; they are ignored.
All Options List
The following table lists all the Fortran 77 and Fortran 90 compiler options, and indicates any platform restrictions. The SPARC, PPC, and Intel columns indicate availability of an option on SPARC, PowerPC, and Intel Solaris 2.x systems, respectively:
Note that f90 1.2 is only available on SPARC systems.
Options Reference
This section shows all f77 and f90 compiler command-line option flags, including various risks, restrictions, caveats, interactions, examples, and other details. Each description indicates platform availability of the option, using the same legend as in the summary list, page 33.
| SPARC: - PPC: - Intel:77 |
-386.
| SPARC: - PPC: - Intel:77 |
-386. Code compiled with -486 does run on 80386 hardware, but it may run slightly slower.
| SPARC:77 PPC:77 Intel:77 |
Insert code to count the times each basic block of statements is executed. This invokes a runtime recording mechanism that creates one .d file for every .f file at normal program termination. The .d file accumulates execution data for the corresponding source file. The tcov(1) utility can then be run on the source file(s) to generate statistics about the program. The summary output produced by tcov is written to file.tcov for each source file. -pg and gprof are complementary to -a and tcov.
If set at compile-time, the TCOVDIR environment variable specifies the directory where the .d and .tcov files are located. If this variable is not set, then the .d files remain in the same directory as the .f files.
The -xprofile=tcov and the -a options are compatible in a single executable. That is, you can link a program that contains some files which have been compiled with -xprofile=tcov, and others with -a. You cannot compile a single file with both options.
If you compile and link in separate steps, and you compile with -a, then be sure to link with -a. You can mix -a with -On; in some earlier versions -a overrode -On.
For details, see the chapter Performance Profiling in the Fortran Programmer's Guide.
| SPARC: 77/90 PPC:77 Intel:77 |
ENTRY statements.
| SPARC:77 PPC:77 Intel:77 |
-arg=local to insure proper execution:
A = SETUP(ALPHA,BETA,GAMMA) ZORK = FXGAMMA(GCONST) ... FUNCTION SETUP(A1,A2,A3) ... ENTRY FXGAMMA(F) FXGAMMA = F*GAMMA ... RETURN END |
Without this option, there is no guarantee that the correct values of the actual arguments from the
SETUP call will be referenced when the routine is entered through FXGAMMA. Code that relies on -arg=local is non-standard. -autopar
Enable automatic loop parallelization.
| SPARC:77 PPC: - Intel: - |
-g cancels
-autopar. Debugging is facilitated by specifying -g without any optimization or parallelization options since not all debugging features are available when these options are invoked. See the dbx documentation for details.To improve performance, also specify the -
stackvar option when using any of the parallelization options, including -autopar.Avoid -autopar if the program already contains explicit calls to the libthread threads library. See note with
-mt on page 65.
The -autopar option is not appropriate on a single-processor system, and the compiled code will generally run slower.
-parallel and -explicitpar. While -autopar is not supported with the f90 compiler, both -parallel and -explicitpar are. Also, the -reduction option may be used with -autopar. -B{static|dynamic}
Allow dynamic or require static library linking.
| SPARC: 77/90 PPC:77 Intel:77 |
-B specified, is -Bdynamic.
These are loader and linker options. Compiling and linking in separate steps with -Bx on the compile command will require it in the link step as well.
| SPARC:77 PPC:77 Intel:77 |
C option checks for possible array subscript violations in the source code and during execution.Specifying
-C may make the executable file larger.If the -
C option is used, array subscript violations are treated as an error. If an array subscript range violation is detected in the source code during compilation, it is treated as a compilation error.If an array subscript violation can only be determined at runtime, the compiler generates range-checking code into the executable program. This may cause an increase in execution time. As a result, it is appropriate to enable full array subscript checking while developing and debugging a program, then recompiling the final production executable without subscript checking.
| SPARC: 77/90 PPC:77 Intel:77 |
o option can be used to specify the name of the .o file written.
| SPARC: 77/90 PPC: - Intel: - |
-xtarget=ss2 .
| SPARC: 77/90 PPC: - Intel: - |
-xtarget=ss1000 .
| SPARC:77 PPC:77 Intel:77 |
| SPARC: 77/90 PPC:77 Intel:77 |
Following are the predefined values:
xpp=cpp flag to force the compiler to specifically use cpp rather than fpp.
| SPARC: 77/90 PPC: - Intel: - |
Using this option automatically triggers the -f option, which causes all double-precision and quadruple-precision data types (both real and complex) to be aligned on 8-byte boundaries.
Using both -dbl and -dalign also causes 64-bit integer data type to be 8-byte aligned.
If you compile one subprogram with -dalign, compile all subprograms of the program with -dalign.
Caution - -dalign may result in non-ANSI standard alignment of data, which could cause problems with variables inEQUIVALENCEorCOMMON.
| SPARC:90 PPC: - Intel: - |
REAL, INTEGER, DOUBLE, and COMPLEX.
| SPARC:77 PPC:77 Intel:77 |
|
Without -dbl option |
With -dbl option | |||
|
Data Type |
default |
SPARC |
Intel |
PowerPC |
|
|
4 |
8 |
8 |
8 |
|
|
4 |
8 |
8 |
8 |
|
|
8 |
16 |
8 |
16 |
This option applies to variables, parameters, constants, and functions.
LOGICAL is treated as INTEGER, COMPLEX as two REALs, and DOUBLE COMPLEX as two DOUBLEs.-dbl and -r8 can be expressed in terms of the more general -xtypemap= option:
| SPARC:77 PPC:77 Intel:77 |
yes or no. If y is yes, all variables will be aligned on 8-byte boundaries. Default is -dbl_align_all=no.
| SPARC:77 PPC: - Intel: - |
O3 if no optimization level is specified, or if it is specified less than O3. Dependence analysis is also included with -autopar or -parallel. The dependence analysis is done at compile time. (See the Fortran Programmer's Guide.)
-g cancels -depend.
| SPARC: 77/90 PPC:77 Intel:77 |
| SPARC: 77/90 PPC:77 Intel:77 |
Unlike -
Bx, this option applies to the whole executable and need appear only once on the command line.
-dy|-dn are loader and linker options. If you compile and link in separate steps with these options, then you need the same option in the link step.
| SPARC: 77/90 PPC:77 Intel:77 |
| SPARC:77 PPC:77 Intel:77 |
%none, no warnings are suppressed. If taglist consists of %all, all warnings are suppressed (this is equivalent to the -w option.)
| SPARC:77 PPC:77 Intel:77 |
demo% f77 -errtags ink.f ink.f: MAIN: "ink.f", line 11: Warning: local variable "i" never used (WDECL_LOCAL_NOTUSED) <- The warning message's tag name |
-explicitpar
Parallelize loops explicitly marked by directives.
| SPARC: 77/90 PPC: - Intel: - |
DO loops immediately preceded by DOALL directives will have threaded, parallel code compiled for them. Parallelization is only appropriate on multiprocessor systems. This option should not be used to compile programs that already do their own multithreading with calls to the libthread library.If the optimization level is not
-O3 or higher, it is raised to -O3 automatically.The compiler will generate parallel code even if there are data dependencies in the
DO loop that would cause the loop to generate incorrect results when run in parallel. With explicit parallelization, it is the user's responsibility to correctly analyze loops for data dependency problems before marking them with parallelization directives. For details, see the Parallelization chapter in the Fortran Programmer's Guide.
To improve performance, also specify the -
stackvar option when using any of the parallelization options, including -explicitpar.-g cancels
-explicitpar. Debugging is facilitated by specifying -g without any optimization or parallelization options since not all debugging features are available when these options are invoked. See the dbx documentation for details.If you use -explicitpar and compile and link in one step, then linking automatically includes the microtasking library and the threads-safe FORTRAN runtime library. If you use -explicitpar and compile and link in separate steps, then you must also link with -explicitpar.
| SPARC:77 PPC:77 Intel:77 |
-ext_names=plain: Do not add trailing underscore.
-ext_names=underscore: Add trailing underscore.
An external name is a name of a subroutine, function, block data subprogram, or labeled common. This option affects both the name of the routine's entry point and the name used in calls to it. This option may be used to allow Fortran 77 routines to call and be called by other language routines.
| SPARC: 77/90 PPC:77 Intel:77 |
xpp=cpp.
| SPARC: 77/90 PPC: - Intel: - |
Using -dbl with -f aligns all 64-bit integer data on 8-byte boundaries as well.
A program requiring
-f may not be standard and may not be portable. Compiling any part of a program with -f requires compiling all subprograms of that program with -f.
By itself, this option does not enable the compiler to generate faster double word fetch/store instructions on double and quad precision data.
-dalign, page 45
-fast
Optimize for speed of execution using a selection of options.
| SPARC: 77/90 PPC:77 Intel:77 |
If you compile and link in separate steps, and you compile with -fast, then be sure to link with -fast.
-fast selects the following options:
Note - This option is defined as a particular selection of other options that is subject to change from one release to another, and between compilers. Also, some of the options selected by -fastmay not be available on some platforms.
f77 -fast xtarget=ultra ...
-depend option (SPARC only)
-fast differ across platforms:
It is possible to add or subtract from this list by following the
Note - With f90, the -f option is substituted for -libmil on SPARC.
-fast option with other options, as in:
f77 -fast -fsimple=2 -xnolibmopt ...
fsimple=1 option and disables the -xlibmopt selected by -fast.
| SPARC:90 PPC: - Intel: - |
f77 fixed format regardless of filename extension. Normally, f90 interprets only .f files as fixed format, .f90 as free format.
| SPARC: 77/90 PPC:77 Intel:77 |
| SPARC: 77/90 PPC:77 Intel:77 |
-ftrap=common on Intel and PowerPC.Specifying -fnonstd is approximately equivalent to the following two calls at the beginning of a Fortran main program.
i=ieee_handler("set", "common", SIGFPE_ABORT)
call nonstandard_arithmetic() |
The nonstandard_arithmetic() routine replaces the obsolete abrupt_underflow() routine of earlier releases.
-fnonstop
Disable floating-point exception trapping.
| SPARC:90 PPC: - Intel: - |
fnonstop disables exception trapping; execution continues without stopping.
| SPARC: 77/90 PPC: - Intel: - |
Floating-point arithmetic is initialized to nonstandard preferences on program startup:
|
Data Type |
Range |
|
REAL |
0.0 < |x| < 1.17549435e-38 |
|
DOUBLE PRECISION |
0.0 < |x| < 2.22507385072014e-308 |
See the Numerical Computation Guide for details on denormalized numbers, and the Fortran Programmer's Guide chapter Floating-Point for more information about this and similar options.
| SPARC: - PPC: - Intel:77 |
single, double, or extended.Initialize the floating-point hardware precision mode to single, double, or extended. Compile the main program with this option. (See the Floating-Point chapter of the Fortran Programmer's Guide.)
| SPARC:90 PPC: - Intel: - |
f90 free format regardless of filename extension. Normally, f90 interprets .f files as fixed format, .f90 as free format.
| SPARC: 77/90 PPC:77 Intel:77 |
The default is -fround=nearest.
This option sets the IEEE 754 rounding mode that:
To be effective, compile the main program with this option.
| SPARC:77 PPC:77 Intel:77 |
For consistent results, compile all units of a program with the same -
fsimple option.If n is present, it must be 0, 1, or 2. The defaults are:
| SPARC: - PPC: - Intel:77 |
-fast option sets -nofstore to disable this option.)
| SPARC: 77/90 PPC:77 Intel:77 |
This option sets the IEEE 754 trapping modes that are established at program initialization. Processing is left-to-right. The common exceptions, by definition, are invalid, division by zero, and overflow. For example: -ftrap=overflow.
Example: -ftrap=%all,no%inexact means set all traps, except inexact.
The meanings for -ftrap=t are the same as for ieee_flags(), except that:
For further information, see the Floating-Point chapter in the Fortran Programmer's Guide.
| SPARC: 77/90 PPC:77 Intel:77 |
-o with -G to specify the name of the file to be written. See the Fortran Programmer's Guide chapter Libraries for details.
| SPARC: 77/90 PPC:77 Intel:77 |
Although a some debugging is possible without specifying -
g, the full capabilities of dbx and debugger are only available to those compilation units compiled with -g.Some capabilities of other options specified along with
-g may be limited. The -g option suppresses the automatic inlining usually obtained with -O4, but it does not suppress -On optimizations.-g cancels any parallelization option (
-autopar, -explicitpar,
-parallel) as well as -depend and -reduction. Debugging is facilitated by specifying -g without any optimization or parallelization options since not all debugging features are available when these options are invoked. See the dbx documentation for details.For Intel and PowerPC: -
g is ignored when specified with a -On option or fast.For SPARC: The
-g option makes -xildon the default incremental linker option (see "-xildon" on page 91). That is, with -g, the compiler default behavior is to automatically invoke ild in place of ld, unless the -G option is present, or any source file is named on the command line.
-hnm
Specify the name of the generated dynamic shared library.
| SPARC: 77/90 PPC:77 Intel:77 |
The -hnm option records the name nm to the shared dynamic library being created as the internal name of the library. A space between -h and nm is optional. In general, nm must be the same as what follows the -o. Use of this option is meaningless without also specifying -
G. Without the -hnm option, no internal name is recorded in the library file.
If the library has an internal name, whenever an executable program referencing the library is run the runtime linker will search for a library with the same internal name in any path the linker is searching. With an internal name specified, searching for the library at runtime linking is more flexible. This option can also be used to specify versions of shared libraries.
If there is no internal name of a shared library, then the linker uses a specific path for the shared library file instead.
| SPARC: 77/90 PPC:77 Intel:77 |
xhelp=h on page 91.
-Idir
Add dir to the INCLUDE file search path.
| SPARC: 77/90 PPC:77 Intel:77 |
INCLUDE file search path. No space is allowed between -I and dir. Invalid directories are ignored with no warning message. The include file search path is the list of directories searched for
INCLUDE files: file names appearing on preprocessor #include directives, or Fortran INCLUDE statements. Example: Search for
INCLUDE files in /usr/app/include:
demo% f77 -I/usr/app/include growth.F |
Multiple -Idir options may appear on the command line. Each adds to the top of the search path list (first path searched).
INCLUDE or #include is:
INSTALL_HOME say, points at the installation path (e.g. /opt, or /some/place), the default search paths for INCLUDE files are:
| SPARC:77 PPC:77 Intel:77 |
Y to be n bytes regardless of the -i2.) This option may degrade performance. It is generally recommended to declare specific variables INTEGER*2 rather than use -i2.
| SPARC: 77/90 PPC:77 Intel:77 |
Y to be n bytes regardless of the -i4.).Although 4 bytes is the default size for
INTEGER and LOGICAL, this option can be used for overriding settings made by options like -dbl and -r8, which set these defaults to 8:
demo% f77 -dbl -i4 *.f Command line warning: -i4 overrides integer part of -dbl ... |
-inline=f1[,...fn]
Inline specified routines.
| SPARC:77 PPC:77 Intel:77 |
CALL or function call with the actual subprogram code itself. Inlining often provides the optimizer more opportunities to produce efficient code.The list is a comma-separated list of functions and subroutines.
Example: Inline the routines
xbar, zbar, vpoint:
demo% f77 -O3 -inline= |
Following are the restrictions; no warnings are issued:
-xcrossfile is also specified.
O4 actually degrades performance by restricting the optimizer's inlining to only those routines in the list.
| SPARC:77 PPC:77 Intel:77 |
| SPARC:77 PPC:77 Intel:77 |
| SPARC: 77/90 PPC:77 Intel:77 |
lx on page 62.
While building the executable file,ld(1) searches dir for archive libraries (.a files) and shared libraries (.so files). ld searches dir before searching the default directories. (See the Fortran Programmer's Guide chapter Libraries for information on library search order.) For the relative order between LD_LIBRARY_PATH and -Ldir, see ld(1).
demo% f77 -Ldir1 any.f |
Example: Use -Ldir again to add more directories:
demo% f77 -Ldir1 -Ldir2 any.f |
Note - Specifying /usr/lib or /usr/ccs/lib with -Ldir may prevent linking the unbundled libm. These directories are searched by default.
-lx
Add library libx.a to linker's list of search libraries.
| SPARC: 77/90 PPC:77 Intel:77 |
Bstatic or -dn are not specified), ld uses it, otherwise, ld uses static library libx.a. If it uses a shared library, the name is built in to a.out. No space is allowed between -l and x character strings.Example: Link with the library libV77:
demo% f77 any.f -lV77 |
Use -lx again to link with more libraries.
demo% f77 any.f -ly -lz |
See also the Libraries chapter in the Fortran Programmer's Guide for information on library search paths and search order.
-libmil
Inline selected libm library routines for optimization.
| SPARC:77 PPC:77 Intel:77 |
d_infinity, d_max_normal, d_max_subnormal, d_min_normal, d_min_subnormal, d_quiet_nan, d_signaling_nan, d_sqrt, ir_finite, ir_fp_class, ir_isinf, ir_isnan, ir_isnormal, ir_issubnormal, ir_iszero, ir_signbit, r_copysign, r_fabs, r_hypot, r_infinity, r_max_normal, r_max_subnormal, r_min_normal, r_min_subnormal, r_quiet_nan, r_signalling_nan, r_sqrtThis list of routines may change with subsequent compiler releases. For more information, see the man pages libm_single(3F) and libm_double(3F)
| SPARC:77 PPC: - Intel: - |
-explicitpar options.
-loopinfo generates a list of messages on standard error:
Use the error(1) utility to merge this list with the source file to produce an annotated source listing with each loop tagged as parallelized or not.
demo$ f77 -autopar -loopinfo any.f 2>&1 | error options |
Be aware that error rewrites the input source file. For details on error, see the error man page and the Fortran Programmer's Guide chapter on debugging.
-Mdir
Add dir to directories searched for Fortran 90 modules.
| SPARC:90 PPC: - Intel: - |
M and dir. The directories listed with -
M are searched after the current directory. Compiling a source file containing a module generates a .M module file in addition to the .o file. See Appendix C, "Module Files" on page 149 for more information about modules in Fortran 90.
-misalign
Allow misaligned data.
| SPARC:77 PPC:77 Intel: - |
-misalign option permits misaligned data in memory that would otherwise produce an error. Particular uses of COMMON and EQUIVALENCE statements cause data to be misaligned. Using this option may degrade performance; recoding to eliminate the cause of data misalignment is recommended instead.Example: The following creates misaligned variables.
INTEGER*2 I(4) REAL R1, R2 EQUIVALENCE (R1, I(1)), (R2, I(2)) END |
Two-byte elements of integer array
I are equivalenced to the 4-byte reals, contradicting the natural alignment of elements in an INTEGER*2 array . The following error message is issued:
"misalign.f", line 4: Error: bad alignment for "r2" forced by equivalence |
Compiling with -
misalign eliminates the compilation error, but sub-optimal code is generated. If you compile and link in separate steps, compiling with the -misalign option requires the option on the link step as well.
| SPARC:77 PPC: - Intel: - |
-mp is sun. Do not combine use in a single application.-mp=sun: Accept only the Sun-style directives: C$PAR or !$PAR prefix.
-mp=cray: Accept only the Cray-style directives: CMIC$ or !MIC$ prefix.
See the Fortran Programmer's Guide chapter on Parallelization for details.
| SPARC: 77/90 PPC:77 Intel:77 |
mt prevents conflicts. Use -mt if you mix C and Fortran, and you manage multithread C coding using the libthread primitives. Before you use your own multi-threaded coding, read the Solaris manual, Multithreaded Programming Guide.
The equivalent of -mt is included automatically with the -autopar, -explicitpar, or -parallel options.
Note the following:
| SPARC: 77/90 PPC:77 Intel:77 |
| SPARC:77 PPC: - Intel: - |
-autopar earlier on the command line.
| SPARC:77 PPC: - Intel: - |
| SPARC:77 PPC: - Intel: - |
-explicitpar earlier on the command line.
| SPARC: - PPC: - Intel:77 |
-fstore earlier on the command line (Intel only). -nofstore is invoked if -fast is specified.
| SPARC: 77/90 PPC:77 Intel:77 |
The -nolib option makes it easier to link one of these libraries statically. The system and language libraries are required for final execution. It is your responsibility to link them in manually. This option provides you with complete control.
For example, consider a program linked dynamically with libF77 that fails on a remote system because has no libF77. With this option you can link the library into your program statically.
Link libF77 statically and link libc dynamically with f77:
demo% f77 -nolib any.f -Bstatic -lF77 -Bdynamic -lm -lc |
Link libm statically and libc dynamically with f90:
demo% f90 -nolib any.f90 -lf90 -Bstatic -lm -Bdynamic -lc |
libf90 is always linked statically.
-nolibmil
Cancel -libmil on command line.
| SPARC:77 PPC:77 Intel:77 |
demo% f77 -fast -nolibmil ... |
-noqueue
Disable license queueing.
| SPARC:77 PPC:77 Intel:77 |
-reduction on command line.
| SPARC: 77/90 PPC: - Intel: - |
-reduction is used with other parallelization options. This option cancels -reduction.
| SPARC: 77/90 PPC:77 Intel:77 |
This option is helpful when libraries have been installed in some nonstandard location, and you do not wish to make the loader search down those paths when the executable is run at another site. Compare with -Rpaths.
See the Fortran Programmer's Guide chapter on Libraries for more information.
| SPARC: 77/90 PPC:77 Intel:77 |
If -O[n] is not specified, only a very basic level of optimization limited to local common subexpression elimination and dead code analysis is performed. A program's performance may be significantly improved when compiled with an optimization level than without optimization. Use of -
O (which implies -O3) or -fast (which implies -O4) is recommended for most programs.Each -
On level includes the optimizations performed at the levels below it. Generally, the higher the level of optimization a program is compiled with, the better runtime performance obtained. However, higher optimization levels may result in increased compilation time and larger executable files.Debugging with -g does not suppress -On, but -On limits -g in certain ways; this is described on page 57.
The-O3 and -O4 options reduce the utility of debugging such that you cannot display variables from dbx, but you can still use the dbx where command to get a symbolic traceback.
-O
This is equivalent to -O3.
-O1
Provides a minimum of statement-level optimizations.
-O2
Enables basic block level optimizations.
-xspace.)-O2 unless -O3 results in unreasonably long compilation time, exceeds swap space, or generates excessively large executable files. -O3
Adds loop unrolling and global optimizations at the function level.
-O4
Adds automatic inlining of routines contained in the same file.
-xcrossfile increases the scope of inlining with -O4. -O5
Attempt aggressive optimizations. (f77 only).
-O5's optimization algorithms take more compilation time, and may also degrade performance when applied to too large a fraction of the source program. -o nm
Specify the name of the executable file to be written.
| SPARC: 77/90 PPC:77 Intel:77 |
-c, -o specifies the target .o object file; with -G it specifies the target .so library file.
| SPARC:77 PPC:77 Intel:77 |
| SPARC: 77/90 PPC:77 Intel:77 |
| SPARC: 77/90 PPC:77 Intel:77 |
| SPARC:77 PPC: - Intel: - |
For -pad[=p], if p is present, it must be either (or both):
|
local |
Put padding between adjacent local variables |
|
common |
Put padding between variables in common blocks |
stackvar, page 79.-autopar, -explicitpar, -depend
| SPARC: 77/90 PPC: - Intel: - |
-g cancels
-parallel. Debugging is facilitated by specifying -g without any optimization or parallelization options since not all debugging features are available when these options are invoked. See the dbx documentation for details.To improve performance, also specify the -
stackvar option when using any of the parallelization options, including -autopar.Avoid -parallel if you do your own thread management. See the discussion of -mt on page 65.
Parallelization options like
-parallel are intended to produce executables programs to be run on multiprocessor systems. On a single-processor system, parallelization generally degrades performance.-parallel appears on the compile command it must also appear on the ld link command. -pentium
Compile for Intel Pentium.
| SPARC: - PPC: - Intel:77 |
-386. Code compiled with -pentium does run on 80386 and 80486 hardware, but it may be slower. Use of the option -xtarget=pentium is preferred over -pentium.
| SPARC: 77/90 PPC:77 Intel:77 |
Library options must be after the .f and .o files (-pg libraries are static).
If you compile and link in separate steps, and you compile with -pg, then be sure to link with -pg.
| SPARC: 77/90 PPC:77 Intel:77 |
The easiest way to tell whether or not a .o file has been compiled with -pic or -PIC is with the nm command:
% nm file.o | grep _GLOBAL_OFFSET_TABLE_ |
A .o file containing position-independent code contains an unresolved external reference to _GLOBAL_OFFSET_TABLE_, as indicated by the letter U.
-PIC
Compile position-independent code, but with 32-bit addresses.
| SPARC: 77/90 PPC:77 Intel:77 |
On PowerPC, the size of the global offset table is unlimited. On Intel, -
PIC is identical to -pic.
| SPARC: 77/90 PPC:77 Intel:77 |
pr can be one of the following: as, cg, cpp, fbe,
fpp, f77pass0, f77pass1, iropt, ld, or ratfor. This option is provided primarily for internal debugging.Example: Pass the -s and -
m options to the linker ld:
demo% f77 -Qoption ld -s,-m src.f |
| SPARC: 77/90 PPC:77 Intel:77 |
| SPARC: 77/90 PPC:77 Intel:77 |
ls is a colon-separated list of directories for library search paths. The blank between -R and ls is optional.
Multiple instances of this option are concatenated together, with each list separated by a colon.
The list is used at runtime by the runtime linker, ld.so. At runtime, dynamic libraries in the listed paths are scanned to satisfy any unresolved references.
Use this option to let users run shippable executables without a special path option to find needed dynamic libraries.
Building an executable file using
-Rpaths adds directory paths to a default path that is always searched last:
DOUBLE and COMPLEX.
| SPARC:77 PPC:77 Intel:77 |
|
Without -r8 option |
With -r8 option | |||
|
Data Type |
default |
SPARC |
Intel |
PowerPC |
|
|
4 |
8 |
8 |
8 |
|
|
4 |
8 |
8 |
8 |
|
|
8 |
16 |
8 |
16 |
This option applies to variables, parameters, constants, and functions.
LOGICAL is treated as INTEGER, COMPLEX as two REALs, and DOUBLE COMPLEX as two DOUBLEs.-dbl and -r8 can be expressed in terms of the more general -xtypemap= option:
The impact on runtime performance may be great. With -r8, an expression like float = 15.0d0*float is evaluated in quadruple precision due to the declaration of the constant.
If you select both -r8 and -i2, the results are unpredictable.
| SPARC: 77/90 PPC: - Intel: - |
A loop that transforms the elements of an array into a single scalar value is called a reduction operation. For example, summing the elements of a vector is a typical reduction operation. Although these operations violate the criteria for parallelizability, the compiler can recognize them and parallelize them as special cases when
-reduction is specified. See the Fortran Programmer's Guide chapter Parallelization for information on reduction operations recognized by the compilers.This option applies only with the automatic parallelization options -
autopar or -parallel. It is ignored otherwise. Explicitly parallelized loops are not analyzed for reduction operations.Example: Automatically parallelize with reduction:
demo% f77 -parallel -reduction any.f |
-S
Compile and only generate assembly code.
| SPARC: 77/90 PPC:77 Intel:77 |
| SPARC: 77/90 PPC:77 Intel:77 |
-g.
| SPARC:77 PPC:77 Intel:77 |
| SPARC:77 PPC:77 Intel:77 |
| SPARC:77 PPC:77 Intel:77 |
| SPARC: 77/90 PPC:77 Intel:77 |
Use of -
stackvar is recommended with any of the parallelization options.Variables and arrays are local, unless they are:
SUBROUTINE or FUNCTION statement (already on stack)
STATIC statement
REAL X/8.0/ or DATA X/8.0/
DATA statement after an executable reference to that variable is flagged as an error when -stackvar is used:
demo% cat stak.f real x x = 1. t = 0. print*, t data x/3.0/ print *,x+t end demo% f77 -o stak -stackvar stak.f stak.f: MAIN: "stak.f", line 5: Error: attempt to initialize an automati variable: x |
Putting large arrays onto the stack with
-stackvar can overflow the stack causing segmentation faults. Increasing the stack size may be required.
Example: Show the current main stack size:
demo% limit cputime unlimited filesize unlimited datasize 523256 kbytes stacksize 8192 kbytes <--- coredumpsize unlimited descriptors 64 memorysize unlimited demo% |
Example: Set the main stack size to 64 Megabytes:
demo% limit stacksize 65536 |
Example: Set each thread stack size to 8 Megabytes:
demo% setenv STACKSIZE 8192 |
For further information of the use of
-stackvar with parallelization, see the Parallelization chapter in the Fortran Programmer's Guide. See csh(1) for details on the limit command. -stop_status=yn
Permit STOP statement to return an integer status value.
| SPARC:77 PPC:77 Intel:77 |
yes or no. The default is no. With
-stop_status=yes, a STOP statement may contain an integer constant. That value will be passed to the environment as the program terminates:
STOP 123
STOP `stop string'
The environment status variable is
$status for the C shell csh, and $? for the Bourne and Korn shells, sh and ksh.
| SPARC: 77/90 PPC:77 Intel:77 |
| SPARC: 77/90 PPC:77 Intel:77 |
| SPARC:77 PPC:77 Intel:77 |
Portability and mixing Fortran with other languages may require use of
-U. These are discussed in the Fortran Programmer's Guide. (Note that f90 does not have this option, always treating upper and lower case as equivalent.)
| SPARC:77 PPC:77 Intel:77 |
| SPARC:77 PPC:77 Intel:77 |
UNROLL directive on page 16.
-V
Show name and version of each compiler pass.
| SPARC: 77/90 PPC:77 Intel:77 |
This information will be helpful when discussing problems with Sun service engineers.
-v
Verbose mode - show details of each compiler pass.
| SPARC: 77/90 PPC:77 Intel:77 |
-V, shows the name of each pass as the compiler executes, and details the options and environment variables used by the driver.
| SPARC:77 PPC:77 Intel:77 |
no% (as in no%logical_name).The primary options are
-vax=align and -vax=misalign.
-vax=align selects all the suboptions without allowing misaligned data. This is the behavior of the -xl option prior to f77 release 3.0.1.
-vax=misalign selects all the suboptions and allows misaligned data. This is the behavior of the -xl option with f77 release 3.0.1 and later.
Table 3-18 lists suboptions that can be individually selected.
%all and %none can also be used to select all or none of these suboptions.-vax=%all,no%rsize -xl and -misalign. -vpara
Show verbose parallelization messages.
| SPARC:77 PPC: - Intel: - |
Example: -vpara for verbose parallelization warnings:
demo% f77 -explicitpar -vpara any.f any.f: MAIN any: "any.f", line 11: Warning: the loop may have parallelization inhibiting reference |
| SPARC: 77/90 PPC:77 Intel:77 |
Example: -w still allows some warnings to get through:
demo% f77 -w -fast -silent -O4 any.f f77: Warning: -O4 overwrites previously set optimization level of -O3 demo% |
For f90: Individual levels from 0 to 4 can be specified: -
w0 suppresses the least messages while -w4 suppresses most warning. -w is equivalent to -w0. -xa
Synonym for -a.
| SPARC:77 PPC:77 Intel:77 |
| SPARC:77 PPC:77 Intel:77 |
|
On SPARC: |
generic, v7, v8a, v8, v8plus, v8plusa |
|
On PowerPC: |
generic, ppc, ppc_nofma |
|
On Intel: |
generic, 386, pentium_pro |
Although this option can be used alone, it is part of the expansion of the
-xtarget option; it is provided to allow overriding the -xarch value implied by a specific -xtarget option.
generic and ppc are equivalent in this release and direct the compiler to produce code for the PowerPC 603 and 604 instruction set.
generic and 386 are equivalent in this release.
pentium_pro directs the compiler to issue instructions for the Intel PentiumPro chip.
| SPARC:77 PPC: - Intel: - |
| SPARC:77 PPC: - Intel: - |
|
si |
The size of the data cache at level i, in kilobytes |
|
li |
The line size of the data cache at level i, in bytes |
|
ai |
The associativity of the data cache at level i |
This option specifies the cache properties that the optimizer can use. It does not guarantee that any particular cache property is used.
-xtarget option; it is provided to allow overriding an -xcache value impled by a specific -xtarget option.
Example: -xcache=16/32/4:1024/32/1 specifies the following:
|
Level 1 cache has: 16K bytes 32 bytes line size 4-way associativity |
Level 2 cache has: 1024K bytes 32 bytes line size Direct mapping associativity |
| SPARC:77 PPC: - Intel: - |
| SPARC:77 PPC: - Intel: - |
| SPARC:77 PPC:77 Intel:77 |
Although this option can be used alone, it is part of the expansion of the
-xchip value implied by the a specific -xtarget option.Some effects of -xchip=c are:
-xchip values:
-xcrossfile
Enable optimization and inlining across source files.
| SPARC:77 PPC: - Intel: - |
-O4's automatic inlining is limited to subprograms defined and referenced within the same source file. With
-xcrossfile, the compiler analyzes all the files named on the command line as if they had been concatenated into a single source file.
-xcrossfile is only effective when used with -O4 or -O5.Cross-file inlining creates a possible source file interdependence that would not normally be there. If any file in a set of files compiled together with
-xcrossfile is changed, then all files must be recompiled to insure that the new code is properly inlined. See the discussion of inlining on page 60.
| SPARC:77 PPC: - Intel: - |
| SPARC:77 PPC: - Intel: - |
| SPARC:77 PPC:77 Intel:77 |
Reordering the subprograms in memory is useful only when the application text page fault time is consuming a large percentage of the application time. Otherwise, reordering may not improve the overall performance of the application. The Analyzer is part of the Sun WorkShop. See WorkShop: Getting Started and Beyond the Basics for further information on the Analyzer.
| SPARC:77 PPC:77 Intel:77 |
readme: Show the online README file for this release of the compiler.
-xhelp=flags is a synonym for -help.
| SPARC: 77/90 PPC: - Intel: - |
This option is the default if you do not use the -g option. It is also the default if you use -G or name any source file on the command line.
Override this default by using the -xildon option.
| SPARC: 77/90 PPC: - Intel: - |
This option is the default if you use -g and do not use -G, and do not name any source file on the command line.
Override this default by using the -xildoff option.
See the Incremental Link Editor guide.
| SPARC:77 PPC:77 Intel:77 |
| SPARC:77 PPC:77 Intel:77 |
-vax=misalign, and provides the language features that are listed later in this description. See the description of -vax=, page 83.
Although most VMS features are accepted automatically by f77 without any special options, you must use the -xl option for a few VMS extensions.
-xld: Specifying -xld option causes debugging comments (D or d in column one) to be compiled. Without the -xld option, they remain comments only. No space is allowed between -xl and d.Programs that need to share structures with C programs should use the default and not -xl.
You may also be interested in -lV77 and the VMS library. See the Fortran Library Reference for information on the VMS libraries.
Read the chapter on VMS language extensions in the Fortran 77 Language Reference for details of the VMS features that you get automatically.
| SPARC:77 PPC:77 Intel:77 |
| SPARC: 77/90 PPC: - Intel: - |
| SPARC: 77/90 PPC:77 Intel:77 |
f77 -o pgx -fast pgx.f -xlic_lib=sunperf |
As with -l, this option should appear on the command line after all source and object file names.
-xlicinfo
Show license server information.
| SPARC: 77/90 PPC:77 Intel:77 |
Generally, with this option, no compilation takes place, and a license is not checked out. This option is normally used alone with no other options. However, if a conflicting option is used, then the last one on the command line prevails, and there is a warning.
-Xlist[x]
Produce listings and do global program checking.
| SPARC: 77/90 PPC:77 Intel:77 |
Xlist options are advisory warnings and do not prevent the program from being compiled and linked.
Example: Check across routines for consistency:
Note - Not all-Xlistsuboptions are available with release 1.2 off90. Full global program checking will be available in a later f90 release.
demo% f77 -Xlist fil.f |
The above example writes the following to the output file fil.lst:
A number of sub-options provide further flexibility in the selection of actions. These are specified by suffixes to the main -
Xlist option, as shown in the following table:
Options
-Xlistc, -Xlistf, -Xlistflndir, -Xlisth, -Xlists, and -Xlistvn are not available with this release (1.2) of f90. -xloopinfo
Synonym for -loopinfo.
| SPARC:77 PPC: - Intel: - |
| SPARC: 77/90 PPC:77 Intel:77 |
| SPARC: 77/90 PPC:77 Intel:77 |
| SPARC: 77/90 PPC:77 Intel:77 |
f77 -fast -xnolibmopt ...
| SPARC: 77/90 PPC:77 Intel:77 |
-pad.
| SPARC:77 PPC: - Intel: - |
| SPARC: 77/90 PPC: - Intel: - |
| SPARC: 77/90 PPC:77 Intel:77 |
| SPARC: 77/90 PPC:77 Intel:77 |
The compilers use fpp(1) to preprocess .F or .F90 source files. This preprocessor is appropriate for Fortran. Previous versions used the standard C preprocessor cpp. To select cpp, specify
-xpp=cpp.
| SPARC:77 PPC: - Intel:77 |
O2 or greater.Only
-xprofile=tcov is available on Intel.collect[:nm] (SPARC)
collect:nm, the nm is optional and may be used to specify the name of the program.
| SPARC: 77/90 PPC: - Intel: - |
| SPARC:77 PPC: - Intel: - |
Example: -xregs=appl,no%float
appl: Allow using the registers g2, g3, and g4.
float: Allow using the floating-point registers as specified in the SPARC ABI.
| SPARC:77 PPC:77 Intel:77 |
| SPARC:77 PPC: - Intel: - |
-O5 and -xarch=v8plus are also specified.
| SPARC:77 PPC:77 Intel:77 |
| SPARC:77 PPC:77 Intel:77 |
| SPARC:77 PPC: - Intel: - |
Example: Do not unroll or parallelize loops if it increases code size.
| SPARC:77 PPC:77 Intel:77 |
t must be one of: native, generic, system-name.
The -xtarget option permits a quick and easy specification of the -xarch, -xchip, and -xcache combinations that occur on real systems. The only meaning of -xtarget is in its expansion.
The performance of some programs may benefit by providing the compiler with an accurate description of the target computer hardware. When program performance is critical, the proper specification of the target hardware could be very important. This is especially true when running on the newer SPARC processors. However, for most programs and older SPARC processors, the performance gain is negligible and a generic specification is sufficient.
native: Optimize performance for the host system.
For example:
For PowerPC: -
xtarget= accepts generic or native.xtarget= accepts:
generic or native
386 (equivalent to -386 option) or 486 (equivalent to -486 option)
pentium (equivalent to -pentium option) or pentium_pro
| SPARC: 77/90 PPC:77 Intel:77 |
| SPARC:77 PPC:77 Intel:77 |
-dbl and -r8.The syntax of the specification string spec is:
:size,type:size,...
real, double, integer.The accepted data sizes are
64, 128, and mixed.This option applies to all variables declared with default specifications (without explicit byte sizes), as in
REAL XYZ.The allowable combinations on each platform are:
The mapping
integer:mixed indicates 8 byte integers but only 4 byte arithmetic.-dbl and -r8 options have their -xtypemap equivalents:
There are two additional possibilities on SPARC and PowerPC:
-xtypemap=real:64,double:64,integer:mixed
-xtypemap=real:64,double:64,integer:64
REAL and DOUBLE to 8 bytes.Note that
INTEGER and LOGICAL are treated the same, and COMPLEX is mapped as two REALs. Also, DOUBLE COMPLEX will be treated the way DOUBLE is mapped.
| SPARC:77 PPC:77 Intel:77 |
| SPARC:77 PPC: - Intel: - |
| SPARC:77 PPC: - Intel: - |
If you compile and link in separate steps, and you compile with -Zlp, then be sure to link with -Zlp.
If you compile one subprogram with -Zlp, you need not compile all the subprograms of that program with -Zlp. However, you receive the loop information only for the files compiled with -Zlp, and no indication that the program includes other files.
Refer to WorkShop: Beyond the Basics for more information.
| SPARC:77 PPC: - Intel: - |
The general purpose of -ztext is verify that a generated library is pure text; instructions are all position-independent code. Therefore, it is generally used with both -G and -pic.
With -ztext, if ld finds an incomplete relocation in the text segment, then it does not build the library. If it finds one in the data segment, then it generally builds the library anyway; the data segment is writable.
Without -ztext, ld builds the library, relocations or not.
A typical use is to make a library from both source files and object files, where you do not know if the object files were made with -pic.
Example: Make library from both source and object files:
demo% f77 -G -pic -ztext -o MyLib -hMyLib a.f b.f x.o y.o |
An alternate use is to ask if the code is position-independent already: compile without -pic, but ask if it is pure text.
demo% f77 -G -ztext -o MyLib -hMyLib a.f b.f x.o y.o |
If you compile with -ztext and ld does not build the library, then you can
recompile without -ztext, and ld will build the library. The failure to build
with -ztext means that one or more components of the library cannot be
shared; however, maybe some of the other components can be shared. This
raises questions of performance that are best left to you, the programmer.
-Ztha
Compile for performance profiling with Thread Analyzer.
| SPARC:77 PPC: - Intel: - |
If you compile and link in separate steps, and you compile with -Ztha, then link with -Ztha. All subprograms need not be compiled with -Ztha. However, thread statistics will appear only for the files compiled with the option.
Refer to tha (1) or WorkShop: Beyond the Basics for details.