CM FORTRAN LANGUAGE REFERENCE MANUAL Version 2.1, January 1994 Copyright (c) 1989-1994 Thinking Machines Corporation. CHAPTER 1: INTRODUCTION ************************ CM Fortran is an implementation for Connection Machine systems of the programming language FORTRAN 77, extended with array-handling facilities from the language Fortran 90. CM Fortran supports all features of FORTRAN 77 that control allocation or access to data residing on the control processor. Some restrictions are imposed on the use of FORTRAN 77 features that depend on the storage order of data residing in the (distributed) memory of parallel processors. Figure 1 illustrates the relationship of CM Fortran to FORTRAN 77 and Fortran 90. [ Figure Omitted ] Figure 1. CM Fortran and its relationship to other Fortran dialects. The following features of CM Fortran have been adopted from the Fortran 90 standard. o array assignment o array sections, including sections produced by vector-valued subscripts o array constructors o arithmetic and logical operations involving whole array or array sections o intrinsic functions that perform operations elementally on array or scalar arguments o intrinsic functions that transform arrays from one shape to another o keywords in intrinsic function references o dynamic array allocation with the ALLOCATE statement o array pointers (but not the TARGET attribute or pointer assignment statement) o the CASE construct o the WHERE statement and block WHERE construct o array-valued external functions o interface blocks to specify the interface of external subroutines and functions CM Fortran also includes the following features from the Fortran 90 standard; these features form part of the DOD military standard extensions (MIL-STD-1753). o Bit-manipulation intrinsic functions o DO WHILE statements o END DO statements o INCLUDE lines o a NONE specifier in the IMPLICIT statement Finally, CM Fortran includes array facilities drawn from earlier versions of the draft standard, but removed from the Fortran 90 standard, including: o DO TIMES statements o FORALL elemental array assignment o The intrinsic functions DIAGONAL, RANK, REPLICATE, PROJECT, FIRSTLOC, and LASTLOC 1.1 EXECUTION MODEL -------------------- A CM Fortran program typically contains several different kinds of source constructions, which the compiler translates into two code streams, serial and parallel. Serial code executes on the control processor; parallel code executes on the parallel processors. Serial code includes statements that affect the flow of execution within a program, such as IF, DO, and CALL statements, as well as operations that affect only data that resides in the control processor's memory. Scalar data and arrays called front-end arrays reside on the control processor. Depending on the execution model chosen at compile time, the control processor may be the partition manager or the individual nodes of a CM-5 or the front-end processor of a CM-2 or CM-200. (See the CM Fortran Programming Guide for information on the various execution models.) Arrays that are subject to array operations are allocated in the distributed memory of the parallel processing unit, and the array operations are performed by the parallel processors. For historical reasons, CM Fortran calls distributed arrays CM arrays. The terms parallel processor and processing elements refer to the CM system components that perform parallel operations. Depending on the execution model chosen, they may be the nodes or the vector units of a CM-5, or the nodes of a CM-2 or CM-200. [ Figure Omitted ] Figure 2. Division of labor between the control processor and the parallel processors. The CM system software dynamically allocates one or many array elements in the memory of each parallel processor, thus making application code independent of the number of physical processors in the machine in which it is executing. Such code scales from one size machine to another without recoding or recompilation. System software handles the distribution of array elements among parallel processors transparently to the user, although the user can influence or even control array layout by means of compiler directives. The fastest mechanism for operating on or communicating among array elements is local memory accesses within each of the parallel processors. Careful attention to array layout (using the compiler directive LAYOUT) can maximize the use of this mechanism. To transfer data among processors, the CM system software supports three interprocessor communication mechanisms, implemented as run-time communication routines. The compiler invokes the appropriate mechanism transparently to the user. o General communication. The most general mechanism allows data to be sent from any processor directly to any other processor; many processors can send data to many other processors simultaneously. This mechanism is the most expensive in terms of performance. o Grid communication. A more efficient mechanism treats data as an n-dimensional grid and allows every processor to send data to its immediate neighbors in the grid. This grid communication is also called NEWS communication, for historical reasons. o Global communication. A third mechanism performs cumulative operations over an array or along a dimension. The cumulative operation may reduce an array or a dimension to a scalar result, or it may scan a dimension to accumulate a set of results in the elements on that dimension. Array assignment in CM Fortran is often performed without the need for any interprocessor communication, but it may in some cases require grid or general communication. Vector-valued subscripting in an array section requires the general communication mechanism, as do transformational intrinsic functions such as PACK and UNPACK. The intrinsic function CSHIFT usually uses grid communication when performing a constant shift along an array dimension. References to intrinsic reduction functions such as SUM use the global communication mechanism. ***************************************************************** 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