DIGITAL Software Product Description ___________________________________________________________________ PRODUCT NAME: KAP[TM] Fortran Optimizers SPD 45.72.07 for Digital UNIX[R] DESCRIPTION Digital's KAP[TM] Fortran optimizers for Digital UNIX[R] are devel- oped by Kuck and Associates, Incorporated (KAI), and are distributed under Digital Equipment Corporation's Standard Terms and Conditions. This Software Product Description describes two products: o KAP for DEC Fortran V3.1 for Digital UNIX, for use with the Dig- ital Fortran 77 compiler o KAP Fortran 90 V3.1 for Digital UNIX, for use with the Digital For- tran 90 compiler The KAP Fortran optimizers are FORTRAN-language, source-to-source pre- processors that restructure code for improved performance on serial and parallel processors. The KAP optimizers perform an interprocedu- ral dependence analysis (IPA), allowing them to use advanced optimiza- tions safely. When installed, the KAP optimizers integrate with the Digital Fortran compiler for seamless operation. Major capabilities of the KAP Fortran optimizers include: o Automatic and directed parallel decomposition for SMP o Loop optimizations o Memory management optimizations o Scalar optimizations o Function inlining o BLAS recognition January 1997 KAP[TM] Fortran Optimizers SPD 45.72.07 for Digital UNIX[R] o "Dusty Deck" transformations o Informational program listings Parallel Decomposition Support The KAP Fortran products provide true shared memory multiprocessing capabilities for Digital's AlphaServer Symmetric Multiprocessing (SMP) systems, providing the ability to do automatic, guided automatic and directed parallel decomposition of Fortran codes. When performing automatic parallel decomposition, the KAP Fortran op- timizers will: 1. analyze the code; 2. identify the compute intensive loops that are candidates for par- allelization (KAP Fortran 90 can also parallelize array oper- ations); 3. determine if the selected loops can be safely executed in paral- lel; 4. transform the code, creating and managing the parallel threads; 5. insert all necessary synchronization points. Because a primary objective of the automatic parallel decomposition is to produce a correct parallel program, the KAP optimizer will skip loops that cannot be properly analyzed, whether due to lack of infor- mation at compile time or to complex program structure. The advanced programmer can often improve parallel efficiency by guiding KAP in performing automatic parallel decomposition, supplying missing infor- mation through the use of directives, assertions, and command line op- tions. When performing directed decomposition, the KAP optimizers accept a subset of the ANSI X3H5 parallel directives. Directed decomposition requires the programmer to identify parallel regions and loops and manage all necessary synchronization. KAP scalar optimizations are disabled within parallel regions. It is possible to combine both di- rected and automatic decomposition within one program by defining 2 KAP[TM] Fortran Optimizers SPD 45.72.07 for Digital UNIX[R] specific parallel regions with directives, and then using the -concurrent option when compiling to automatically parallelize the remaining regions. Parallel Run Time Environment Digital's KAP optimizers for Fortran 77, Fortran 90, and C all share a common run time environment based on DECthreads. Programs may be composed of modules written in one or more of the three languages, and may be parallelized by use of the appropriate KAP optimizers. A program processed with a Digital KAP optimizer may be given one or more of the following options at run time by setting environment vari- ables: 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 Loop Optimizations The KAP Fortran optimizers provide a variety of loop transformations 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 Memory Management Optimizations The 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 3 KAP[TM] Fortran Optimizers SPD 45.72.07 for Digital UNIX[R] o COMMON block padding o COMMON block alignment o Storage order specification Function and Subroutine Inlining The KAP Fortran optimizers can selectively insert both function and subroutine code into the main code stream, a capability referred to as "inlining". Inlining a function allows the 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 KAP Fortran optimizers can perform only the IPA operation on a function or subroutine. When this option is se- lected, 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 function 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 KAP optimizer. BLAS Recognition The KAP Fortran optimizers can recognize common linear algebra algo- rithms 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 Digital Extended Math Library. The KAP optimizers recognize most Level 1, 2, and 3 BLAS. Scalar Optimizations The KAP Fortran optimizers perform many standard scalar compiler op- timizations, including: o Dead code elimination o Induction variable recognition 4 KAP[TM] Fortran Optimizers SPD 45.72.07 for Digital UNIX[R] o Invariant IF restructuring o Reciprocal substitution o Global forward substitution o Lifetime analysis "Dusty Deck" Transformations The KAP Fortran optimizers transform many obsolete and inefficient code structures into more modern structures. These older constructs often inhibit compiler optimizations and interfere with code sched- uling. The KAP optimizers perform the following transformations: 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 KAP Fortran optimizers optionally provide an informational list- ing 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 5 KAP[TM] Fortran Optimizers SPD 45.72.07 for Digital UNIX[R] 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 KAP optimizer o Summary of actions taken by the KAP optimizer Control of KAP Options The KAP Fortran products are provided with a set of default option settings. While the default settings make the KAP products easier to use, they may not provide optimal performance for every program. And since some transformations change the order of computation, some nu- merical differences in results may occur in sensitive programs. The KAP Fortran products provide a large set of command qualifiers and in- source directives and assertions that allow the advanced user to cus- tomize the applied transformations for a particular application prog- ram. 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. Supported Language Dialects KAP for DEC Fortran and KAP Fortran 90 support the ANSI Fortran 77 standard syntax. In addition, they accept DEC 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. 6 KAP[TM] Fortran Optimizers SPD 45.72.07 for Digital UNIX[R] o Compilation control statements OPTIONS and DICTIONARY. KAP Fortran 90 supports the ANSI Fortran 90 standard syntax. In ad- dition, most extensions to ANSI Fortran 90 supported by the DEC For- tran 90 compiler are also accepted, with the following known excep- tions: 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 function 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 KAP Fortran product kits include 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 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 KAI's copyright notice on each copy of the application software media; o do not use Digital's or KAI's name, logo, or trademarks to market your application; 7 KAP[TM] Fortran Optimizers SPD 45.72.07 for Digital UNIX[R] o agree to indemnify, hold harmless, and defend both Digital 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 Digital UNIX V3.2C-V3.2G systems, the RTL images are designated as: o libkmp_osf.a For Digital UNIX V4.0-V4.0B systems, the RTL images are designated as: o libkmp_osfp10.a HARDWARE REQUIREMENTS Digital's KAP Fortran Preprocessors will operate on any AlphaStation or AlphaServer capable of running Digital UNIX. Disk Space Requirements Disk space required for installation: KAP for DEC Fortran: Root file system: / 0 KB Other file systems: /usr 10,000 KB /tmp 11 KB /var 0 KB Disk space required for use (permanent): Root file system: / 0 KB Other file systems: /usr 10,000 KB /var 0 KB KAP Fortran 90: Root file system: / 0 KB 8 KAP[TM] Fortran Optimizers SPD 45.72.07 for Digital UNIX[R] Other file systems: /usr 10,000 KB /tmp 12 KB /var 0 KB Disk space required for use (permanent): Root file system: / 0 KB Other file systems: /usr 10,000 KB /var 0 KB 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 Digital UNIX Operating System V3.2C-V3.2G or V4.0-V4.0B (SPD 41.61). o With Digital UNIX V3.2C-V3.2G, Digital Fortran V4.0-V4.1 for Dig- ital UNIX Systems (SPD 37.54) is required. With Digital UNIX V4.0- V4.0B, Digital Fortran V4.1 for Digital UNIX Systems (SPD 37.54) is required. o For Digital UNIX V3.2C-V3.2G, one of the following is required: o Digital UNIX Developers' ToolKit V3.2C-V3.2G (SPD 44.36) OR o Digital UNIX Developers' Extension V3.2C-V3.2G (SPD 44.36). o For Digital UNIX V4.0-V4.0B, Developers' ToolKit for Digital UNIX V4.0-V4.0B (SPD 44.36). Note: Versions 4.0-4.1 of Digital Fortran contain both Fortran 77 and Fortran 90 compilers. KAP for DEC Fortran uses the Digital Fortran 77 compiler, and KAP Fortran 90 uses the Digital Fortran 90 compiler. 9 KAP[TM] Fortran Optimizers SPD 45.72.07 for Digital UNIX[R] Note: When KAP for DEC Fortran V3.1 or KAP Fortran 90 V3.1 is in- stalled on Digital UNIX V4.0-V4.0B, the executable images produced will execute only on versions 4.0-4.0B of Digital UNIX. When KAP for DEC Fortran V3.1 or KAP Fortran 90 V3.1 is installed on Digital UNIX V3.2C-V3.2G, the executable images produced will execute on versions V3.2C-V3.2G of Digital UNIX and will also execute on versions V4.0- V4.0B of Digital UNIX, although a small performance difference may be experienced. This forward compatibility to Digital UNIX V4.0 and later versions is dependent on support in Digital UNIX that will be deleted in the next major release of Digital UNIX. See the Digital UNIX Software Product Description (SPD 41.61) for details and lim- itations. OPTIONAL SOFTWARE o Digital Extended Math Library V3.3 for Digital UNIX (SPD 41.84) o KAP for C V3.1 for Digital UNIX (SPD 45.73) GROWTH CONSIDERATIONS The minimum hardware/software requirements for any future version of this product may be different from the requirements for the current version. DISTRIBUTION MEDIA These products are distributed on the Digital CD-ROM Software Library for Digital UNIX, and are also available as an individual product CD- ROM. The software documentation for these products is available as part of the Digital UNIX Online Documentation Library on CD-ROM (QA-054AA-H8). A separate printed documentation set may also be ordered. 10 KAP[TM] Fortran Optimizers SPD 45.72.07 for Digital UNIX[R] ORDERING INFORMATION KAP For DEC 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*-** KAP Fortran 90: 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*-** * 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 only under a license. Both concurrent use and traditional licenses are available. For more information about Digital's licensing terms and policies, contact your local Digital of- fice or Digital partner. License Management Facility Support This layered product supports the Digital UNIX License Management Fa- cility. License units for this product are allocated on an Unlimited System Use basis. For more information on the Digital UNIX License Management Facility, refer to the Digital UNIX Operating System Software Product Descrip- tion (SPD 41.61.xx) or documentation. 11 KAP[TM] Fortran Optimizers SPD 45.72.07 for Digital UNIX[R] SOFTWARE PRODUCT SERVICES A variety of service options are available from Digital. For more in- formation, contact your local Digital office or Digital partner. SOFTWARE WARRANTY Warranty for this software product is provided by Digital with the purchase of a license for the product as defined in the Software War- ranty Addendum of this SPD. The above information is valid at time of release. Please contact your local Digital office or Digital partner for the most up-to-date in- formation. [R] UNIX is a registered trademark in the United States and other countries licensed exclusively through X/Open Company Limited [TM] KAP is a trademark of Kuck and Associates, Inc. [TM] The DIGITAL Logo, DEC, DECthreads, Digital Fortran, and Digi- tal are trademarks of Digital Equipment Corporation. ©1997 Digital Equipment Corporation. All Rights Reserved. 12