DIGITAL Software Product Description ___________________________________________________________________ PRODUCT NAME: DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.09 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 Fortran/OpenMP V4.0 for DIGITAL UNIX, with full sup- port of the OpenMP Fortran Specification, for use with the DIGI- TAL Fortran V5.1 compiler (decfort90 or decfort). This product is the successor to the DIGITAL KAP Fortran 90 V3.2 product. o DIGITAL KAP for DIGITAL Fortran V3.2 for DIGITAL UNIX, for use with the DIGITAL Fortran 77 compiler (decfort). 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 Optimization Capabilities o Automatic and directed parallel decomposition for SMP o Loop optimizations o Memory management optimizations July 1998 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.09 for DIGITAL UNIX[R] o Scalar optimizations o Function inlining o BLAS recognition 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 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 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/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. DIGITAL KAP Fortran/OpenMP V4.0 will automatically insert OpenMP di- rectives, taking advantage of the DIGITAL Fortran V5.1 support for OpenMP parallel directives. This is the default action and is recom- mended. It is required if the module being processed is to be linked 2 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.09 for DIGITAL UNIX[R] with other modules containing OpenMP directives processed by the com- piler. In addition to the increase in programmer productivity, al- lowing DIGITAL KAP to use its extensive analysis capabilities to in- sert OpenMP directives where possible has the added advantage that DIGITAL KAP can also apply its scalar optimizations to the loops. DIGITAL KAP Fortran/OpenMP can also optionally generate calls to the KAP parallel run time library, which is the default action of the DIGITAL KAP for DIGITAL Fortran V3.2 product. Because a primary objective of the automatic parallel decomposition capability 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 effic- iency by guiding the DIGITAL KAP optimizer in performing automatic parallel decomposition, supplying missing information through the use of directives, assertions, and command line options. This technique is referred 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 DIG- ITAL 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. NOTE: Only one parallel directive syntax may be actively 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 regions. When using DIGITAL KAP Fortran/OpenMP, it may be necessary to specify the directive syntax, since both OpenMP and ANSI X3H5 are supported. Parallel Run Time Environment 3 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.09 for DIGITAL UNIX[R] A program using the DIGITAL KAP parallel run time library (RTL) may be given one or more of the following options at run time by setting environment 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 DIGITAL 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 DIGITAL KAP parallel RTL. 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 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 4 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.09 for DIGITAL UNIX[R] 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 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 5 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.09 for DIGITAL UNIX[R] 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 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: 6 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.09 for DIGITAL UNIX[R] 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 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 DIGITAL KAP Fortran Optimizers support the ANSI Fortran 77 stan- dard syntax. In addition, they accept DIGITAL 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. 7 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.09 for DIGITAL UNIX[R] o Compilation control statements OPTIONS and DICTIONARY. DIGITAL KAP Fortran/OpenMP supports the ANSI Fortran 90 standard syn- tax. In addition, most extensions to ANSI Fortran 90 supported by the DIGITAL 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 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; 8 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.09 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 V4.0-V4.0E systems, the RTL images are designated as: o libkmp_osfp10.a For DIGITAL UNIX V3.2C-V3.2G systems, the RTL images are designated as: o libkmp_osf.a NOTE: If you are using OpenMP directives processed by the DIGITAL For- tran compiler, you should consult the DIGITAL Fortran Software Prod- uct Description (SPD 37.54) for compiler RTL licensing requirements. HARDWARE REQUIREMENTS The DIGITAL KAP Fortran Preprocessors will operate on any AlphaSta- tion or AlphaServer capable of running DIGITAL 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 9 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.09 for DIGITAL UNIX[R] 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 DIGITAL KAP Fortran/OpenMP V4.0 for DIGITAL UNIX: o DIGITAL UNIX Operating System V4.0D (SPD 41.61). o DIGITAL Fortran for DIGITAL UNIX Systems V5.1 (SPD 37.54). o Developers' ToolKit for DIGITAL UNIX V4.0D (SPD 44.36). For DIGITAL KAP for DIGITAL Fortran V3.2 for DIGITAL UNIX: o DIGITAL UNIX Operating System V4.0-V4.0D (SPD 41.61). o DIGITAL Fortran for DIGITAL UNIX Systems V5.0-V5.1 (SPD 37.54). o Developers' ToolKit for DIGITAL UNIX V4.0-V4.0D (SPD 44.36). Note: Version 5.0 and later of DIGITAL Fortran contains both Fortran 77 and Fortran 90 compilers. The DIGITAL KAP kf77 driver uses the DIG- ITAL Fortran 77 compiler (decfort), and the DIGITAL KAP kf90 driver uses the DIGITAL Fortran 90 compiler (decfort90). OPTIONAL SOFTWARE 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. 10 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.09 for DIGITAL UNIX[R] 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 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 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 11 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.09 for DIGITAL UNIX[R] This layered product supports the DIGITAL 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 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 This software is provided by DIGITAL with a conformance warranty in accordance with the DIGITAL warranty terms applicable to the license purchase. The warranty period is 90 days. It begins when the software is in- stalled or thirty days after delivery to the end user, whichever oc- curs first, and expires 90 days later. All warranty related support for this software will end one year after release of the subsequent versions. Warranty is provided in the country of purchase. DIGITAL will provide a service location that will accept reporting (in format prescribed by DIGITAL) of a nonconformance problem caused when using the licensed software under normal conditions as defined by this SPD. DIGITAL will remedy a nonconformance problem in the current unaltered release of the licensed software by issuing a correction information such as: correction documentation; corrected code, or a notice of availability of corrected code; or a restriction or a bypass. The customer will be responsible for the preparation and submission of the problem report to the service location. 12 DIGITAL KAP[TM] Fortran Optimizers SPD 45.72.09 for DIGITAL UNIX[R] WARRANTY EXCLUSION DIGITAL does not warrant that the software licensed to customer shall be error free, that the software shall operate with any hardware and software other than as specified in this SPD, that the software shall satisfy customer's own specific requirements, or that copies of the software other than those provided or authorized by DIGITAL shall con- form to the SPD. DIGITAL makes no warranties with respect to the fitness and operabil- ity of modifications not made by DIGITAL. If the software fails to function for reasons stated above, the cus- tomer's warranty will be invalidated and all service calls will be billable at the prevailing per call rates. 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. ©1998 Digital Equipment Corporation. All Rights Reserved. 13