JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.2: Fortran User's Guide
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

3.  Fortran Compiler Options

4.  Solaris Studio Fortran Features and Differences

5.  FORTRAN 77 Compatibility: Migrating to Solaris Studio Fortran

A.  Runtime Error Messages

B.  Features Release History

C.  Fortran Directives Summary


2.5 Compiler Usage Tips

The next sections suggest a number of ways to use the Fortran compiler efficiently. A complete compiler options reference follows in the next chapter.

2.5.1 Determining Hardware Platform

Some compiler flags allow the user to tune code generation to a specific set of hardware platform options. The compiler’s -dryrun option can be used to determine the native processor:

<sparc>%f95 -dryrun -xtarget=native
###     command line files and options (expanded):
### -dryrun -xarch=sparcvis2 -xcache=64/32/4:1024/64/4 -xchip=ultra3i

<x64>%f95 -dryrun -xtarget=native
###     command line files and options (expanded):
### -dryrun -xarch=sse2a -xcache=64/64/2:1024/64/16 -xchip=opteron

2.5.2 Using Environment Variables

You can specify options by setting the FFLAGS or OPTIONS variables.

Either FFLAGS or OPTIONS can be used explicitly in the command line. When you are using the implicit compilation rules of make, FFLAGS is used automatically by the make program.

Example: Set FFLAGS: (C Shell)

demo% setenv FFLAGS ’-fast -Xlist’

Example: Use FFLAGS explicitly:

demo% f95 $FFLAGS any.f

When using make, if the FFLAGS variable is set as above and the makefile’s compilation rules are implicit, that is, there is no explicit compiler command line, then invoking make will result in a compilation equivalent to:

f95 -fast -Xlist files

make is a very powerful program development tool that can easily be used with all Sun compilers. See the make(1) man page and the Program Development chapter in the Fortran Programming Guide.

Note - Default implicit rules assumed by make may not recognize files with extensions .f95 and .mod (Module files). See the Fortran Programming Guide and the Fortran readme file for details.

2.5.3 Memory Size

A compilation may need to use a lot of memory. This will depend on the optimization level chosen and the size and complexity of the files being compiled. If the optimizer runs out of memory, it tries to recover by retrying the current procedure at a lower level of optimization and resumes subsequent routines at the original level specified in the -On option on the command line.

A processor running the compiler should have at least 64 megabytes of memory; 256 megabytes are recommended. Enough swap space should also be allocated. 200 megabytes is the minimum; 300 megabytes is recommended.

Memory usage depends on the size of each procedure, the level of optimization, the limits set for virtual memory, the size of the disk swap file, and various other parameters.

Compiling a single source file containing many routines could cause the compiler to run out of memory or swap space.

If the compiler runs out of memory, try reducing the level of optimization, or split multiple-routine source files into files with one routine per file, using fsplit(1). Swap Space Limits

The Solaris operating system command, swap -s, displays available swap space. See swap(1M).

Example: Use the swap command:

demo% swap -s
total: 40236k bytes allocated + 7280k reserved = 47516k used, 1058708k available
To determine the actual real memory:
demo% /usr/sbin/dmesg | grep mem
mem = 655360K (0x28000000)
avail mem = 602476544 Increasing Swap Space

Use mkfile(1M) and swap(1M) to increase the size of the swap space on a workstation. You must become superuser to do this. mkfile creates a file of a specific size, and swap -a adds the file to the system swap space:

demo# mkfile -v 90m /home/swapfile
/home/swapfile 94317840 bytes
demo# /usr/sbin/swap -a /home/swapfile Control of Virtual Memory

Compiling very large routines (thousands of lines of code in a single procedure) at optimization level -O3 or higher may require additional memory that could degrade compile-time performance. You can control this by limiting the amount of virtual memory available to a single process.

In a sh shell, use the ulimit command. See sh(1).

Example: Limit virtual memory to 16 Mbytes:

demo$ ulimit -d 16000

In a csh shell, use the limit command. See csh(1).

Example: Limit virtual memory to 16 Mbytes:

demo% limit datasize 16M

Each of these command lines causes the optimizer to try to recover at 16 Mbytes of data space.

This limit cannot be greater than the system’s total available swap space and, in practice, must be small enough to permit normal use of the system while a large compilation is in progress. Be sure that no compilation consumes more than half the space.

Example: With 32 Mbytes of swap space, use the following commands:

In a sh shell:

demo$ ulimit -d 1600

In a csh shell:

demo% limit datasize 16M

The best setting depends on the degree of optimization requested and the amount of real and virtual memory available.

In 64-bit Solaris environments, the soft limit for the size of an application data segment is 2 Gbytes. If your application needs to allocate more space, use the shell’s limit or ulimit command to remove the limit.

For csh use:

demo% limit datasize unlimited

For sh or ksh, use:

demo$ ulimit -d unlimited

See the Solaris 64-bit Developer’s Guide for more information.