Fortran Programming Guide |
Preface
This guide presents the essential information programmers need to develop efficient applications using the Sun WorkShopTM Fortran compilers,
f77
(Fortran 77) andf95
(Fortran 95). It presents issues relating to input/output, program development, use and creation of software libraries, program analysis and debugging, numerical accuracy, porting, performance, optimization, parallelization, and the C/Fortran interface.Discussion of the compiler command-line options and their use can be found in the companion book, the Fortran User's Guide.
This guide is intended for scientists, engineers, and programmers who have a working knowledge of the Fortran language and wish to learn how to use the Sun Fortran compilers effectively. Familiarity with the Solaris operating environment or UNIX® in general is also assumed.
Multiplatform Release
This Sun WorkShop Fortran release supports versions 2.6, 7, and 8 of the SolarisTM SPARCTM Platform Edition Operating Environment.
See the README files
fortran_77
andfortran_95
, in the Sun WorkShopREADMEs
directory for information regarding availability of this release of thef77
andf95
compilers on specific platforms. (See page 16.)Access to Sun WorkShop Development Tools
Because Sun WorkShop product components and man pages do not install into the standard
/usr/bin/
and/usr/share/man
directories, you must change yourPATH
andMANPATH
environment variables to enable access to Sun WorkShop compilers and tools.To determine if you need to set your
PATH
environment variable:1. Display the current value of thePATH
variable by typing:
%
echo $PATH
2. Review the output for a string of paths containing/opt/SUNWspro/bin/
.
- If you find the paths, your
PATH
variable is already set to access Sun WorkShop development tools. If you do not find the paths, set yourPATH
environment variable by following the instructions in this section.To determine if you need to set your
MANPATH
environment variable:1. Request theworkshop
man page by typing:
%
man workshop
2. Review the output, if any.
- If the
workshop
(1) man page cannot be found or if the man page displayed is not for the current version of the software installed, follow the instructions in this section for setting yourMANPATH
environment variable.
Note The information in this section assumes that your Sun WorkShop 6 products were installed in the/opt
directory. Contact your system administrator if your Sun WorkShop software is not installed in/opt
.
The
PATH
andMANPATH
variables should be set in your home.cshrc
file if you are using the C shell or in your home.profile
file if you are using the Bourne or Korn shells:
- To use Sun WorkShop commands, add the following to your
PATH
variable:
/opt/SUNWspro/bin
- To access Sun WorkShop man pages with the
man
command, add the following to yourMANPATH
variable:
/opt/SUNWspro/man
For more information about the
PATH
variable, see thecsh
(1),sh
(1), andksh
(1) man pages. For more information about theMANPATH
variable, see theman
(1) man page. For more information about setting yourPATH
andMANPATH
variables to access this release, see the Sun WorkShop 6 Installation Guide or your system administrator.How This Book Is Organized
Chapter 1, "Introduction," briefly describes the features of the compilers.
Chapter 2, "Fortran Input/Output," discusses how to use I/O efficiently.
Chapter 3, "Program Development," demonstrates how program management tools like SCCS,
make
, and Teamware can be helpful.Chapter 4, "Libraries," explains use and creation of software libraries.
Chapter 5, "Program Analysis and Debugging," describes use of
dbx
and other analysis tools.Chapter 6, "Floating-Point Arithmetic," introduces important issues regarding numerical computation accuracy.
Chapter 7, "Porting,"considers porting programs to Sun compilers.
Chapter 8, "Performance Profiling," describes techniques for performance measurement.
Chapter 9, "Performance and Optimization," indicates ways to improve execution performance of Fortran programs.
Chapter 10, "SPARC: Parallelization," explains the multiprocessing features of the compilers.
Chapter 11, "C-Fortran Interface," describes how C and Fortran routines can call each other and pass data.
Typographic Conventions
TABLE P-1 shows the typographic conventions that are used in Sun WorkShop documentation.
- The symbol stands for a blank space where a blank is significant:
36.001- FORTRAN 77 examples appear in tab format, while Fortran 95 examples appear in free format. Examples common to both Fortran 77 and 95 use tab format except where indicated.
- The FORTRAN 77 standard uses an older convention of spelling the name "FORTRAN" capitalized. Sun documentation uses both FORTRAN and Fortran. The current convention is to use lower case: "Fortran 95".
- References to online man pages appear with the topic name and section number. For example, a reference to GETENV will appear as
getenv
(3F), implying that the man command to access this page would be:man
-s
3F
getenv
- System Administrators may install the Sun WorkShop Fortran compilers and supporting material at: <install_point>
/SUNWspro/
where <install_point> is usually/opt
for a standard install. This is the location assumed in this book.Shell Prompts
TABLE P-2 shows the default system prompt and superuser prompt for the C shell, Bourne shell, and Korn shell.
TABLE P-2 Shell Prompts C shell %
Bourne shell and Korn shell $
C shell, Bourne shell, and Korn shell superuser #
Related Documentation
You can access documentation related to the subject matter of this book in the following ways:
- Through the Internet at the
docs.sun.com
sm Web site. You can search for a specific book title or you can browse by subject, document collection, or product at the following Web site:
http://docs.sun.com
- Through the installed Sun WorkShop products on your local system or network. Sun WorkShop 6 HTML documents (manuals, online help, man pages, component readme files, and release notes) are available with your installed Sun WorkShop 6 products. To access the HTML documentation, do one of the following:
- In any Sun WorkShop or Sun WorkShopTM TeamWare window, choose Help About Documentation.
- In your NetscapeTM Communicator 4.0 or compatible version browser, open the following file:
- (Contact your system administrator if your Sun WorkShop software is not installed in the
/opt
directory.) Your browser displays an index of Sun WorkShop 6 HTML documents. To open a document in the index, click the document's title.TABLE P-3 lists related Sun WorkShop 6 manuals by document collection.
TABLE P-4 describes related Solaris documentation available through the
docs.sun.com
Web site.
Sun Microsystems, Inc. Copyright information. All rights reserved. Feedback |
Library | Contents | Previous | Next | Index |