JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.3: Fortran User's Guide     Oracle Solaris Studio 12.3 Information Library
search filter icon
search icon

Document Information

Preface

1.  Introduction

2.  Using Solaris Studio Fortran

2.1 A Quick Start

2.2 Invoking the Compiler

2.2.1 Compile-Link Sequence

2.2.2 Command-Line File Name Conventions

2.2.3 Source Files

2.2.4 Source File Preprocessors

2.2.5 Separate Compiling and Linking

2.2.6 Consistent Compiling and Linking

2.2.7 Unrecognized Command-Line Arguments

2.2.8 Modules

2.3 Directives

2.3.1 General Directives

2.3.1.1 The C Directive

2.3.1.2 The IGNORE_TKR Directive

2.3.1.3 The UNROLL Directive

2.3.1.4 The WEAK Directive

2.3.1.5 The OPT Directive

2.3.1.6 The PIPELOOP[=n] Directive

2.3.1.7 The PREFETCH Directives

2.3.1.8 The ASSUME Directives

2.3.2 Parallelization Directives

2.3.2.1 OpenMP Parallelization Directives

2.3.2.2 Legacy Sun/Cray Parallelization Directives

2.3.3 IVDEP Directive

2.4 Library Interfaces and system.inc

2.5 Compiler Usage Tips

2.5.1 Determining Hardware Platform

2.5.2 Using Environment Variables

2.5.3 Memory Size

2.5.3.1 Swap Space Limits

2.5.3.2 Increasing Swap Space

2.5.3.3 Control of Virtual Memory

2.6 User-Supplied Default Options File

3.  Fortran Compiler Options

4.  Solaris Studio Fortran Features and Extensions

5.  FORTRAN 77 Compatibility: Migrating to Solaris Studio Fortran

A.  Runtime Error Messages

B.  Features Release History

C.  Fortran Directives Summary

Index

2.1 A Quick Start

This section provides a quick overview of how to use the Fortran compiler to compile and run Fortran programs. A full reference to command-line options appears in the next chapter.

The very basic steps to running a Fortran application involve using an editor to create a Fortran source file with a .f, .for, .f90, .f95, .F, .F90, .F95, .f03, or .F03 filename suffix; (see Table Table 2-1), invoking the compiler to produce an executable; and finally, launching the program into execution by typing the name of the file:

Example: This program displays a message on the screen:

demo% cat greetings.f
      PROGRAM GREETINGS
      PRINT *, ’Real programmers write Fortran!’
      END
demo% f95 greetings.f
demo% a.out
 Real programmers write Fortran!
demo%

In this example, f95 compiles source file greetings.f and links the executable program onto the file, a.out, by default. To launch the program, the name of the executable file, a.out, is typed at the command prompt.

Traditionally, UNIX compilers write executable output to the default file called a.out. It can be awkward to have each compilation write to the same file. Moreover, if such a file already exists, it will be overwritten by the next run of the compiler. Instead, use the -o compiler option to explicitly specify the name of the executable output file:

demo% f95 -o greetings greetings.f
demo% greetings
 Real programmers write Fortran!
demo%

In the preceding example, the -o option tells the compiler to write the executable code to the file greetings. (By convention, executable files usually are given the same name as the main source file, but without an extension.)

Alternatively, the default a.out file could be renamed via the mv command after each compilation. Either way, run the program by typing the name of the executable file at a shell prompt.

The next sections of this chapter discuss the conventions used by the f95 commands, compiler source line directives, and other issues concerning the use of these compiler. The next chapter describes the command-line syntax and all the options in detail.