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


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 The C Directive The IGNORE_TKR Directive The UNROLL Directive The WEAK Directive The OPT Directive The PIPELOOP[=n] Directive The PREFETCH Directives The ASSUME Directives

2.3.2 Parallelization Directives OpenMP Parallelization Directives Legacy Sun/Cray Parallelization Directives

2.3.3 IVDEP Directive

2.4 Library Interfaces and

2.5 Compiler Usage Tips

2.5.1 Determining Hardware Platform

2.5.2 Using Environment Variables

2.5.3 Memory Size Swap Space Limits Increasing Swap Space 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


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
      PRINT *, ’Real programmers write Fortran!’
demo% f95 greetings.f
demo% a.out
 Real programmers write Fortran!

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!

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.