KAP Fortran 90 for Digital UNIX
User Guide

Order Number: AA-QMB5C-TE

December 1996

This document provides information about how to run and use KAP Fortran 90 on Digital UNIX systems.

Revision /Update Information This is a revised document.
Operating System and Version: Digital UNIX, Versions 3.2 and 4.0b
Software Version: KAP Fortran 90, Version 3.1

Digital Equipment Corporation
Maynard, Massachusetts


First Printing, October 1995
Revised, December 1996

Possession, use, or copying of the software described in this publication is authorized only pursuant to a valid written license from Digital or an authorized sublicensor.

Digital Equipment Corporation makes no representations that the use of its products in the manner described in this publication will not infringe on existing or future patent rights, nor do the descriptions contained in this publication imply the granting of licenses to make, use, or sell equipment or software in accordance with the description. © Digital Equipment Corporation 1995, 1996. All rights reserved. © Kuck & Associates, Inc. 1995, 1996. All rights reserved.

The following are trademarks of Digital Equipment Corporation: AlphaGeneration, DECthreads, Digital, VAX DOCUMENT, and the DIGITAL logo.

KAP is a trademark of Kuck & Associates, Inc.

UNIX is a registered trademark in the United States and other countries licensed exclusively through X/Open Company Ltd.

All other trademarks and registered trademarks are the property of their respective holders.

This document was produced using SDMLWEB.

Contents

Preface

1 Overview

2 How to Run KAP

2.1 General KAP Information

2.2 Installing KAP

2.3 Compiling a Program Using the kf90 Driver

2.4 Compiling a Program Containing C Preprocessor Directives Using kf90

2.5 Optimized Programs

2.6 KAP Command Switches Determined by Compiler Switches

2.7 Compiling a Program Using kapf90

2.8 Compiling a Program Containing C Preprocessor Directives Using kapf90

2.9 Using KAP Syntax

2.10 Using File Naming Conventions

2.11 Introducing the Five Minute KAP Guide

2.11.1 Optimizing Small Programs with KAP

2.11.2 Optimizing Large Programs with KAP

2.12 Improving and Customizing KAP Performance

2.13 General Optimization Tips

2.14 Using Additional Performance Improvement Techniques

2.15 Correcting KAP Problems

3 KAP Parallel Processing

3.1 Automatic Parallelization Using the kf90 Driver

3.1.1 Parallel Processing Options

3.2 Directed Parallelization Using the kf90 Driver and PCF Directives

3.2.1 PCF Directive Syntax and Lexical Rules

3.2.2 PARALLEL REGION Directive

3.2.3 PARALLEL DO Directive

3.2.4 DO Loop Example with PCF Directives

3.2.5 Program Example with PCF Directives

3.2.6 CRITICAL SECTION Directive

3.2.7 ONE PROCESSOR SECTION Direcitve

3.2.8 Comparison of KAP PCF and Cray Autotasking Directives

3.3 Combined Automatic and Directed Parallelization Using the kf90 Driver

3.4 Compiling a Program for Parallel Execution Using kapf90

3.5 Building Applications with the DECthreads Archive Library on Digital UNIX Versions 4.0 and Higher

3.6 Running a Parallel Program

3.7 Parallel Run-Time Support Library Routines

3.8 Correcting KAP Parallel Processing Problems

3.9 Parallel Programming Tips

4 KAP and Fortran 90 Constructs

4.1 Arrays

4.2 MODULE Variables

4.3 MODULE Parameters

4.4 MODULE Procedures

4.5 Generic Fortran 90 Interfaces

4.6 Internal Procedures

4.7 Host-Associated Variables

4.8 Derived Types

4.9 Deferred Shape Objects

4.10 Intrinsics

4.11 Input/Output

5 Command Switches

5.1 General Optimization Switches

5.1.1 -interchange, -nointerchange, (-interchange)

5.1.2 -namepartitioning, -namepart, -nnamepart, (-nonamepartitioning)

5.1.3 -optimize, -o, (-optimize=5)

5.1.4 -roundoff, -r, (-roundoff=3)

5.1.5 -scalaropt, -so, (-scalaropt=3)

5.1.6 -skip, -sk, -nsk, (-noskip)

5.1.7 -tune, -tune, (-tune=host)

5.2 Parallel Processing Switches

5.2.1 -concurrentize, -conc, -noconc, (-noconcurrentize)

5.2.2 -minconcurrent, -mc, (-minconcurrent=1000)

5.2.3 -parallelio, -nopio, -pio, (-noparallelio)

5.3 Fortran Dialect Switches

5.3.1 -assume, -a, (-assume=cel), -noassume, -na

5.3.2 -datasave, -ds, (-datasave), -nodatasave, -nds

5.3.3 -dlines, -dl, (-nodlines), -ndl

5.3.4 -escape, -noescape, (-escape)

5.3.5 -freeformat, -ff, (-nofreeformat)

5.3.6 -integer, -int, (-integer=4)

5.3.7 -intlog, (-intlog)

5.3.8 -kind, (-kind), (-kind=4)

5.3.9 -logical, -log, (-logical=4)

5.3.10 -natural, -nat, -nonatural

5.3.11 -onetrip, 1, (-noonetrip), -n1

5.3.12 -real, -rl, (-real=4)

5.3.13 -save, -sv, (-save=manual_adjust)

5.3.14 -scan, (-scan=72)

5.3.15 -syntax, -sy, (off)

5.3.16 -type, -ty, (-notype), -nty

5.4 Inlining and Interprocedural Analysis Switches

5.4.1 -inline, -inl, (off) -noinline, -ninl, -ipa, -ipa, (off), -noipa, -nipa

5.4.2 -inline_and_copy, -inlc, (off)

5.4.3 -inline_create, -incr, (off), -ipa_create, -ipacr, (off)

5.4.4 -inline_depth, -ind, (-inline_depth=2), -ipa_depth, -ipad, (-ipa_depth=2)

5.4.5 -inline_from_files, -inff, (current source file)

5.4.6 -inline_from_libraries, -infl, (off)

5.4.7 -ipa_from_files, -ipaff, (current source file)

5.4.8 -ipa_from_libraries, -ipafl, (off)

5.4.9 -inline_looplevel, -inll, (-inline_looplevel=2), -ipa_looplevel, -ipall, (-ipa_looplevel=2)

5.4.10 -inline_manual, -inm, (off), -ipa_manual, -ipam, (off)

5.4.11 -inline_optimize, (-inline_optimize=0), -ipa_optimize, (-ipa_optimize=0)

5.5 Advanced Optimization Control

5.5.1 -aggressive, -ag, (-noaggressive), -nag

5.5.2 -arclimit, -arclm, (-arclimit=5000)

5.5.3 -cacheline, -chl, (-cacheline=32,32)

5.5.4 -cache_prefetch_line_count, -cplc, (-cplc=0)

5.5.5 -cachesize, -chs, (-cachesize=8,0)

5.5.6 -dpregisters, -dpr, (-dpregisters=32)

5.5.7 -each_invariant_if_growth, -eiifg, (-eiifg=20)

5.5.8 -fpregisters, -fpr, (-fpregisters=32)

5.5.9 -fuse, -nfuse, (-nofuse)

5.5.10 -fuselevel, -fuselevel=1, (-fuselevel=0)

5.5.11 -generateh

5.5.12 -hdir, -hd, (-hdir=current_directory)

5.5.13 -heaplimit, -heap, (-heaplimit=100)

5.5.14 -hoist_loop_invariants, -hli, (-hoist_loop_invariants=1)

5.5.15 -interleave, -intl, (-interleave)

5.5.16 -library_calls, -lc, (off)

5.5.17 -limit, -lm, (-limit=10)

5.5.18 -machine, -ma, -noma, (machine=s)

5.5.19 -max_invariant_if_growth, -miifg, (-miifg=500)

5.5.20 -routine, -rt, -nrt, (-noroutine)

5.5.21 -setassociativity, -sasc, (-setassociativity=1)

5.5.22 -srlcd, -nsrlcd, (-nosrlcd)

5.5.23 -unroll, -ur, (unroll=4), -unroll2, -ur2, (-unroll2=160), -unroll3, -ur3, (-unroll3=1)

5.5.24 -useh

5.6 Directive Recognition Switches

5.6.1 -directives, -dr, (-directives=akpv), -nodirectives, -ndr

5.6.2 -ignoreoptions, -ig, (-noignoreoptions), -nig

5.7 Input-Output Switches

5.7.1 -cmp, (<file>.cmp.f90), (<file>.cmp.f), -nocmp, -ncmp

5.7.2 -fortran, -f, (<file>.cmp.f90), (<file>.cmp.f), -nofortran, -nf

5.7.3 -include, -inc, (-noinclude), ninc

5.7.4 -list, -l, (<file>.out), -nolist, -nl

5.8 Listing Switches

5.8.1 -cmpoptions, -cp, -cmpoptions=n, (-nocmpoptions), -ncp

5.8.2 -lines, -ln, (-lines=55)

5.8.3 -listingwidth, -lw, (-listingwidth=132)

5.8.4 -listoptions, -lo, (-listoptions=o)

5.8.5 -suppress, -su, (off)

5.9 !*$* options

6 Directives

6.1 Directive Usage and Syntax

6.2 KAP Directives

6.3 General Optimization Directives

6.3.1 !*$* arclimit (0-5000)

6.3.2 !*$* beginblock <directive block> !*$* endblock

6.3.3 !*$* each_invariant_if_growth (0-100)

6.3.4 !*$* limit (> 0)

6.3.5 !*$* max_invariant_if_growth (0-1000)

6.3.6 !*$* optimize (0-5)

6.3.7 !*$* roundoff (0-3)

6.3.8 !*$* scalar optimize (0-3 )

6.3.9 !*$* unroll( <#it>[,<weight>])

6.4 Parallel Processing Directives

6.4.1 !*$* [no]concurrentize

6.4.2 !*$* minconcurrent (0-999999)

6.5 Inlining and IPA

6.5.1 !*$* [no]inline [here|routine|global] [(name [,name...])]

6.5.2 !*$* [no]ipa [here|routine|global] [(name [,name...])]

6.6 Assertions

6.6.1 !*$* [no]assertions

6.7 Memory Management

6.7.1 !*$* padding (var-list)

6.7.2 !*$* storage order (var-list)

7 Assertions

7.1 KAP Assertions

7.2 Descriptions

7.2.1 !*$* assert [no]argument aliasing

7.2.2 !*$* assert [no]bounds violations

7.2.3 !*$* assert [no]equivalence hazard

7.2.4 !*$* assert [no]last value needed

7.2.5 !*$* assert permutation

7.2.6 !*$* assert no recurrence

7.2.7 !*$* assert relation ( <name> .XX. <variable/constant>)

7.2.8 !*$* assert no sync

7.2.9 !*$* assert [no] temporaries for constant arguments

7.3 Parallel Processing Assertions

7.3.1 !*$* assert concurrent call

7.3.2 !*$* assert do (concurrent)

7.3.3 !*$* assert do (concurrent call)

7.3.4 !*$* assert do (serial)

7.3.5 !*$* assert do prefer (concurrent)

7.3.6 !*$* assert do prefer (serial)

8 Inlining and IPA

8.1 Inlining and IPA Command Switches

8.1.1 inline_from/ipa_from Switches

8.1.2 Library Creation

8.1.3 Naming Specific Routines

8.1.4 DO Loop Level

8.1.5 Recursive Inlining

8.1.6 Manual Control

8.2 Inlining and IPA Directives

8.3 Listing File Support

8.3.1 -Listoptions=c

8.4 Inlining/IPA Examples

8.4.1 Inlining Example - Same Source File

8.4.2 Inlining Example with a Library

8.4.3 IPA Example

8.4.4 Recursive Inlining Examples

8.4.5 Manual Inlining Example

8.4.6 Notes on Inlining and IPA

8.5 Conditions Inhibiting Inlining/IPA

9 Transformations

9.1 Memory Management

9.1.1 Command Switches

9.1.2 Memory Management Tactics

9.2 Serial Optimizations

9.2.1 Dead-Code Elimination

9.2.2 Induction Variable Recognition

9.2.3 Global Forward Substitution

9.2.4 Loop Peeling

9.2.5 Lifetime Analysis

9.2.6 Invariant-IF Restructuring

9.2.7 Reciprocal Substitution

9.3 Scalar (Dusty-Deck) IF Transformations

9.3.1 IF to Block IF

9.3.2 IF to DO Loop

9.3.3 Semantic IF Merging

9.3.4 Zero-Trip IF Removal

9.4 Loop Unrolling

9.5 Loop Rerolling

10 KAP Listing File

10.1 Listing Switches

10.1.1 Original Program Listing (O)

10.1.2 Calling Tree (C)

10.1.3 KAP Switches (K)

10.1.4 Loop Table (L)

10.1.5 Name (N)

10.1.6 Compilation Performance Statistics (P)

10.1.7 Summary Table (S)

10.1.8 Transformed Program Listing (T)

10.2 Listing Information

10.2.1 Line Numbers

10.2.2 DO Loop Markings

10.2.3 INCLUDE File Markings

10.2.4 Footnotes

10.2.5 Syntax Error/Warning Messages

10.2.6 Questions Generated by KAP

10.2.7 Action Summary

10.3 Loop Table Messages

10.4 KAP Listing Messages

A Digital Fortran Extensions Supported by KAP Fortran 90

B Data Dependence Analysis

B.1 Data Dependence Definitions

B.2 Varieties of Data Dependence

B.3 Input and Output Sets

B.4 Data Dependence Relations

B.5 Data Dependence Direction Vectors

B.6 Loop-Carried Dependence

B.7 Data Dependence Examples

C Listing File Messages

C.1 Classes of Messages

C.2 Messages

C.2.1 Data Dependence (DD)

C.2.2 Error (E)

C.2.3 Extension (EX)

C.2.4 Inlining/IPA (INL)

C.2.5 Informational (INF)

C.2.6 Inserted (I)

C.2.7 Loop Reordering (LR)

C.2.8 Warning (MIS)

C.2.9 Option Error (OW)

C.2.10 Not Optimized (NO)

C.2.11 Output Translation (OT)

C.2.12 Output Trans Fails (OTF)

C.2.13 Program Too Large (NO)

C.2.14 Question (Q)

C.2.15 Scalar Optimization (SO)

C.2.16 Standardized (STD)

C.2.17 Translator Error (TE)

C.2.18 Vector Enhanced (VE)

C.2.19 Warning (W)

D KAP and Incorrect Programs

Index

Tables

2-1 kf90 Assumed Source Format Based on Switch Settings and File Extensions

2-2 User Actions for Specific Goals

3-1 Comparison of KAP PCF and Cray Autotasking Directives

5-1 Command-Line Switches

6-1 KAP Directives

7-1 KAP Assertions

A-1 Digital Fortran Extensions Supported by KAP Fortran 90


(no previous page) | Next Page | Contents | Index |
Command Line Switches