Sun Studio 12: Fortran Programming Guide

Chapter 1 Introduction

The SunTM Studio Fortran 95 compiler, f95, described here and in the companion Fortran User’s Guide, is available under the SolarisTM operating environment on SPARC®, UltraSPARC®, and x64/x86 platforms. The compiler conforms to published Fortran language standards, and provides many extended features, including multiprocessor parallelization, sophisticated optimized code compilation, and mixed C/Fortran language support.

The f95 compiler also provides a Fortran 77 compatibility mode that accepts most legacy Fortran 77 source codes. A separate Fortran 77 compiler is no longer included. See Chapter 5 of the Fortran User’s Guide for information on FORTRAN 77 compatibility and migration issues.

1.1 Standards Conformance

The responsible standards bodies may revise these standards from time to time. The versions of the applicable standards to which these compilers conform may be revised or replaced, resulting in features in future releases of the Sun Fortran compilers that create incompatibilities with earlier releases.

1.2 Features of the Fortran 95 Compiler

The Sun Studio Fortran 95 compiler provides the following features and extensions:

See Appendix B of the Fortran User’s Guide for details on new and extended features added to the compiler with each software release.

1.3 Other Fortran Utilities

The following utilities provide assistance in the development of software programs in Fortran:

1.4 Debugging Utilities

The following debugging utilities are available:

1.5 Sun Performance Library

The Sun Performance LibraryTM is a library of optimized subroutines and functions for computational linear algebra and Fourier transforms. It is based on the standard libraries LAPACK, BLAS1, BLAS2, BLAS3, FFTPACK, VFFTPACK, and LINPACK generally available through Netlib (www.netlib.org).

Each subprogram in the Sun Performance Library performs the same operation and has the same interface as the standard library versions, but is generally much faster and accurate and can be used in a multiprocessing environment.

See the performance_library README file, and the Sun Performance Library User’s Guide for details. (Man pages for the performance library routines are in section 3P.)

1.6 Interval Arithmetic

The Fortran 95 compiler provides the compiler flags -xia and -xinterval to enable new language extensions and generate the appropriate code to implement interval arithmetic computations. See the Fortran 95 Interval Arithmetic Programming Reference for details. (Interval arithmetic features are only supported on SPARC/UltraSPARC platforms.)

1.7 Man Pages

Online manual (man) pages provide immediate documentation about a command, function, subroutine, or collection of such things. The user's MANPATH environment variable should be set to the path of the installed Sun Studio man directory to access the Sun Studio man pages. Typically this is /opt/SUNWspro/man on Solaris.

You can display a man page by running the command:


demo% man topic

Throughout the Fortran documentation, man page references appear with the topic name and man section number: f95(1) is accessed with man f95. Other sections, denoted by ieee_flags(3M) for example, are accessed using the -s option on the man command:


demo% man -s 3M ieee_flags

The Fortran library routines are documented in the man page section 3F.

The following lists man pages of interest to Fortran users:

f95(1)

The Fortran 95 command-line options 

analyzer(1)

Sun Studio Performance Analyzer 

asa(1)

Fortran carriage-control print output post-processor 

dbx(1)

Command-line interactive debugger 

fpp(1)

Fortran source code pre-processor 

cpp(1)

C source code pre-processor 

fdumpmod(1)

Display contents of a MODULE (.mod) file.

fsplit(1)

Pre-processor splits Fortran source routines into single files 

ieee_flags(3M)

Examine, set, or clear floating-point exception bits 

ieee_handler(3M)

Handle floating-point exceptions 

matherr(3M)

Math library error handling routine 

ild(1)

Incremental link editor for object files 

ld(1)

Link editor for object files 

1.8 README Files

The README pages on the Sun Developer Network (SDN) portal (http://developers.sun.com/sunstudio) describe new features, software incompatibilities, bugs, and information that was discovered after the manuals were printed. These README pages are part of the documentation on the portal for this release, and are also linked from the HTML documentation index that is part of the installed software at file:/opt/SUNWspro/docs.

Table 1–1 README Pages of Interest

README Page  

Describes...  

fortran_95

new and changed features, known limitations, documentation errata for this release of the Fortran 95 compiler, f95.

fpp_readme

overview of fpp features and capabilities

interval_arithmetic

overview of the interval arithmetic features in f95

math_libraries

optimized and specialized math libraries available. 

profiling_tools

using the performance profiling tools, prof, gprof, and tcov.

runtime_libraries

libraries and executables that can be redistributed under the terms of the End User License. 

performance_library

overview of the Sun Performance Library 

openmp

new and changed features in the OpenMP parallelization API 

The URL to the README page for each compiler is displayed by the -xhelp=readme command-line option. For example, the command:


% f95 -xhelp=readme

displays the URL for viewing the fortran_95 README for this release on the SDN portal.

1.9 Command-Line Help

You can view very brief descriptions of the f95 command line options by invoking the compiler’s -help option as shown below:


%f95 -help=flags
Items within [ ] are optional. Items within < > are variable parameters.
Bar | indicates choice of literal values.
-someoption[={yes|no}] implies -someoption is equivalent to -someoption=yes
_______________________________________________________________
-a                 Collect data for tcov basic block profiling
-aligncommon[=<a>] Align common block elements to the specified boundary requirement; <a>={1|2|4|8|16}
-ansi              Report non-ANSI extensions.
-autopar           Enable automatic loop parallelization
-Bdynamic          Allow dynamic linking
-Bstatic           Require static linking
-C                 Enable runtime subscript range checking
-c                 Compile only; produce .o files but suppress
                   linking
...etc.