Fortran User's Guide
  Search only this book
Download this book in PDF (349 KB)

Chapter 1 Introduction

The Sun Fortran compilers, f77 and f90, described in this book (and the companion book Sun Fortran Programming Guide) are available under the Solaris operating environment on the various hardware platforms that Solaris supports. The compilers themselves conform to published Fortran language standards, and provide many extended features, including multiprocessor parallelization, sophisticated optimized code compilation, and mixed C/Fortran language support.

Standards Conformance

  • f77 was designed to be compatible with the ANSI X3.9-1978 Fortran standard and the corresponding International Organization for Standardization (ISO) 1539-1980, as well as standards FIPS 69-1, BS 6832, and MIL-STD-1753.

  • f90 was designed to be compatible with the ANSI X3.198-1992 standard, and ISO/IEC 1539:1991

  • Floating-point arithmetic for both compilers is based on IEEE standard 754-1985, and international standard IEC 60559:1989.

  • On SPARC platforms, both compilers provide support for the optimization-exploiting features of SPARC V8, and SPARC V9, including the UltraSPARC(TM) implementation. These features are defined in the SPARC Architecture Manuals, Version 8 (ISBN 0-13-825001-4), and Version 9 (ISBN 0-13-099227-5), published by Prentice-Hall for SPARC International.

  • In this document, "Standard" means conforming to the versions of the standards listed above. "Non-standard" or "Extension" refers to features that go beyond these versions of these standards.

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.

Features of the Fortran Compilers

Sun Fortran compilers provide the following features or extensions:

  • f77: Global program checking across routines for consistency of arguments, commons, parameters, and the like.

  • SPARC only: Support for multiprocessor systems, including automatic and explicit loop parallelization, is integrated tightly with optimization.


    Note -

    Parallelization features of the Fortran compilers are only available with the Sun Performance WorkShop.


  • f77: Many VAX/VMS Fortran 5.0 extensions, including:

    • NAMELIST

    • DO WHILE

    • Structures, records, unions, maps

    • Variable format expressions

    • Recursion

    • Pointers

    • Double-precision complex

    • SPARC: Quadruple-precision real

    • SPARC: Quadruple-precision complex

  • Cray-style parallelization directives, including TASK COMMON, with extensions for f90.

  • Global, peephole, and potential parallelization optimizations produce high performance applications. Benchmarks show that optimized applications can run significantly faster when compared to unoptimized code.

  • Common calling conventions on Solaris systems permit routines written in C or C++ to be combined with Fortran programs.

  • Support for 64-bit Solaris 7 environments on UltraSPARC platforms.

  • Fortran 95 features in f90 include the attributes PURE and ELEMENTAL, and enhanced forms of MAXVAL and MINVAL.

  • Call-by-value, %VAL, implemented in both f77 and f90.

  • Interoperability between Fortran 77 and Fortran 90 programs and object binaries.

Other Fortran Utilities

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

  • asa -- This Solaris utility is a Fortran output filter for printing files that have Fortran carriage-control characters in column one. Use asa to transform files formatted with Fortran carriage-control conventions into files formatted according to UNIX line-printer conventions. See asa(1).

  • fsplit -- This utility splits one Fortran file of several routines into several files, each with one routine per file. Use fsplit on FORTRAN 77 or Fortran 90 source files. See fsplit(1)

  • gprof -- Profile program run-time performance by procedure. (This utility is available if you do a developer install, rather than an end user install of the Solaris operating environment; it is also included if you install the SUNWbtool package.)

  • tcov -- Profile program run-time performance by statement.

Debugging Utilities

The following debugging utilities are available:

  • error -- A utility to merge compiler error messages with the Fortran source file. (This utility is included if you do a developer install, rather than an end user install of Solaris; it is also included if you install the SUNWbtool package.)

  • -Xlist -- A compiler option to check across routines for consistency of arguments, COMMON blocks, and so on.

  • Sun WorkShop(TM) -- The Sun WorkShop provides a number of debugging utilities such as dbx and a data visualizer, presented within an easy-to-use graphical framework.

Sun Performance Library(TM)

The Sun Performance Library is a library of optimized subroutines and functions for computational linear algebra and Fourier transforms. It is based on the standard libraries BLAS1, BLAS2, BLAS3, LINPACK, LAPACK, FFTPACK, and VFFTPACK.

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 possibly more accurate.

See the performance_library README file for details.

Man Pages

On-line manual (man) pages provide immediate documentation about a command, function, subroutine, or collection of such things.

Sun WorkShop man pages are located in /opt/SUNWspro/man/ after a standard install of the products. Add this path to your MANPATH environment variable to access these Sun WorkShop man pages.

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: f77(1) is accessed with man f77. 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 following lists man pages of interest to Fortran user:

f77(1) and f90(1)

The Fortran compilers command-line options 

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 

fsplit(1)

Pre-processor splits Fortran 77 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 

READMEs

The READMEs directory contains files that describe new features, software incompatibilities, bugs, and information that was discovered after the manuals were printed. The location of this directory depends on where your software was installed.

The READMEs in a standard install would appear in: /opt/SUNWspro/READMEs/

Table 1-1 READMEs of Interest

README File 

Describes... 

 fortran_77

new and changed features, known limitations, documentation errata for this release of the FORTRAN 77 compiler, f77.

 fortran_90

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

 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. 

 64bit_Compilers

compiling for 64-bit Solaris 2.7 environments. 

 fpp_white_paper.ps

fpp, the Fortran pre-processor; this is a reference white paper in PostScript(TM) format and can be viewed using imagetool.

 performance_library

the Sun Performance Library 

The READMEs for all compilers are easily accessed by the -xhelp=readme command-line option. For example, the command:

f90 -xhelp=readme

will display the fortran_90 README file directly.

Command-Line Help

You can view very brief descriptions of the f77 and f90 command line options by invoking the compiler's -help option as shown below:


%f77 -help  -or-  
 f90 -help
_______________________________________________________________
Items within [ ] are optional. Items within < > are variable
parameters.Bar | indicates choice of literal values. For example:
   -someoption[=<yes|no>] implies  -someoption  is  
   -someoption=yes
_______________________________________________________________
-a:            Collect data for tcov basic block profiling
                   (old format)
-ansi:         Report non-ANSI extensions.
-arg=local:    Preserve actual arguments over ENTRY statements
-autopar:      Enable automatic loop parallelization 
                       (requires WorkShop license)
-Bdynamic:     Allow dynamic linking
-Bstatic:      Require static linking
-c:            Compile only - produce .o files, suppress linking
-C:            Enable runtime subscript range checking
-cg89:         Generate code for generic SPARC V7 architecture
-cg92:         Generate code for SPARC V8 architecture
-copyargs:     Allow assignment to constant arguments
...etc.