COMPAQ Software Product Description ___________________________________________________________________ PRODUCT NAME: Compaq KAP[TM] Fortran/OpenMP V4.4 for Tru64 UNIX[R] SPD 45.72.13 COMPAQ Software Product Description ___________________________________________________________________ PRODUCT NAME: Compaq KAP[TM] Fortran/OpenMP V4.4 SPD 45.72.13 for Tru64 UNIX[R] DESCRIPTION The Compaq KAP[TM] Fortran/OpenMP optimizer is a Fortran-language, source- to-source preprocessor that restructures code for improved performance on serial and parallel processors. The Compaq KAP Fortran/OpenMP op- timizer performs an interprocedural dependence analysis (IPA), allow- ing it to use advanced optimizations safely. When installed, the Com- paq KAP optimizer integrates with the Compaq Fortran compiler for seam- less operation. Compaq KAP Fortran/OpenMP V4.4 for Tru64 UNIX, with full support of the OpenMP Fortran Specification, is used with the Compaq Fortran com- piler (decfort90 or decfort). This product is the successor to the Com- paq KAP Fortran 90 V3.2 product, and is also recommended to Fortran 77 users as the replacement for the Compaq KAP for Compaq Fortran V3.2 product. Compaq KAP Fortran/OpenMP for Tru64UNIX[R] is developed by KAI Soft- ware, a Division of Intel Americas (KAI), and is distributed under Com- paq Computer Corporation's Standard Terms and Conditions. June 2001 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 Compaq KAP Fortran/OpenMP provides true shared memory multiprocess- ing capabilities for Compaq AlphaServer Symmetric Multiprocessing (SMP) systems, providing the ability to do parallel decomposition of For- tran 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/OpenMP optimizer will: 1. analyze the code; 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; 2 5. insert all necessary synchronization points. Compaq KAP Fortran/OpenMP V4.4 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. 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. 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. 3 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: o Inner loop unrolling o Loop interchange o Loop fusion o Loop splitting o Loop rerolling o Loop distribution o Loop peeling 4 Memory Management Optimizations The Compaq KAP Fortran/OpenMP optimizer performs several optimizations that conserve memory resources and improve data locality. These in- clude: 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 optimizer can selectively insert both function and subroutine code into the main code stream, a capability referred to as "inlining". Inlining a function allows the Compaq KAP optimizer 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 optimizer can perform only the IPA operation on a function or subroutine. When this option is selected, the function or subroutine is temporarily inlined while IPA is performed, and then is removed. The IPA analysis option pro- vides 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 files, or a special inline library that is built and maintained by the Compaq KAP optimizer. BLAS Recognition The Compaq KAP Fortran optimizer can recognize common linear algebra algorithms and substitute function calls to the industry-standard Ba- sic 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 optimizer recog- nizes most Level 1, 2, and 3 BLAS. 5 Scalar Optimizations The Compaq KAP Fortran optimizer performs 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 optimizer transforms 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 optimizer performs 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 o Remove zero-trip IFs from around DO loops Informational Program Listings The Compaq KAP Fortran optimizer optionally provides 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 6 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 Compaq KAP Fortran/OpenMP is provided with a set of default option set- tings. While the default settings make the Compaq KAP product easier to use, they may not provide optimal performance for every program. And since some transformations change the order of computation, some numerical differences in results may occur in sensitive programs. Compaq KAP Fortran/OpenMP provides a large set of command qualifiers and in-source directives and assertions that allow the advanced user to customize the applied transformations for a particular application program. For cases where the application is sensitive to accumulated rounding error, the optimization level may need to be reduced. Con- sult the product documentation for advice on using the many options provided. 7 Supported Language Dialects The Compaq KAP Fortran/OpenMP optimizer supports the ANSI Fortran 77 standard 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 and Fortran 95 standard syntax. In addition, most extensions to ANSI Fortran 90 and Fortran 95 supported by the Compaq Fortran 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. 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 8 The Compaq KAP Fortran/OpenMP product kit includes one or more Run- Time Libraries that are needed to support the execution of certain KAP functions. You may copy and distribute royalty-free the Run-Time Li- braries (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. HARDWARE REQUIREMENTS The Compaq KAP Fortran Preprocessor will operate on any AlphaStation or AlphaServer capable of running Tru64 UNIX. 9 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 o Compaq Tru64 UNIX Operating System V4.0D-V4.0G or V5.0-V5.1 (SPD 41.61). o Compaq Fortran for Tru64 UNIX Systems V5.1-V5.4 (SPD 37.54). o Developers' ToolKit for Tru64 UNIX V4.0D-V4.0G or V5.0-V5.1 (SPD 44.36). GROWTH CONSIDERATIONS The minimum hardware/software requirements for any future version of this product may be different from the requirements for the current version. 10 DISTRIBUTION MEDIA This product is distributed on the Compaq CD-ROM Software Library for Tru64 UNIX, and is also available as an individual product CD-ROM. The software documentation for this product 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 for Tru64 UNIX Unlimited Use Software QL-4GAA*-** Licenses: Concurrent Use Software QL-4GAAM-3B License: Software Media/Documentation:QA-4GAAA-H8 Software Documentation: QA-4GAAA-GZ Software Product Ser- QT-4GAA*-** vices: * 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 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. 11 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] Compaq and the Compaq Logo are registered in the United States Trademark and Patent Office. [TM] AlphaStation, AlphaServer, Tru64, and DECthreads are trade- marks of Compaq Information Technologies Group, L.P. in the United States and other countries. [R] UNIX is a registered trademark of the Open Group in the United States and other countries. [TM] KAP and KAI are trademarks of Intel Corporation. All other product names mentioned herein may be trademarks or regis- tered trademarks of their respective companies. Confidential computer software. Valid license from Compaq or autho- rized sublicensor required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Soft- ware Documentation, and Technical Data for Commercial Items are li- censed to the U.S. Government under vendor's standard commercial li- cense. 12 Compaq shall not be liable for technical or editorial errors or omis- sions contained herein. The information in this document is provided "as is" without warranty of any kind and is subject to change with- out notice. The warranties for Compaq products are set forth in the express limited warranty statements accompanying such products. Noth- ing herein should be construed as constituting an additional warranty. ©2001 Compaq Computer Corporation 13