Fortran Programmer's Guide
Contents
Preface
1. Introduction
- Standards Conformance
- Features of the Fortran Compilers
- Related Sun Documentation
2. Fortran Input/Output
- Accessing Files From Fortran 77 Programs
- Accessing Named Files
- Opening Files Without a Name
- Preconnected Units
- Opening Files Without an OPEN Statement
- Passing File Names to Programs
- VAX / VMS Logical File Names (f77 Only)
- Direct I/O
- Internal Files
- Tape I/O
- Using TOPEN Routines
- Fortran Formatted I/O for Tape
- Fortran Unformatted I/O for Tape
- Tape File Representation
- End-of-File
- Using Multifile Tapes
- Fortran 90 I/O Considerations
3. Program Development
- Facilitating Program Builds With the make Utility
- The makefile
- make Command
- Macros
- Overriding of Macro Values
- Suffix Rules in make
- More Information
- Version Tracking and Control With SCCS
- Controlling Files With SCCS
- Checking Files Out and In
- More Information
4. Libraries
- Understanding Libraries
- Advantages of Libraries
- Linker Debugging Options
- Generating a Load Map
- Listing Other Information
- Consistent Compiling and Linking
- Library Search Paths and Order
- Search Order for Standard Library Paths
- Library Search Path and Order -- Static Linking
- Library Search Path and Order -- Dynamic Linking
- Creating Static Libraries
- Tradeoffs
- Creation of a Simple Static Library
- Creating Dynamic Libraries
- Tradeoffs
- Position-Independent Code and -pic
- Binding Options
- Naming Conventions
- A Simple Dynamic Library
- Libraries Provided with Sun Fortran Compilers
- Shippable Libraries
5. Program Analysis and Debugging
- Global Program Checking (f77 Only)
- GPC Overview
- How to Invoke Global Program Checking
- Some Examples of -Xlist and Global Program Checking
- Suboptions for Global Checking Across Routines
- -Xlist Suboption Reference
- Some Examples Using Suboptions
- Special Compiler Options
- Subscript Bounds (-C)
- Undeclared Variable Types (-u)
- Version Checking (-V)
- Interactive Debugging With dbx and The WorkShop
- Debugging Optimized Programs
- Viewing Compiler Listing Diagnostics
6. Floating-Point Arithmetic
- Introduction
- IEEE Floating-Point Arithmetic
- Handling Exceptions
- Trapping a Floating-Point Exception-f77 vs f90
- IEEE Routines
- Flags and ieee_flags()
- IEEE Extreme Value Functions
- Exception Handlers and ieee_handler()
- Retrospective Summary
- SPARC: Nonstandard Arithmetic
- -ftrap=mode Compiler Options
- Floating-Point Exceptions-f77 vs f90
- Debugging IEEE Exceptions
- Further Numerical Adventures
- Simple Underflow
- Continuing With the Wrong Answer
- Excessive Underflow (SPARC Only)
- Porting from Scientific Mainframes
7. Porting
- Time Functions
- Formats
- Carriage-Control
- Working With Files
- Data Representation
- Hollerith Data
- Nonstandard Coding Practices
- Uninitialized Variables
- Aliasing Across Calls
- Obscure Optimizations
- Troubleshooting
- Results Are Close, but Not Close Enough
- Program Fails without Warning
8. Performance Profiling
- The time Command
- Multiprocessor Interpretation of time Output
- The gprof Profiling Command
- Overhead Considerations
- Missing Profile Libraries
- The tcov Profiling Command
- "Old Style" tcov Coverage Analysis
- "New Style" Enhanced tcov Analysis
- I/O Profiling
9. Performance and Optimization
- Choice of Compiler Options
- Performance Option Reference
- Other Performance Strategies
- Use Optimized Libraries
- Eliminate Performance Inhibitors
- Further Reading
10. Parallelization
- Introduction
- Speedups--What to Expect
- Steps to Parallelizing a Program
- Data Dependency Issues
- Parallel Options and Directives Summary
- Notes on Compiler Options
- Specifying the Number of Processors
- Stacks, Stack Sizes, and Parallelization
- Automatic Parallelization
- Loop Parallelization
- Definitions: Array, Scalar, and Pure Scalar
- Automatic Parallelization Criteria
- Automatic Parallelization With Reduction Operations
- Explicit Parallelization
- Parallelizable Loops
- Sun-Style Parallelization Directives (f77 only)
- Cray-Style Parallelization Directives
- Debugging Parallelized Programs
11. C-Fortran Interface
- Compatibility Issues
- Function or Subroutine
- Data Type Compatibility
- Case Sensitivity
- Underscore in Names of Routines
- Argument-Passing by Reference or Value
- Argument Order
- Array Indexing and Order
- File Descriptors and stdio
- File Permissions
- Libraries and Linking With the f77 or f90 Command
- Passing Data Arguments by Reference
- Passing Data Arguments by Value
- Functions that Return a Value
- Labeled COMMON
- Sharing I/O Between Fortran and C
- Alternate Returns
Index