DIGITAL Software Product Description ___________________________________________________________________ PRODUCT NAME: DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.08 for DIGITAL UNIX[R] DESCRIPTION DIGITAL KAP[TM] Fortran optimizers for DIGITAL UNIX[R] are developed by Kuck and Associates, Incorporated (KAI), and are distributed un- der Digital Equipment Corporation's Standard Terms and Conditions. This Software Product Description describes two products: o DIGITAL KAP for DIGITAL Fortran V3.2 for DIGITAL UNIX, for use with the DIGITAL Fortran 77 compiler (decfort). o DIGITAL KAP Fortran 90 V3.2 for DIGITAL UNIX, for use with the DIG- ITAL Fortran 90 compiler (decfort90). The DIGITAL KAP Fortran optimizers are FORTRAN-language, source-to- source preprocessors that restructure code for improved performance on serial and parallel processors. The DIGITAL KAP optimizers perform an interprocedural dependence analysis (IPA), allowing them to use ad- vanced optimizations safely. When installed, the DIGITAL KAP optimiz- ers integrate with the DIGITAL Fortran compiler for seamless opera- tion. Major capabilities of the DIGITAL 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 December 1997 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.08 for DIGITAL UNIX[R] o "Dusty Deck" transformations o Informational program listings Parallel Decomposition Support The DIGITAL KAP Fortran products provide true shared memory multipro- cessing capabilities for DIGITAL AlphaServer Symmetric Multiprocess- ing (SMP) systems, providing the ability to do automatic, guided au- tomatic and directed parallel decomposition of Fortran codes. When performing automatic parallel decomposition, the DIGITAL KAP For- tran optimizers will: 1. analyze the code; 2. identify the compute intensive loops that are candidates for par- allelization (DIGITAL KAP Fortran 90 can also parallelize array op- erations); 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 DIGITAL KAP optimizer will skip loops that cannot be properly analyzed, whether due to lack of information at compile time or to complex program structure. The advanced programmer can often improve parallel efficiency by guiding the DIGITAL KAP optimizer in performing automatic parallel decompo- sition, supplying missing information through the use of directives, assertions, and command line options. When performing directed decomposition, the DIGITAL KAP optimizers ac- cept a subset of the ANSI X3H5 parallel directives. Directed decom- position requires the programmer to identify parallel regions and loops and manage all necessary synchronization. DIGITAL KAP scalar optimizations are disabled within parallel regions. It is possible to 2 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.08 for DIGITAL UNIX[R] combine both directed and automatic decomposition within one program by defining specific parallel regions with directives, and then using the -concurrent option when compiling to automatically parallelize the remaining regions. Parallel Run Time Environment DIGITAL KAP optimizers for Fortran 77, Fortran 90, and C all share a common run time environment based on DECthreads. Programs may be com- posed of modules written in one or more of the three languages, and may be parallelized by use of the appropriate DIGITAL 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 DIGITAL KAP Fortran optimizers provide a variety of loop trans- formations 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 3 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.08 for DIGITAL UNIX[R] The DIGITAL 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 DIGITAL 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 DIGITAL 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 DIGITAL 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 function and subroutine code for inlining or IPA can be a specific set of files, or a special inline library that is built and main- tained by the DIGITAL KAP optimizer. BLAS Recognition The DIGITAL 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 DIGITAL Extended Math Library. The DIGITAL KAP optimizers recognize most Level 1, 2, and 3 BLAS. Scalar Optimizations 4 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.08 for DIGITAL UNIX[R] The DIGITAL 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 DIGITAL 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 DIGITAL KAP optimizers perform the following trans- formations: 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 DIGITAL 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 5 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.08 for DIGITAL UNIX[R] 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 DIGITAL KAP optimizer o Summary of actions taken by the DIGITAL KAP optimizer Control of KAP Options The DIGITAL KAP Fortran products are provided with a set of default option settings. While the default settings make the DIGITAL 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 DIGITAL KAP Fortran products provide a large set of command qualifiers and in-source directives and assertions that al- low 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. Consult the product documentation for advice on using the many options provided. Supported Language Dialects 6 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.08 for DIGITAL UNIX[R] DIGITAL KAP for DIGITAL Fortran and DIGITAL KAP Fortran 90 support the ANSI Fortran 77 standard syntax. In addition, they accept DIGITAL For- tran extensions to ANSI Fortran 77, with the following known excep- tions: o I/O statement UNLOCK. o Use of quotation mark character (") as delimiter for character con- stants. o Compilation control statements OPTIONS and DICTIONARY. DIGITAL KAP Fortran 90 supports the ANSI Fortran 90 standard syntax. In addition, most extensions to ANSI Fortran 90 supported by the DIG- ITAL 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. 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 7 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.08 for DIGITAL UNIX[R] The DIGITAL 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 DIGITAL or KAI name, logo, or trademarks to market your application; 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.0D systems, the RTL images are designated as: o libkmp_osfp10.a HARDWARE REQUIREMENTS DIGITAL KAP Fortran Preprocessors will operate on any AlphaStation or AlphaServer capable of running DIGITAL UNIX. 8 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.08 for DIGITAL UNIX[R] Disk Space Requirements Disk space required for installation: 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 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 V4.0-V4.0D (SPD 41.61). o DIGITAL Fortran for DIGITAL UNIX Systems V5.0 (SPD 37.54). o Developers' ToolKit for DIGITAL UNIX V4.0-V4.0D (SPD 44.36) is re- quired. Note: Version 5.0 of DIGITAL Fortran contains both Fortran 77 and For- tran 90 compilers. DIGITAL KAP for DIGITAL Fortran uses the DIGITAL Fortran 77 compiler (decfort), and DIGITAL KAP Fortran 90 uses the DIGITAL Fortran 90 compiler (decfort90). 9 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.08 for DIGITAL UNIX[R] OPTIONAL SOFTWARE o DIGITAL Extended Math Library V3.3A for DIGITAL UNIX (SPD 41.84) o DIGITAL KAP for C V3.2 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. ORDERING INFORMATION 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*-** DIGITAL 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*-** 10 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.08 for DIGITAL UNIX[R] * 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 licensing terms and policies, contact your local DIGITAL office 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. 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. 11 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.08 for DIGITAL UNIX[R] [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