COMPAQ Software Product Description ___________________________________________________________________ PRODUCT NAME: Compaq KAP[TM] Fortran Optimizers for Tru64 UNIX[R] SPD 45.72.11 COMPAQ Software Product Description ___________________________________________________________________ PRODUCT NAME: Compaq KAP[TM] Fortran Optimizers SPD 45.72.11 for Tru64 UNIX[R] DESCRIPTION Compaq KAP[TM] Fortran optimizers for Tru64 UNIX[R] are developed by Kuck & Associates, Incorporated (KAI), and are distributed under Com- paq Computer Corporation's Standard Terms and Conditions. This Soft- ware Product Description describes two products: o Compaq KAP Fortran/OpenMP V4.2 for Tru64 UNIX, with full support of the OpenMP Fortran Specification, for use with the Compaq For- tran V5.2 compiler (decfort90 or decfort). This product is the suc- cessor to the Compaq KAP Fortran 90 V3.2 product, and is also rec- ommended to Fortran 77 users as the replacement for the Compaq KAP for Compaq Fortran V3.2 product. o DIGITAL KAP for DIGITAL Fortran V3.2 for DIGITAL UNIX, for use with the DIGITAL Fortran 77 compiler. This product is not being devel- oped and will be retired. Users are encouraged to switch to the Com- paq KAP Fortran/OpenMP product. September 1999 The Compaq KAP Fortran optimizers are FORTRAN-language, source-to-source preprocessors that restructure code for improved performance on se- rial and parallel processors. The Compaq KAP optimizers perform an in- terprocedural dependence analysis (IPA), allowing them to use advanced optimizations safely. When installed, the Compaq KAP optimizers in- tegrate with the Compaq Fortran compiler for seamless operation. Major Optimization Capabilities o Automatic and directed parallel decomposition for SMP o Loop optimizations o Memory management optimizations o Scalar optimizations o Function inlining o BLAS recognition o "Dusty Deck" transformations o Informational program listings Parallel Decomposition Support The Compaq KAP Fortran products provide true shared memory multipro- cessing capabilities for Compaq AlphaServer Symmetric Multiprocess- ing (SMP) systems, providing the ability to do parallel decomposition of Fortran codes using the following techniques: o automatic decomposition o guided automatic decomposition o directed decomposition o combined automatic and directed decomposition When performing automatic parallel decomposition, the Compaq KAP For- tran optimizers will: 1. analyze the code; 2 2. identify the compute intensive loops that are candidates for par- allelization (Compaq KAP Fortran/OpenMP can also parallelize For- tran 90 array operations); 3. determine if the selected loops can be safely executed in paral- lel; 4. transform the code, creating and managing the parallel sections; 5. insert all necessary synchronization points. Compaq KAP Fortran/OpenMP V4.2 will automatically insert OpenMP di- rectives, taking advantage of the support for OpenMP parallel direc- tives in Compaq Fortran V5.1 and later. This is the default action and is recommended. It is required if the module being processed is to be linked with other modules containing OpenMP directives processed by the compiler. In addition to the increase in programmer productivity, allowing the Compaq KAP processor to use its extensive analysis capabilities to au- tomatically insert OpenMP directives where possible has the added ad- vantage that Compaq KAP can also apply its scalar optimizations to the loops. Compaq KAP Fortran/OpenMP can also optionally generate calls to the KAP parallel run time library, which is the default action of the Compaq KAP for Compaq Fortran V3.2 product. Because a primary objective of the automatic parallel decomposition capability is to produce a correct parallel program, the Compaq KAP optimizer will skip loops that cannot be properly analyzed, whether due to lack of information at compile time or to complex program struc- ture. The advanced programmer can often improve parallel efficiency by guiding the Compaq KAP optimizer in performing automatic parallel decomposition, supplying missing information through the use of di- rectives, assertions, and command line options. This technique is re- ferred to as guided automatic decomposition. 3 Directed decomposition requires the programmer to identify parallel regions and loops, insert parallel directives, and manage all neces- sary synchronization. When performing directed decomposition, the Com- paq KAP optimizers only accept a subset of the ANSI X3H5 parallel di- rectives, transforming them into calls to a parallel run time library. Neither product described by this document supports translation of OpenMP directives to RTL calls. It is recommended that users of Compaq KAP Fortran/OpenMP currently using X3H5 directives migrate to the use of OpenMP directives. NOTE: Only one parallel directive syntax may be ac- tively used within a program. It is possible to do mixed decomposition, combining both directed and automatic decomposition within one program. This is done by defining specific parallel regions with directives, and then using the -concurrent option when compiling to automatically parallelize the remaining re- gions. When using Compaq KAP Fortran/OpenMP, it may be necessary to specify the directive syntax, since both OpenMP and ANSI X3H5 are sup- ported. Parallel Run Time Environment A program using the Compaq KAP parallel run time library (RTL) may be given one or more of the following options at run time by setting en- vironment variables: o Set number of threads to use (normally set to number of processors) o Schedule for fastest turnaround or maximum throughput o Allocate additional thread stack For programs using OpenMP directives, consult the Compaq Fortran doc- umentation for run time options. NOTE: Modules using OpenMP directives and processed by the compiler may not be mixed with modules using the Compaq KAP parallel RTL. Loop Optimizations The Compaq KAP Fortran optimizers provide a variety of loop transfor- mations intended to improve execution performance. These include: 4 o Inner loop unrolling o Loop interchange o Loop fusion o Loop splitting o Loop rerolling o Loop distribution o Loop peeling Memory Management Optimizations The Compaq KAP Fortran optimizers perform several optimizations that conserve memory resources and improve data locality. These include: o Outer loop (two-dimensional) unrolling to block data for the cache o COMMON block padding o COMMON block alignment o Storage order specification Function and Subroutine Inlining The Compaq KAP Fortran optimizers can selectively insert both func- tion and subroutine code into the main code stream, a capability re- ferred to as "inlining". Inlining a function allows the Compaq KAP op- timizer to include the function code in its IPA, resulting in a more thorough analysis and optimization. Inlining also eliminates the call overhead and may enable better code scheduling by the compiler. In addition to inlining, the Compaq KAP Fortran optimizers can per- form only the IPA operation on a function or subroutine. When this op- tion is selected, the function or subroutine is temporarily inlined while IPA is performed, and then is removed. The IPA analysis option provides the benefit of an improved interprocedural analysis without the code size expansion that results from inlining. The source of func- tion and subroutine code for inlining or IPA can be a specific set of 5 files, or a special inline library that is built and maintained by the Compaq KAP optimizer. BLAS Recognition The Compaq KAP Fortran optimizers can recognize common linear alge- bra algorithms and substitute function calls to the industry-standard Basic Linear Algebra Subroutines (BLAS). The program can then be linked against a library containing an optimized version of the BLAS, such as the Compaq Extended Math Library. The Compaq KAP optimizers rec- ognize most Level 1, 2, and 3 BLAS. Scalar Optimizations The Compaq KAP Fortran optimizers perform many standard scalar com- piler optimizations, including: o Dead code elimination o Induction variable recognition o Invariant IF restructuring o Reciprocal substitution o Global forward substitution o Lifetime analysis "Dusty Deck" Transformations The Compaq KAP Fortran optimizers transform many obsolete and inef- ficient code structures into more modern structures. These older con- structs often inhibit compiler optimizations and interfere with code scheduling. The Compaq KAP optimizers perform the following transfor- mations: o Convert logical IF-GOTO to block IF o Convert IF branches to DO loop o Convert adjacent IFs to IF-THEN-ELSE 6 o Remove zero-trip IFs from around DO loops Informational Program Listings The Compaq KAP Fortran optimizers optionally provide an informational listing file of the program, outlining the results of its processing. The content of the listing file may be controlled through an option switch. Content options include: o Annotated original program listing o Call tree of entire program o KAP options used for each program unit o Loop optimization table for each program unit o Program unit names inserted in error output as they are processed o Compilation performance statistics o Loop summary table o Transformed program listing In each program listing produced, the following information is sup- plied, if relevant: o Line numbers o DO loop markings o INCLUDE file markings o Footnotes detailing important actions taken or conditions that may require attention, such as data dependences that inhibit parallel decomposition o Syntax Error/Warning messages o Questions generated by the Compaq KAP optimizer o Summary of actions taken by the Compaq KAP optimizer Control of KAP Options 7 The Compaq KAP Fortran products are provided with a set of default op- tion settings. While the default settings make the Compaq KAP prod- ucts easier to use, they may not provide optimal performance for ev- ery program. And since some transformations change the order of com- putation, some numerical differences in results may occur in sensi- tive programs. The Compaq KAP Fortran products provide a large set of command qual- ifiers and in-source directives and assertions that allow the advanced user to customize the applied transformations for a particular appli- cation program. For cases where the application is sensitive to ac- cumulated rounding error, the optimization level may need to be re- duced. Consult the product documentation for advice on using the many options provided. Supported Language Dialects The Compaq KAP Fortran Optimizers support the ANSI Fortran 77 stan- dard syntax. In addition, they accept Compaq Fortran extensions to ANSI Fortran 77, with the following known exceptions: o I/O statement UNLOCK. o Use of quotation mark character (") as delimiter for character con- stants. o Compilation control statements OPTIONS and DICTIONARY. Compaq KAP Fortran/OpenMP supports the ANSI Fortran 90 standard syn- tax. In addition, most extensions to ANSI Fortran 90 supported by the Compaq Fortran 90 compiler are also accepted, with the following known exceptions: o Leading underscore in names. o Multiple SAVEs without arguments. o EQUIVALENCE using sequenced derived types. o COMMON with same name as program. o Underindex of arrays. 8 o The [] form for array constructors. o Linearized array constructor. o Use of '&' in alternate return (fixed form only). o References to RECURSIVE FUNCTION name followed by 0 treated as func- tion call when RESULT is not specified, as long as function is not array valued. o HPF intrinsics, function prefix extensions, and directives. Run-Time Library Distribution The Compaq KAP Fortran product kits include one or more Run-Time Li- braries that are needed to support the execution of certain KAP func- tions. You may copy and distribute royalty-free the Run-Time Libraries (the "RTLs") with your application, provided that you: o distribute the RTLs only in conjunction with and as a part of your application; o include the KAI copyright notice on each copy of the application software media; o do not use the Compaq or KAI name, logo, or trademarks to market your application; o agree to indemnify, hold harmless, and defend both Compaq and KAI from and against any claims or lawsuits, including attorney's fees, that arise or result from the use or distribution of your appli- cation. For this release, the RTL images are designated as: o libkmp_osfp10.a NOTE: If you are using OpenMP directives processed by the Compaq For- tran compiler, you should consult the Compaq Fortran Software Prod- uct Description (SPD 37.54) for compiler RTL licensing requirements. 9 HARDWARE REQUIREMENTS The Compaq KAP Fortran Preprocessors will operate on any AlphaStation or AlphaServer capable of running Tru64 UNIX. Disk Space Requirements Disk space required for installation: Root file system: / 0 KB Other file systems: /usr 15 MB /tmp 16 MB /var 0 MB Disk space required for use (permanent): Root file system: / 0 MB Other file systems: /usr 15 MB /var 0 MB These counts refer to the disk space required on the system disk. The sizes are approximate; actual sizes may vary depending on the user's system environment, configuration, and software options. SOFTWARE REQUIREMENTS For Compaq KAP Fortran/OpenMP V4.2 for Tru64 UNIX: o DIGITAL UNIX Operating System V4.0D-V4.0E or Tru64 UNIX Operating System V4.0F or V5.0 (SPD 41.61). o Compaq Fortran for Tru64 UNIX Systems V5.1-V5.2 (SPD 37.54). o Developers' ToolKit for DIGITAL UNIX V4.0D-V4.0E or Developers' ToolKit for Tru64 UNIX V4.0F or V5.0 (SPD 44.36). For Compaq KAP for Compaq Fortran V3.2 for Tru64 UNIX: o DIGITAL UNIX Operating System V4.0-V4.0D (SPD 41.61). o DIGITAL Fortran for Tru64 UNIX Systems V5.0-V5.1 (SPD 37.54). 10 o Developers' ToolKit for DIGITAL UNIX V4.0-V4.0D (SPD 44.36). Note: Version 5.0 and later of Compaq Fortran contains both Fortran 77 and Fortran 90 compilers. The Compaq KAP kf77 driver uses the Com- paq Fortran 77 compiler (decfort), and the Compaq KAP kf90 driver uses the Compaq Fortran 90 compiler (decfort90). GROWTH CONSIDERATIONS The minimum hardware/software requirements for any future version of this product may be different from the requirements for the current version. YEAR 2000 READY This product is Year 2000 Ready. Year 2000 Ready is defined: "Year 2000 Ready" products are defined by Compaq as products capable of accurately processing, providing, and/or receiving date data from, into and between the twentieth and the twenty- first centuries, and the years 1999 and 2000, including leap year cal- culations, when used in accordance with the associated product doc- umentation and provided that all hardware, firmware and software used in combination with such products properly exchange accurate date data with the products. For additional information visit the DIGITAL Brand area on Compaq's Year 2000 Ready web site located at http://ww1.digital.com/year2000/warranty.asp. To see how this product was tested for Year 2000 Readiness, visit the vendor's web site at http://www.kai.com. 11 DISTRIBUTION MEDIA These products are distributed on the Compaq CD-ROM Software Library for Tru64 UNIX, and are also available as an individual product CD- ROM. The software documentation for these products is available as part of the Tru64 UNIX Online Documentation Library on CD-ROM (QA-054AA-H8). A separate printed documentation set may also be ordered. ORDERING INFORMATION Compaq KAP Fortran/OpenMP: Unlimited Use Software Licenses: QL-4GAA*-** Concurrent Use Software License: QL-4GAAM-3B Software Media/Documentation: QA-4GAAA-H8 Software Documentation: QA-4GAAA-GZ Software Product Services: QT-4GAA*-** DIGITAL KAP for DIGITAL Fortran: Unlimited Use Software Licenses: QL-0HGA*-** Concurrent Use Software License: QL-0HGAM-3B Software Media/Documentation: QA-0HGAA-H8 Software Documentation: QA-0HGAA-GZ Software Product Services: QT-0HGA*-** * Denotes variant fields. For additional information on available li- censes, services, and media, refer to the appropriate price book. SOFTWARE LICENSING This software is furnished under license from Compaq Computer Corpo- ration. Both concurrent use and traditional licenses are available. For more information about Compaq licensing terms and policies, con- tact your local Compaq office or Compaq partner. License Management Facility Support 12 This layered product supports the Tru64 UNIX License Management Fa- cility. License units for this product are allocated on an Unlimited System Use or Concurrent Use basis. For more information on the Tru64 UNIX License Management Facility, refer to the Tru64 UNIX Operating System Software Product Description (SPD 41.61.xx) or documentation. SOFTWARE PRODUCT SERVICES A variety of service options are available from Compaq. For more in- formation, contact your local Compaq office or Compaq partner. SOFTWARE WARRANTY This software is provided by Compaq with a 90 day conformance warranty in accordance with the warranty terms applicable to the license pur- chase. The above information is valid at time of release. Please contact your local Compaq office or Compaq partner for the most up-to-date infor- mation. [R] UNIX is a registered trademark in the United States and other countries licensed exclusively through X/Open Company Limited [R] Compaq, the Compaq Logo, and the DIGITAL logo are registered in the United States Trademark and Patent Office. [TM] KAP and KAI are trademarks of Kuck & Associates, Inc. [TM] DEC, DIGITAL, AlphaStation, AlphaServer, Tru64, and DECthreads are trademarks of Compaq Computer Corporation. © 1997-1999 Digital Equipment Corporation. All rights reserved. 13