The DINO parallel programming language

  • Published on
    21-Jun-2016

  • View
    220

  • Download
    0

Embed Size (px)

Transcript

  • JOURNAL OF PARALLEL AND DISTRIBUTED COMPUTING 13,30-42 ( 199 1)

    The DIN0 Parallel Programming Language*

    MATTHEWROSING, ROBERTB. SCHNABEL,ANDROBERTP.WEAVER Department of Computer Science, University of Colorado, Boulder, Colorado 80309-0430

    DIN0 (Distributed Numerically Oriented language) is a lan- guage for writing parallel programs for distributed memory (MIMD) multiprocessors. It is oriented toward expressing data parallel algorithms, which predominate in parallel numerical computation. Its goal is to make programming such algorithms natural and easy, without hindering their run-time efficiency. DIN0 consists of standard C augmented by several high-level parallel constructs that are intended to allow the parallel program to conform to the way an algorithm designer naturally thinks about parallel algorithms. The key constructs are the ability to declare a virtual parallel computer that is best suited to the par- allel computation, the ability to map distributed data structures onto this virtual machine, and the ability to define procedures that will run on each processor of the virtual machine concur- rently. Most of the remaining details of distributed parallel computation, including process management and interprocessor communication, result implicitly from these high-level constructs and are handled automatically by the compiler. This paper de- scribes the syntax and semantics of the DIN0 language, gives examples of DIN0 programs, presents a critique of the DIN0 language features, and discusses the performance of code gen- erated by the DIN0 compiler. o 1991 Academic PWSS, IN.

    1. INTRODUCTION

    DIN0 ( Distributed Numerically Oriented language) is a language for writing parallel programs for distributed mem- ory multiprocessors that was developed primarily for nu- merical computation. By a distributed memory multipro- cessor we mean a computer with multiple, independent pro- cessors, each with its own memory but with no shared memory or shared address space, so that communication between processors is accomplished by passing messages. Examples include MIMD hypercubes and networks of com- puters used as multiprocessors.

    It is generally more difficult to design an algorithm for a multiprocessor than for a serial machine, because the algo- rithm designer has more tasks to accomplish. First, the al- gorithm designer must divide the desired computation among the available processors. Second, the algorithm de- signer must decide how these processes will synchronize. In addition, on a distributed memory multiprocessor, the al-

    * This research supported by AFOSR Grant AFOSR-85-025 1, NSF Co- operative Agreement DCR-8420944, and NSF Cooperative Agreement CDA- 8420944.

    gorithm designed must consider how data should be distrib- uted among the processors and how the processors should communicate.

    The goal of DIN0 is to make programming distributed memory parallel numerical algorithms as easy as possible without hindering efficiency. We believe that the key to this goal is raising the task of specifying algorithm decomposition, data decomposition, interprocess communication, and pro- cess management to a higher level of abstraction than that provided in many current message passing systems. DIN0 accomplishes this by providing high-level parallel constructs that conform to the way the algorithm designer naturally thinks about the parallel algorithm. This, in turn, transfers many of the low-level details associated with distributed par- allel computation to the compiler. In particular, details re- garding message passing, process management, and syn- chronization are no longer necessary in the code that the programmer writes and associated efficiency considerations are addressed by the compiler.

    This high-level approach to distributed numerical com- putation is feasible because so many numerical algorithms are highly structured. The major data structures in these al- gorithms are usually arrays and sometimes trees. In addition, the algorithms usually exhibit data parallelism, where at each stage of the computation, parallelism is achieved by dividing the data structures into pieces and performing similar or identical computations on each piece concurrently. DIN0 is mainly intended to support such data parallel computation, although it also provides some support for functional par- allelism.

    The basic approach taken in DIN0 is to have the pro- grammer provide a top-down description of the distributed parallel algorithm. The programmer first defines a virtual parallel machine that best fits the major data structures and communication patterns of the algorithm. Next, the pro- grammer specifies the way that these major data structures will be distributed and possibly replicated among the virtual processors. Finally, the programmer provides procedures that will run on each virtual processor concurrently. Thus the basic model of parallelism is single program, multiple data (SPMD), although far more complexity is possible. Most of the remaining details of parallel computation and commu- nication are handled implicitly by the compiler. A key com- ponent in making this approach viable has been the devel- opment of a rich mechanism for specifying the mappings of

    0743-7315/91$3.00 Copyright 0 I99 1 by Academic Press, Inc. All rights of reproduction in any form reserved.

    30

  • THE DIN0 PARALLEL PROGRAMMING LANGUAGE 31

    data structures to virtual machines, along with the efficient implementation of these mapping patterns in the compiler.

    Sequential code in a DIN0 program is written in standard C; DIN0 is a superset of C. Only the parallel constructs in DIN0 and a few related additions are new. We have chosen to build DIN0 on top of C because C is widely used and is available on our target parallel machines, because its struc- tured form fits well with our parallel approach, because its dynamic data structures are useful in many numerical ap- plications, and because we have many tools available for implementing a C compiler. However, the DIN0 language as described in this paper could have been built on top of almost any imperative, sequential language, including FOR- TRAN.

    Implicit in our approach to parallel programming is the belief that given the current state of knowledge in this area, a language cannot completely hide the distributed memory parallel machine from the programmer if the result is to be programs that run efficiently. Also, we believe that most par- allel algorithm designers do have an idea of how to break up the data structures and how to act upon them concurrently in order to achieve efficient parallel performance. In DINO, we are trying to provide just enough high-level parallel struc- ture to allow the programmer to specify this information, while making the compiler do as much of the tedious work as possible.

    To our knowledge, there is relatively little other research that has led to implemented languages for distributed parallel numerical computation. C * [ 15 ] and Kali [ 13, lo] are prob- ably the closest languages we have found to DINO, although DIN0 was developed entirely independently of both of them. C * is a C superset used to program the ( SIMD) Connection Machine. Its domain and selection statement features are similar to DINOs environment structures and composite procedures, respectively; however, its SIMD orientation gives it a considerably different philosophy and flavor from DINO. One prominent difference is C*s local view of data structures as opposed to DINOs global view. Kali is a high-level lan- guage for data parallel, SPMD computation. It contains con- structs for virtual parallel machines and distributed data structures that are similar to DINOs. Its programming model, however, is considerably more restrictive than DI- NOs, allowing communication only upon entering and leaving forall loops.

    Another parallel language that has been implemented on distributed memory multiprocessors, Linda [ 41, is designed around a shared memory paradigm, the tuple space. Due to this approach, its constructs and philosophy are very dif- ferent from DINOs. For example, the mapping of data to processors is not specified by the Linda programmer and must be optimized at run time. Pisces [ 141 and the Cosmic Environment [ 221 are examples of systems that also support distributed parallel numerical applications, but using a level of support for parallelism lower than that of DINO. Several languages. such as Spot [ 241 and Apply [ 61, support specific

    application areas where a C*-like local view of the compu- tation is appropriate; our research aims to support a broader class of computations and this paradigm is not sufficient. Our work has been influenced considerably by the Force [ 81, which supports data parallel computation on shared memory multiprocessors. All of these approaches are im- perative; other approaches to parallel computation include functional languages (such as CRYSTAL [2] and SISAL [ 12 ] ) and concurrent logic languages (see the languages dis- cussed in [ 231). For a general overview of many parallel languages see [ 261.

    In recent years, the concept of distributed data, which is key to DINO, has been considered by several research pro- jects, including [ 2 1, 1, 131. An important difference in the DIN0 version is that one-to-many mappings of data to pro- cessors, as well as one-to-one mappings, are supported. This turns out to be important for implicit interprocess com- munication. The concept of virtual machines is also found in Structured Process [ 111.

    The remainder of this paper is organized as follows. Section 2 gives a brief informal overview of the DIN0 language and a simple example, while Section 3 gives a more formal de- scription. Section 4 presents two additional DIN0 examples and uses them as a basis for a critique of the DIN0 language features. Section 5 briefly summarizes the current status of the language and areas for related future research. Prelimi- nary discussions of the DIN0 project can be found in [ 16, 17 1, and a moderate-sized example is presented in [ 18 1.

    2. DIN0 OVERVIEW

    In this section, we set out the basic structure of the language in order to provide some context for the more detailed de- scription and discussion in the next section. We begin by presenting a very simple DIN0 example (Example 2.1)) a matrix-vector multiplication where the matrix is partitioned by rows and each processor calculates one element of the result vector.

    The three major DIN0 concepts that are illustrated in this example are the structure of environments, the composite procedure, and the distributed data. We explain each one briefly.

    2.1. Environments

    To create a parallel DIN0 program, the programmer first declares a structure of environments that best fits the number of processes and the communication pattern between pro- cesses in the parallel algorithm. This structure can be viewed as a virtual parallel machine constructed for the particular algorithm. Each environment in a single structure is a virtual processor that contains identical procedures and data struc- tures, although the contents of the data structures and the sequence of statements executed at run time can differ. Each DIN0 program also contains a host environment, a scalar

  • 32 ROSING, SCHNABEL, AND WEAVER

    EXAMPLE 2.1. Matrix-vector multiplication.

    #define N 512 #include din0.h

    environment node [N:id] I

    /* Row-wise Parallel Algorithm to Calculate a

  • THE DIN0 PARALLEL PROGRAMMING LANGUAGE 33

    of the interesting design and semantic issues. For a complete specification of the syntax and semantics of DINO, see [ 3 1.

    3.1. Program Structure

    PROGRAM :: = (ENVIRONMENT 1 MAPPING -.-FUNCTION I DATA-DEFINITION) +.

    A program consists of one or more environment decla- rations, zero or more mapping declarations, and zero or more (usually distributed) data declarations. One of the environ- ment declarations is defined as a scalar environment with the name host. This environment contains a procedure named main, where execution starts. The remaining en- vironment declarations generally define structures of envi- ronments that contain composite procedures which are in- voked from the host.

    Distributed data structures that are declared at the program level are mapped to one or more environment structures in the program, as specified by their mappings. Mappings that are declared at the program level are accessible to all parts of the program. Declaring distributed data at this level allows the data to be shared between subsequent structures of en- vironments. This is useful, for example, when a computation occurs in phases.

    One syntatic feature that affects the whole program is that DIN0 uses the # whenever an operation involves a remote environment. While each of the individual operations is dis- cussed below, the purpose of this general approach is to call the programmers attention to each operation that involves other environments.

    3.2. Environments

    ENVIRONMENT : : = environment IDENTIFIER DIMENSION * { EX- TERNAL-DEFINITION+ > .

    DIMENSION : : = [ EXPRESSION [ : IDENTIFIER ] 1.

    EXTERNAL-DEFINITION : : = FUNCTION-DEFINITION 1 DATA-DEFINITION ) MAPPING-FUNCTION.

    A structure of environments provides a virtual parallel machine and a mechanism for building parallel algorithms in a top-down fashion. An environment may contain com- posite procedures, standard C functions, distributed data declarations, standard C data declarations, and mappings. Each environment within a given structure contains the same procedures, functions, and C data declarations and shares the same distributed data declarations.

    A structure of environments may be any single- or mul- tiple-dimensional array. This is appropriate for parallel nu- merical computation because the parallelism in numerical algorithms is often derived from partitioning physical space

    into neighboring subregions, or from partitioning matrices or vectors. In order to give each environment within a struc- ture an identity that can be used in calculations, the pro- grammer can declare constants that will contain the sub- scripts identifying the current environment. In the matrix- vector example, this is id. Most often these are used to refer to the environments portion of a distributed data structure, for instance, the first element in an environments row of the matrix M is Mid] [ 0] in the same example.

    A DIN0 program may contain any number of environ- ment declarations. Typically only one, the host, is scalar and one or more are arrays. Multiple structures of environments serve two important purposes. They are useful when suc- cessive phases of a computation map naturally onto different parallel machines; in this case, generally only the environ- ments in one structure become active at once. They also provide support for functionally parallel programs; in this case, the environments in multiple structures become active at the same time.

    An environment can contain a...

Recommended

View more >