<<

Programming the Connection Machine by using the Metaob ject Proto col

Lothar Hotz Gerd Kamp

Universitat Hamburg Fachb ereich Informatik

Bo denstedtstrasse Hamburg Germany

email hotzinformatikunihamburgde

In this pap er we demonstrate how the Metaob ject Proto col of the Ob ject

System can b e used to program the Connection Machine In this approach metaob ject

classes which are resp onsible for internal representations of instances map instances to

pro cessors in various ways With these classes parallel are implemented to form

a language which allows an easy usage of a parallel machine

INTRODUCTION

A widely used approach to join ob jectoriented OO programming and parallel com

puters consists in identifying an ob ject as a main source of parallelism or concurrency

Ob jects or actors guardians communicate by messaging ie sending messages to each

other Such active ob jects may run concurrently if they reside on dierent pro cessors

Examples for systems following this approach are describ ed in Besides ob jects and

messages OO programming supplies additional features that may b e used for program

ming parallel These features eg found in the Common Lisp Ob ject System

CLOS are generic functions metho d combination and the

metaob ject proto col

In this pap er we showhow CLOS can b e used to program massively parallel computers

MPCs esp ecially the Connection Machine CM Our goal is to hide anykindof

explicit parallel syntax to the user by extending an already wellknown language with less

change of its syntax If we can dene a of appropriate structures whose op erations

are internally parallelized and whose user is within the scop e of the language the

user is not puzzled ab out explicitly thinking or programming in parallel terms These data

structures are manifested in a set of large ie numerous elements complex structures

such as matrices lists sets relations and graphs with appropriate op erations on them

us our goal is to design eg multiplication graph traversion transitivehull union Th

a language of complex data structures called DisGraL distributed graph language and

join these structures that are problemoriented machineindep endent commonly usable

and parallelizable with appropriate op erations

In a rst approach we concentrate on data parallel machines like the CM b ecause

they have a nature dierent from controloriented languages detailed knowledge of the

machines architecture are necessary to program them Thus complex structures

and their op erations are realized by data parallel The interface b etween

such abstract data structures and their data parallel realization is implemented via the

metaob ject proto col This is a way to op en languages up allowing users to adjust the

design and implementation of a to suit their particular needs In

particular in a subset of CLOS is dened and extended with facets dynamic slots

etc by using the metaob ject proto col of CLOS MOP In a similar waywe extend

PCL Portable CommonLo ops a p ortable version of CLOS to supply data mappings

to the CM ie known distributions of ob jects eg are supp orted by our

extensions Thus we showhow the MOP can b e used to implementaninterface b etween

CLOS and the CM This interface is given by language features which smo othly t

in the syntax of CLOS Thus no additional explizit parallel constructs must b e known

to a user of these extensions In this sense the pap er describ es how to bridge the gap

between low level machinedep endent more or less ecient parallel algorithms and high

level abstract applications We are not concerned with improving sp eci algorithms

or solving a sp ecic problem on a parallel machine in an ecientway Thus neither

eciency results are presented nor parallel algorithms are describ ed However we assume

that there exist ecient parallel algorithms and that there are applications that should

b e solved with parallel machines

We rst give a short overview of terms used Section After a short description of

levels of abstraction for a more detailed view of them we refer to we present

the develop ed metaob ject classes for handling massively parallel constructs These

classes are used to implement complex structures as describ ed and illustrated with a short

example in Section Finally in Section we discuss some other approaches

THE CM OO PROGRAMMING AND THE MOP

ely parallel single instruction multiple data The connection machine CM is a massiv

SIMD consisting of up to K pro cessors To the user the parallel pro cessing

unit app ears as an extension of the normal environment of a standard sequential computer

such as a Sun Lisp is a data parallel extension of Common Lisp for the CM

The data parallel extensions of Lisp include a large numb er of functions and macros and

one imp ortant abstraction the parallel variable or pvar A pvar is a variable that

has a separate value for each pro cessor in the CM

Besides widely used OO features like classes slots data elds of classes inheritance

and instances the data stores of slot values of a sp ecic class we fo cus on metaob ject

classes and proto cols Classes whichcontrol representation of instances of classes are

called metaob ject classes With them a programmer gets access to the internal repre

sentation of language constructs The sp ecication of interacting ob jects is manifested in

a collection of generic functions called proto col Proto cols are sp ecializable mo diable

interfaces b etween ob jects CLOS is implemented in CLOS ie all features of CLOS

eg classes generic functions are represented as instances of predened classes named

standard metaob ject classes These instances are called metaob jects The b ehavior

of these metaob jects and thus of CLOS is describ ed with proto cols These proto cols

describ e sp ecic p oints of the CLOS implementation to b e changed by a programmer For

example the instance allo cation proto col sp ecies that al locateinstance is called when

an instance is allo cated Because these functions are generic functions they can b e sp e

cialized as in an ordinary OO program The language implementation itself is structured

as an OO program Thus extensions can b e made by sub classing standard metaob ject

classes to sp ecialized metaob ject classes These classes extend or override predened

language b ehavior eg to access a pro cessor element and not an element of an array

when a slot value is refered to In Section we describ e the mo dication of the instance

allo cation proto col Changing the implementation of a programming language mightlook

ugly and susp ect but it is not when doing it in a p ortable way Because the proto cols are

summarized in the quasi standard of the MOP see all implementations of CLOS

using it will understand changes of CLOS To the user programmer of a such mo died

CLOS the extensions are part of the language and clearly integrated in the syntax and

semantics of the language

LEVELS OF ABSTRACTION

To clarify our view of parallel languages we describ e levels of abstraction and languages

see also The usefulness of separating lowlevel parallel constructs from high level

problem oriented constructs is also discussed in other pap ers like We extend

Lisp with PCL to get an OO interface to the data parallel CM Furthermore we de

ne classes and metaob ject classes to map data to parallel machines This level is called

CLOS With this extension classes and op erations for regular structures like vector ma

trix set and irregular structures are dened Irregular structures suchas relation graph

and list change dynamically and are not constant in size or are arbitrarily distributed

Thus it is not p ossible to map these structures onetoone to regular internal constructs

However it is p ossible to implementsuch structures on the CM Op erations

on irregular structures are dened on the entire not on single ob jects Our

approachintegrates these structures and op erations in a set of classes and metho ds that

aL The main issue with DisGraL is the need to dene problems in terms is called DisGr

of complex structures and op erations ie the programmer do es not think in parallel or

sequential structures but in complex ones DisGraL is the basis for a to ol for implement

ing various Articial Intelligence AI applications such as vision neural nets and the

selection problem on parallel computers In Section wegive one example which gives

a short insight of the to ol

CLASSES AND CLASSES FOR THE CM

In this section we present one class and three sp ecialized metaob ject classes one of

them is used to implement the complex structure relationclass see Section These

classes describ e distinct mappings of instances ie data holding structures of OO lan

guages to pro cessors reecting our data parallel approach They are part of CLOS

As mentioned ab ove the instance allo cation proto col is sp ecialized by these classes The

standard proto col sp ecies that al locateinstance results in an array for storing slot values

By indicating slots to b e not CLOS slots but parallel ones the standard proto col do es

no longer allo cate storage on the sequential machine Instead storage is allo cated on the

CM by a sp ecialized metho d for al locateinstancewhich uses LISP functions The

distribution can b e done in various ways dep ending on the desired data distribution

pvarp erinstanceclass This class is an ordinary CLOS class Each instance of this

class represents one pvar The pvar is allo cated during initialization of a new in

a) pvar-per-instance-classb) parallel-class c) parallel-slot-class d) distributed-slots-class P1 P2 P3 P4 P1 P2P3 P4

S1 S1 P1P2 P3 P4 I1 S2 I2 I3 S3 S2 P1 P2 P3 P4 S4 I4 S5 I5 S6 S3 I6 S7 I7

I1 I2 I3 I4 I1I2 I3 I4 S1 S2 S3 S4

PVAR

Figure a d Sp ecialized parallel metaob ject classes Pi stands for Pro cessors Si for

Slots and Ii for Instances

stance and initialized with a given content eg elements of a sequential arrayor

a particular numb er Thus the initialization proto col is extended to allo cate the

appropriate pvar dep ending on the given content In Figure a a two dimensional

pvar is shown which corresp onds to one instance representing a matrix

parallelclass This metaob ject class maps each instance of a class to a pro cessor ie

al l slot values of an instance are stored on the same pro cessor In Figure b a

column illustrates one instance by its slot values SiEach instance Ii corresp onds

to one pro cessor Pi This data mapping is similar to that used in PARKA The

dierence of course is that PARKA is a direct implementation in Lisp and uses no

OO programming

parallelslotclass The metaob ject class paral lelclass maps an instance as a whole to

a pro cessor With paral lelslotclass particular slots called paral lel slotsofanin

stance are mapp ed to pro cessors while other slots are normal CLOS slots Thus

one or more slots of an instance maybelongtoapvar This is indicated in Fig

ure c slots S S and S are parallel slots Pvars for parallel slots are allo cated

when a class is dened By extending the instance structure proto col by the func

tion getprocessor that computes a pro cessor for a given slot value the distribution

of data can b e controlled The default b eha vior maps eachslotvalue to a distinct

pro cessor Other kinds of data mappings can b e implementedby sp ecializing this

function Thus getprocessor is a parallel extension to the inherited sequential

proto col With it particular load balancing metho ds may b e implemented

distributedslotsclass Besides the vertical storing of instances done by paral lelclass

they may b e stored horizontally ie each slot value of an instance is lo cated in a

distinct pro cessor This is useful for large instances with many slots compare the

implementation in Again as in pvarperinstance one pvar is allo cated for each

instance and the desired slot values are stored in distinct pro cessors Accesses to slot

values are implemented by sp ecializing the instance structure proto col Figure d illustrates this metaob ject class

Summarizing these prop osed class denitions parallel constructs are allo cated during

class denition and sp ecic pro cessors are referenced during instantiation of such a class

For this the initilization proto col and the instance allo cation proto col are sp ecialized To

refer to the right slot values on the CM additionally the instance structure proto col is

mo died Thus this mo died metho d establishes a part of the interfaces b etween CLOS

and the CM All parallel constructs such as declaration and allo cation of pro cessors

and pvars or usage of machinedep endent op erations are hidden by metaob ject classes and

their sp ecializations of MOP functions Thus these metaob ject classes mo dify the internal

representation of CLOS structures to connect CLOS with Lisps parallel functions

After this mapping of data instances to pro cessors the next step is to dene op erations

on parallel structures Besides extending functions of the MOP additional proto cols are

attached to complex structures In Section we describ e a small part of them

COMPLEX STRUCTURES

We see a complex structure as a of ob ject that represents a large

whose elements are related in a sp ecic kind eg matrices graphs relations lists In this

sense complex structures are abstract data typ es given by our language and not dened

by a user ie an application programmer using a parallel language The notion is that

sp ecic large data structures are necessary to program a parallel machine and should

b e part of a parallel language b ecause of dicult p ossibly machinedep endent imple

mentations of such structures The selection of necessary complex structures is guided by

AI applications In this section we describ e one example of a complex structure a class

for handling relations relationclass Relations are used in knowledge representation for

describing concepts and their connections

The class relationclass is a direct sub class of paral lelslotclassie relationclass is an

other sp ecialized metaob ject class b ecause paral lelslotclass is one Thus each parallel

slot is asso ciated with a parallel structure but additionally it is interpreted as a relation

between classes as domain and range of the relation Consider the following shortened

denition of the class or concept PC

defclass PC

hasparts relationvalues CPU harddisk display

allocation parallel

relationclass

ation paral lel is inherited from paral lelslot The parallel allo cation sp ecication al loc

class Instances of PC are organized by relationclasswhich is indicated through meta

class relationclass relationvalues describ es three new relation elements for the relation

hasparts ie b etween PC and CPU harddiskand display resp ectively Dening a fur

ther class say comfortablePC with an additional part eg relationvalues keyboard

extends the relation hasparts by four new relation elements three inherited from PC and

a new one Thus the parallel structure representing the parallel slot is extended and no

additional parallel structure is created All other slots of comfortablePC are inherited by

CLOS inheritance and their relations are similarly extended ie corresp onding parallel

structures are shared bydiverse classes After the classes are dened a parallel structure

contains all created relation elements of one relation Instances of a class are represented

by markings of the class relation elements ie they describ e subsets of the relations

sp ecied by the class Markings are parallel structures to o eg b o oleanpvars

Parallel op erations on complex structures are dened by generic functions Wedis

tinguish b etween simple generic functions on single elements of complex structures and

complex generic functions on a whole complex structure Examples of simple generic func

tions are comparing functions like max and min and element functions like positionof



element and applytoelementswhich applies a function to each element of a structure

Besides arithmetic functions like mult addandsub and creating functions like make

instance shifttoparal lelstructure complex functions are eg fo cussing functions gen

erating functions reduce functions or structure sp ecic functions as transitivehull and

subsumption for relations or clique graph computation for graphs For a short descrip

tion of some of these function classes we refer to These op erations are dened by

generic functions ie they build a proto col for complex structures For example the sub

sumption is dened as simple intersection of instances and implemented by comparing

relation elements in parallel This predened b ehavior might b e sp ecialized for sp ecic

applications

To demonstrate the usage of the describ ed classes and functions we present a p ossible

implementation for solving the selection problem We can only emphasize main issues

details are avoided Within this problem a domain is represented by concepts and

relations which describ e a large set of p ossible real world ob jects here called congu

rations Wehave already seen the concept PC with its relation hasparts Imagining a

numb er of such concepts representing a greater numb er of real PCs wewant to select a

suitable complete PC when a demand of a user is present We assume the demand is in

the scop e of the domain ie it uses the same relations as our domain describ es

Our approach is to dene relations and concepts by relationclass as describ ed ab ove

Thus parallel structures for relations are allo cated and the proto col for relationclass can

b e used The demand is represented by an instance having all desired relations which

are marked on the desired relation elements This instance is simply compared with the

dened relations by using the subsumption function which tests intersections as describ ed

ab ove Thus parallelism is achieved for relation elements describ ed byoneorinthe

case of sharing parallel structures of some relations When all relations are checked the

computed markings determine the chosen concepts They describ e the congurations that

subsume the demand The presented representation is one of a multitude of alternatives

RELATED WORK

Our approachcombines diverse metho ds and constructs ie OO programming high

level structures guided by AI applications massively parallel machines and an implemen

tation technique made p ossible byaMOPThus it is related to many other approaches

which usually concentrate on one or two of these terms

As mentioned ab ove OO languages prop osed for parallel machines are mostly related

With this implementation one gets parallelism on one relation to improve that one can hold several

relations in one parallel structure which is not discussed here



In and similar functions are prop osed for applying to paral lelsets and paralations

to distributed machines where messagepassing is mapp ed to communicating pro cessors

Because the MOP sp ecies all kinds of OO features ie not only invo ca

tion which corresp onds roughly to messagepassing but also instance storage allo cation

inheritance and so on it is p ossible to mo dify CLOS in sp ecic places and only there

Thus it is not necessary to dene a whole new language but p ointed mo dications are

p ossible However other OO languages dened for massively parallel machines are in

tro duced in and But in only elementwise functions are prop osed and in

a sequential mo del lies on top ie no new programming styles are supp orted as with

our complex structures In the messagepassing language pC is presented which

intro duces structures named collections that are similar to our complex structures The

collections selected there are mostly related to linear algebra But the approach of hid



ing lowlevel implementations in class hierarchies is the same as in DisGraL The main

dierences of course are distinct implementation techniques Because the MOP is part of

CLOS no additional programming environment as describ ed in is used Instead of

compiling DisGraL we use the MOP as an interface b etween OO programming and the

machinedep endent language Lisp Thus wedonotgive a compiling scheme for say

complex structures as it is done for pC but take p ossibly high machinedep endent

programs of a parallel language and use them to implement complex structures By this

means existing parallel programs and sp ecic implementation techniques are integrated

Summarizing this implementing the sequential language CLOS as it is done by Lisp

which is ordinary Common Lisp plus some parallel constructs and our adding of PCL

and getting access to parallel machine internals as it is done by Lisps parallel con

structs enables the implementation of high level abstractions in a known syntactic and

vironment The reecting prop erties of CLOS ie the p ossibility to manipu semantic en

late language features within the language itself enables incorp orating parallel constructs

by using a clean interface This is also emphasized in

CONCLUSION

We presented an OO language for programming massively parallel machines This

language is implemented by using the Metaob ject Proto col of CLOS Instead of concen

trating on messagepassing we use multiple features of CLOS such as generic functions

multiple inheritance and its sp ecial implementation with the MOPWe showthatitis

easy to implementaninterface b etween CLOS and the CM by using this op en language

implementation Because we fo cus on this interface traditional problems of parallel com

puting eg load balancing synchronization are not discussed Instead we describ ed

some metaob ject classes that pro duce various kinds of ob ject or instance distribution

With them we implementdiverse abstract data typ es which are part of our prop osed

language With an example taken from AI we demonstrate the usage of the language

The extensions made lead to a new easy understandable language b ecause new features

are integrated precisely in the syntax and semantics of CLOS Because the MOP is con

cerned with sequential op erations yet small additional proto cols are t in to supp ort

parallel features like load balancing The integration of further parallel proto cols eg for

handling sparse matrices will b e done in the future Todevelop an appropriate to ol we



In our case multiple inheritance leads to heterarchies

will examine diverse areas of AI to nd commonly usable structures and op erations for

programming parallel machines If implemented appropriatly these abstractions might

b e useful to program other machines likemultiple instruction multiple data or distributed

machines

REFERENCES

PCTreleaven editor Paral lel Computers Object Oriented Functional Logic Wiley Sons

A Yonezawa and M Tokoro editors ObjectOrientedConcurrent Programming MIT Press Cam

bridge MA

C Houck and G Algha HAL A Highlevel Actor Language and Its Distributed Implementation

In Proc Int Conf on Paral lel Processing pages I I I I

E Moss Panel Discussion Ob jectOriented ConcurrencyInOOPSLA Addendum to the Proceed

ingsvolume of ACM SIGPLAN Notices pages

L V Kale and S Krishnan Charm Portable Concurrent Ob ject Oriented System Based On

C Technical rep ort University of Illinois

y S E Keene ObjectOrientedProgramming in Common Lisp AddisonWesley Publishing Compan

G Kiczales D G Bobrow and J des Rivieres The Art of the Metaobject Protocol MIT Press

Cambridge MA

W D Hillis The Connection Machine MIT Press Cambridge MA

C K Yuen Paral lel Lisp Systems Chapman Hall

L Hotz An Ob jectOriented Approach for Programming the Connection Machine In H Kitano

editor Second International Workshop on Paral lel Processing for Articial Intel ligence PPAI

Elsevier Science Publishers Toappear

Lisp Getting Started in Lisp Version Thinking Machines Corp oration Cambridge MA

P Gabriel Bo ok Review G Kiczales J des Rivieres and D G Bobrow The Art of the

Metaob ject Proto col Articial Intel ligence

M F Kilian Ob jectOriented Programming for Massively Parallel Machines In Proc Int Conf

on Paral lel Processing pages I I I I

JM Jezequel EPEE an Eiel Environment to Program Distributed Memory Parallel Computers

In Proc ECOOP pages

G C Fox Hardware and Architectures for Irregular Problem Architectures In R Voigt

P Mehrotra and J Saltz editors Unstructured Scientic Computation on Scalable Multiprocessors

pages The MIT Press

H Masuhara S MatsuokaTWatanab e and A Yoneyawa Ob jectOriented Concurrent Reective

Languages can b e Implemented EcientlyInProc OOPSLA ACM SIGPLAN pages

D Dahl Mapping and Compiled Communication on the Connection Machine System In Proc of the

th Distributed Memory Computing Conference IEEE Computer Society pages Charleston

South Carolina April

S S Nielsen and S A Zenios Data Structures for Network Algorithms on Massivley Parallel

Architectures Paral lel Computing

M Evett J Hendler and L Sp ector Parka Parallel Knowledge Representation on the Connection

Machine Technical Rep ort UMIACSTR University of Maryland

J L Kolo dner and R Thau Design and Implementation of a Case MemoryTechnical Rep ort

RL Georgia Institute of Technology

G Sab ot The Paralation Model MIT Press Cambridge MA

J K Lee S YangSNarayana and D Gannon Compiling an Ob jectOriented Parallel Language

for Parallel Machines In Proc of International ConferenceonParal lel and Distributed Systems

pages Hsinchu Taiw an Decemb er