PEI: A language and its refinement calculus for parallel programming

  • Published on
    21-Jun-2016

  • View
    218

  • Download
    6

Embed Size (px)

Transcript

  • Parallel Computing 18 (1992) 1167-1184 North-Holland

    1167

    PARCO 704

    PEI: A language and its refinement calculus for parallel programming *

    E. Vio lard and G.-R. Perr in

    University of Franche-Comt~, Laboratoire d'lnformatique, F-25030 Besant~on cedex, France

    Received 11 February 1992

    Abstract

    Violard, E. and G.-R. Perrin, PEI: A language and its refinement calculus for parallel programming. Parallel Computing 18 (1992) 1167-1184.

    The aim of this paper is to introduce a new modeling, using symbols and functional notations, called the language PEI (as Parallel Equations Interpretor), which could unify the classical approaches of program parallelization, according to the sorts of problems and the target computation schemes. Due to its fundamental structure, disconnected from concrete drawings, this modeling offers a straightforward generalization to adress convex or non-convex computation domains, synchronous or asynchronous computa- tions. This sort of programming formalism allows a powerful structuration of statements and a stepwise transforma- tion technique based on a semantical equivalence definition and a refinement calculus. From initial problem statements, transformations of expressions lead to various definition structures, which can match given computation models.

    Keywords. Recurrence equations; functional language; systolic algorithms; parallel architectures; program equivalence; refinement.

    0. Introduction

    It is now admitted that reliable parallel programming techniques should be founded on formal transformations of programs, defined from data dependencies analysis and taking architectural-related computing models into account. To manage these transformations safely, a convenient formalism has to be defined, to express the successive statements, and the transformation rules themselves (cf. the works of Chandy and Misra [2]).

    Due to the results of Karp, Miller and Winograd [8], a convenient abstract expression of programs c~n be a set of recurrence equations. Indeed, prefiguring architecture evolutions, the introduction of the uniform recurrence equations did define a formal frame where the classical notions of data dependencies, potential parallelism and computation scheduling were presented.

    Since this presentation many proposals have generalized this abstract modeling. Affine recurrences on integral convex domains are mainly studied for systolic synthesis (see for example [5,9,14,11], etc., and ALPHA [10] or CRYSTAL [3] for language aspects). Other

    * This work has been supported by the French Coordinated Research Program C 3 of the CNRS. Correspondence to: E. Violard, University of Franche-Comt~, La~ratoire d'lnformatique, F-25030 Besan~on cedex, France, email: violard@comte.uucp

    0i67-8191/92/$05.00 1992 - Elsevier Science Publishers B.V. All rights reserved

  • 1168 E. Violard and G.-R. Perrin

    modelings are based on explicit data flow expressions: see for example the design of the language LUSTRE for reactive systems ([13]). All these formal frames, each of them relative to some tar.get computation scheme, allow - fruitful results due to their strict mathematical semantics~ b~t they also find their limit according to more general sorts of problems and to new architecture proposals. Some other languages are based on non-deterministic transitions on a multiset of values, from which an efficient execution model has to be defined (see e.g. :[11).

    Our aim is to introduce a new modeling called the language PEI (as Parallel Equations Interpretor), which could unify the classical approaches of program parallelization, according to the sorts of problems and the target computation schemes. A program will be presented as a set of equations on symbols and functions, in such a way that they imply a very simple semantics substitution rule. Many syntactical transformations can then operate on equations, as folding, unfolding, application, abstraction, etc.

    So, a problem and its solutions can be expressed with this single language PEI. The design of the solutions consists in transforming statements and maintaining the global semantics of the problem. The transformations are expressed in PEI too, by defining operators and equivalence rules. They are particular steps of a general refinement process going from abstract programs, satisfying some specifications, to an executable coding.

    Section 1 is devoted to a definition of the language. After a short presentation of its main notation aspects, a mathematical semantics of the language is introduced. It is based on the concept of multiset and data field. Operators on data fields define the semantics of the language constructions. In Section 2, we present transformation rules. A refinement calculus of PEI programs is presented in Section 3, which introduces the operational semantics of the language. Section 4 details the classical example of the Gaussian elimination algorithm. Last, related works are compared in Section 5.

    1. Presentation of the language

    1.1. A short presentation

    Classical languages founded on the recurrence equations concept (ALPHA [10] or CRYS- TAL [3] for example) consider variables or expressions as functions which map index sets to a set of values. These function domains are built from integral convex polyhedra in Z n. The domain and the values of the variables are defined from equations which define the data dependencies.

    Example. The mat~rix-vector product. Let 3 - (a , ,~) an mp matrix, V=(v k) a p-dimensional vector and X=A.V . Each

    component x i of X is defined by: p

    xi~- ~a i ,kV k, l

  • PEI: A language and its refinement 1169

    Other languages such as GAMMA [1] or LINDA [6] are founded on non-deterministic transitions on a multiset of values. The main problem for these expressions is to define an efficient execution model. Nevertheless they express in a nice abstract way a very large class of problems.

    A program in PEI benefits of such an abstraction of the variables domains, but fundamen- tally PEI is a recurrence equation language. Variables are defined as sets of values on abstract domains which are in fact the set of all their possible geometrical drawings in 7/n. They denote structures called data fields.

    A program in PEI is of the form

    W: [[ PRE; POST 1]

    where W is the list of output variables, PRE and POST are lists of equations E = E', where E and E ' are expressions built from operators on variables. An equation in the PRE part generally defines the geometrical drawing of an input variable domain. Equations in the POST part define output or intermediate variables.

    Operators either define the computations of the values of a data field (summation and product on the previous example), or express the data dependencies (the uniform dependen- cies (0, 1) hereabove), or refer any constructive aspect of data fields.

    Example. The matrix-vector product (continued). In PEI, the previous problem can be expressed in the following way. Matrices A and S are

    real-data fields whose geometrical drawings in 7/2 are {(i, k)l 1 < i < m A 1 < k < p}. Vectors V and X are real-data fields whose drawings are {k I 1 _< k < p}. This is the PRE part of the program defining the drawing of the input data fields:

    A =A(i, k) l (1

  • 1170 E. I/iolard and G.-R. Perrin

    This means that a sub-data field of S whose drawing is {(i, k) l l < i

  • PEI: A language and its refinement

    Fig. 1. A multiset of values.

    1171

    So, any element v of ,~ multiset M is described by a pair (v, ref), where ref distinguishes clones of v in M. To organize the index set in a partial computation ordering, ref is defined as a pair or:z, where z denotes a geometrical coordinate in Z n and or is any bijection from Z ~ to 7/m. This bijection or means all the possible transformations on these coordinates, in order to yield a convenient computation ordering on Z m. We say that M is described as a set, in a relative way, within the bijection or.

    Definition 1. We call data field any set of the form {(v, or:z)/v ~ M}, where M is a multiset, z denotes elements of 7/n and or is a bijection from 7/n to 7/m.

    Definition 2. Let X a data field, We call drawing of X the subset {z/(v, or:z) ~X} of Z n (Fig. 2).

    The values in the multiset associated with a given data field have the same type, say v. Such data fields are called v-data fields.

    Examples - Let c an element of v and R a predicate. {(c, or:z)/R(z)} is a constant data field, whose

    drawing is the set of points z satisfying R. - Let P=-

  • 1172 E. Violard and G.-R. Perrin

    2 2 0

    1 ~ 1 ~ 1

    Fig. 2. An example of data field associated with the multiset on Fig. 1: (a) an initial drawing, (b) a drawing resulting of some bijection o- from 7/2 to 7/2, (c) an associated partial order.

    Particular notations - hx.f(x) denotes hx/true.f(x), - hx/P(x) denotes Ax/P(x).x.

    Examples - The expression hx/(x > 0). l /x denotes an operator in PEI defined from the function

    which inverses any positive number. - Let us consider the operator denoted by Ax/(x > 0).2 x in PEI. The inverse of this

    operator is denoted either by hx/ (x > 0).2 Xx ^ or by hx/(x > 0).x/2.

    1.3.1. Functional operators A functional operator defines comrmtations or extractions of some values of a data field.

    Definition 3. Let f be any function from v to w, and X a v-data field. The application of the function f on X defines the w-data field {(f(v), cr:z)/(v, ~r: z) ~X ^ v ~Df} (Fig. 3).

    Notation. The application of a functional operator hv/P(v).f(v) on an expression of type data field E is denoted in PEI by hv/P(v).f(v)t> E.

    Examples - Let X a variable whose values are pairs of numbers:

    A(a~,.b).a + b ~ X denotes a data field whose values are the sums of the pairs of numbers in X.

    - Let X a variable, whose values arc numbers: Aa/a > O~ X denotes a data field whose values are the positive values in X.

    2 2

    3 4 4 3 G

    2 5 5

    2 2

    Q ,

    G

    @

    (a) (b) (c) Fig. 3. Data field resulting of the application of the functional operator hx/x mod 2 = 0 .x /2 on the previous data

    field on Fig.2.

  • PEI: A language and its refinement 1173

    2 2 CI

    3 3 " " 6

    2 2 ~ " b o

    Fig. 4. Data field resulting of the application of the routing operator a(i, j)/i > j.(i- 1, j - 1) on the data field defined on Fig. 2.

    1.3.2. Routing operators A routing operator defines computations or extractions of indices of a data field drawing.

    Definition 4. Let p any .function from Z n to Z n and X a v-data field. The application of the function p on X defines the v-data field {(v, or:z)/(v, or:p(z)) ~X Az ~Dp} (Fig. 4).

    Notation. The application of a routing operator Az/Q(z).p(z)on an expression of type data field E is denoted in PEI by Az/Q(z).p(z)E.

    Examples - Let X be a variable, whose drawing is a subset of Z e:

    A(i, k).(i, k -1 )X denotes a data field whose values are moved along the k axis. Its expresses the uniform dependency (0, 1) presented in the example, Section 1.1.

    - For the same variable X: A(i, k)/(1

  • 1174 b,. Violard and G.-R. Perrin

    2 o

    4 3 4 3 ~ . o oh "1 " "

    ~ Q 2 2 Fig. 5 Data field resulting of the application of the change of basis operator A(i, j ) . (3- i, j ) on the data field defined

    on Fig. 2.

    - The packing function. Considering any variable X, whose drawing D is a subset of Z, we introduce a canonical change of basis operator which packs this drawing in an interval of ~, whose length is the cardinality of D. Associated with any variable X, this operator is defined as the result of a predefined function tilda, called the packing function, applied on X. More formally, for any variable X, whose drawing D is a subset of Z, tilda(X) denotes the increasing bijection from D to N, whose image is [O..card(D)[. For example, if X is a variable whose drawing is D - {1, 3, 5, 7, ... }, the drawing of the expression X: tilda(X) is N. In this case, the symbol tilda(X) is associated with the change of basis operator M.( i - 1)/2.

    - Figure 5 presents the data field resulting of the application of a change of basis operator on the data field defined on Fig. 2. In this particular case the bijection or was equal to this change of basis. This means that the induced order is considered as a convenient computation ordering.

    1.4. Nuples of data fields

    Because all operators on data fields are unary operators, we define nuples of data fields. They are data fields whose values are nuples of values.

    Definition 6. A nuple of data fields is a data field {((vl,. . . ,v,), or:z)/(vl, or: z )~X~ ^ "'" ^ (v,, or: z) X,}, where Xi, X2,... , X n are data fields.

    Notation. The nuples of expressions E~, E2,..., E, are denoted in PEI by (E l, E2,..., En).

    1.5. Symbols and context

    A program can be defined within some context which associates names with operators. The structure of the program is then more clearly reaveled. Symbols and contexts are defined in the following way:

    with INVeW:[[ Pe ;POSr l] where INV is a list of declarations of the form: name = A-expression. The A-expression denotes a function built from composition, inversion and nuples of operators or names

    Example. In the previous example, in Section 1.3., the symbol merge can be associated with another change of basis operator for some other reduction of the generalized operator ,Y,, as for example A(i, k).(i, (k mod p)+ 1). In the same example, the symbol pre is associated with the routing operator A(i, k).(i, k - 1).

  • PEI: A language and its refinement 1175

    1.6. Example - The Gaussian elimination algorithm

    This example is one of the most famous in the literature on systolic algorithms, and specially in studies about synthesis methodologies. The Gaussian elimination algorithm solves the linear system AC/ = B where A is an n x n matrix and B an n - dimensional vector by first transforming A into a triangular matrix an then solving a triangular system.

    We are only concerned here by the triangularization of A. Since the transformation affects vector B, we consider that A is an n X (n + 1) matrix whose last column is B. Let ai,j and bi the initial values of matrix A, ai,j and b,! the elements of the resulting triangular matrix. They are defined by the following recurrence equation system:

    x(i, j, k) =x(i, j, k - 1) -x(i, k, k - 1) xxjk, j, k - l)/x(k, k, k - 1)

    k+l

  • 1176 E. Violard and G.-R. Perrin

    present other transformation rules of PEI programs. This set of transformation rules which maintain the global semantics of programs, is composed of two subsets. Some rules are such that the transformed programs define output variables denoting equal data fields. We say that the initial program and the transformed one are semantically equal. Some other ones only define a semantical equivalence of programs, i.e. programs that define output variables associated with the same multiset.

    2.1. Operator properties

    In this section, we present some mathematical properties on data fields and operators, which allow to link two expressions (i.e. two identical data fields) in a PEI equation. They permi...

Recommended

View more >