CM FORTRAN LANGUAGE REFERENCE MANUAL Version 2.1, January 1994 Copyright (c) 1989-1994 Thinking Machines Corporation. ABOUT THIS MANUAL ***************** Objectives ---------- This manual defines the CM Fortran language, including the compiler directives. Intended Audience ----------------- Readers of this manual will find previous programming experience with FORTRAN 77 helpful but not essential. Reference to either the FORTRAN 77 standard or the Fortran 90 standard is not required. Organization of This Manual --------------------------- Chapter 1 introduces the language CM Fortran and the data parallel execution model. Chapters 2 through 17 define the language, with Chapter 17 defining the intrinsic functions provided by CM Fortran. These include all the intrinsic functions of Fortran 77 and many of the intrinsic functions of Fortran 90 that deal with arrays. Chapter 18 covers some of the implementation-dependent aspects of array homes and argument passing in CM Fortran. Appendix A describes compiler directives and their effect on the execution of programs. Revision Information -------------------- This version supersedes the CM Fortran Reference Manual Version 2.0 Beta, December 1992. The changes since the previous version of this manual are: o The 64-bit integer type (supported only on CM-5 systems with vector units) (Section 4.2.1) o The Fortran 90 KIND mechanism supporting different lengths ("kinds") of numeric types o The keyword KIND for use in type specifications (Section 5.3) o The type*length syntax for use in type specifications (Section 5.3) o Kind type parameters that evaluate to supported lengths (Section 5.3) o Syntax for indicating the kind type of literal constants (Section 5.3.2) o The intrinsic inquiry function KIND (Chapter 17) o Enhancement of the functions INT and NINT to support integer kind types (Chapter 17) o Enhancement of the functions POPCNT, POPPAR, and LEADZ to support integer kind types (Chapter 17) o Partial implementation of Fortran 90 array pointers o The attribute POINTER (Section 5.4.7) o The specification statement POINTER (Section 5.5.6) o Enhancement of the statements ALLOCATE and DEALLOCATE to support array pointers (Sections 6.3 and 6.4) o The intrinsic inquiry function ASSOCIATED (Chapter 17) o Restrictions on dummy array arguments that are declared as array pointers (Section 12.6.3.3) o Enhancement of I/O statements o The Fortran 90 keywords POSITION, ACTION, DELIM, and PAD to the OPEN and INQUIRE statements (Chapter 14) o The keyword PHYSICAL to the READ and WRITE statements (Section 14.2.4) o Enhancement of LAYOUT directive o The :BLOCK=:PROCS= axis specification (Appendix A) o The :BLOCK=:PDESC= axis specification (Appendix A) o Restriction removed o CM arrays in COMMON need not be declared in the main program unit unless used there Notation Conventions for Syntax Rules ------------------------------------- Syntax rules are used to describe the valid forms that lexical tokens, statements, and constructs may take. These syntax rules are expressed using a variation of Backus-Naur form (BNF) in which: o Roman characters from the CM Fortran character set that form part of a syntactic construct are to be written as they appear, except where noted otherwise. For example, PROGRAM represents the seven characters specified, in that order. o Lowercase italic letters and words (often hyphenated and abbreviated) represent general syntactic classes for which specific syntactic entities must be substituted in actual statements or constructs. o A syntactic class can be defined as a sequence of classes or constructs using a rule definition of the form A category is a: Rm-n item1 item2 item3 item4 where category is a symbolic name for the class, and the items can be characters from the character set, syntactic constructs, or the names of other syntactic classes (italicized). One or more items may be placed on a line within the definition. Items are usually placed on the same line if they are required to appear on the same line in the source text (but see the last rule below). Each syntactic class is labeled on the right with a rule number of the form Rm-n, where m is the number of the chapter in which the rule is defined and n is its serial number within that chapter. A more specialized view of a particular syntactic category may be introduced using a qualifying phrase before the category name, as: A (particular kind of) category is a: ... where the parenthesized phrase "particular kind of" names a specific form of a more general category defined in another class definition. The syntax of such specialized definitions is restricted in some way over the syntax of the more general rules, to reflect the specialization. For convenience, the same syntactic rule may be repeated in several places throughout the manual. All duplicate occurrences of a rule are given the original rule number. o A syntactic class can be defined as a choice among several alternative classes or constructs using: A selection is one of: o item1 o item2a item2b o item3 o Each alternative list of items is introduced by a small bullet (o). o Within a syntactic class definition, items enclosed in italic brackets are optional: [ optional-item another-optional-item ] o Within a syntactic class definition, items enclosed in italic brackets immediately followed by ellipsis dots may be repeated zero or more times: [ optional-repeated-item a-second-item ]... Syntactic constraints imposed on a rule by surrounding context are specified in English sentences introduced by a minus sign (-), as in: A foo-stmt is: FOO ( foo-arg-name ) - A foo-arg-name must not have been used previously in a BAR statement. The constraint imposes a restriction on the kinds of name that can be used in a FOO statement. The rule above defining foo-stmt also illustrates a naming convention: only the italicized portion of a name has a corresponding definition in the syntax, and an unitalicized prefix in a name imposes some context constraint that should be apparent. The example above references the syntactic name foo-arg-name, but only name is defined in a syntax rule. To reduce the number of syntax rules, a symbolic name ending in "(s)" is assumed to be defined as a list of one or more items with the specified name, separated by commas. For example, a reference to xyz(s) or to "an xyz(s) list" implicitly defines the following rule: An xyz(s) is: xyz [ , xyz ]... The symbol xyz should be defined explicitly by a syntax rule elsewhere in the document. ***************************************************************** The information in this document is subject to change without notice and should not be construed as a commitment by Think- ing Machines Corporation. Thinking Machines reserves the right to make changes to any product described herein. Although the information in this document has been reviewed and is believed to be reliable, Thinking Machines Corporation assumes no liability for errors in this document. Thinking Machines does not assume any liability arising from the application or use of any information or product described herein. ***************************************************************** Connection Machine (r) is a registered trademark of Thinking Machines Corporation. CM, CM-2, CM-200, CM-5, CM-5 Scale 3, and DataVault are trademarks of Thinking Machines Corporation. CMOST, CMAX, and Prism are trademarks of Thinking Machines Corporation. C* (r) is a registered trademark of Thinking Machines Corporation. Paris, *Lisp, and CM Fortran are trademarks of Thinking Machines Corporation. CMMD, CMSSL, and CMX11 are trademarks of Thinking Machines Corporation. CMview is a trademark of Thinking Machines Corporation. Scalable Computing (SC) is a trademark of Thinking Machines Corporation. Scalable Disk Array (SDA) is a trademark of Thinking Machines Corporation. Thinking Machines (r) is a registered trademark of Thinking Machines Corporation. CONVEX is a trademark of CONVEX Computer Corporation. Cray is a registered trademark of Cray Research, Inc. SPARC and SPARCstation are trademarks of SPARC International, Inc. Sun, Sun-4, and Sun Workstation are trademarks of Sun Microsystems, Inc. UNIX is a trademark of UNIX System Laboratories, Inc. The X Window System is a trademark of the Massachusetts Institute of Technology. Copyright (c) 1989-1994 by Thinking Machines Corporation. All rights reserved. This file contains documentation produced by Thinking Machines Corporation. Unauthorized duplication of this documentation is prohibited. Thinking Machines Corporation 245 First Street Cambridge, Massachusetts 02142-1264 (617) 234-1000