1998 - thesis jl pacherie parallel perators

54
A Pattern System for A Pattern System for Enumeration Processing Enumeration Processing Expression and Parallelisation Expression and Parallelisation Jean-Lin Pacherie

Upload: jean-lin-pacherie-phd

Post on 22-Jan-2018

103 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1998 - Thesis JL Pacherie Parallel perators

A Pattern System for A Pattern System for Enumeration Processing Enumeration Processing

Expression and ParallelisationExpression and ParallelisationJean-Lin Pacherie

Page 2: 1998 - Thesis JL Pacherie Parallel perators

ContentsContents• Introduction

• Conclusion

• Design Model for Processing• Pattern System

• Impact of the Data Driven Distribution (DDD) • Services for Data Parallelism

Page 3: 1998 - Thesis JL Pacherie Parallel perators

IntroductionIntroduction

Motivations

Pattern and Parallelism

Ideas and Thesis

IntroductionIntroduction

Design Model for Processing

Pattern System

Impact of the DDD

Fundamental Services for Data Parallelism

Conclusion

Page 4: 1998 - Thesis JL Pacherie Parallel perators

MotivationsMotivations

Parallel Programming, Why?

Decrease computation duration

Increase data size

Page 5: 1998 - Thesis JL Pacherie Parallel perators

Deriving sequential applications (DDD)

MotivationsMotivations

Parallel Programming, Why?

Parallel Programming, How?

Direct parallel programming

Page 6: 1998 - Thesis JL Pacherie Parallel perators

MotivationsMotivations

Parallel Programming, Why?

The solution should conforms with usual programming environment

Constraints for the solution

Standard compilation tools

No language extensions

Parallel Programming, How?

Page 7: 1998 - Thesis JL Pacherie Parallel perators

MotivationsMotivations

Parallel Programming, Why?

Constraints for the solution

Parallel Programming, How?

Available tools

Abstraction

Encapsulation

Polymorphism

Software architecture with Patterns

Page 8: 1998 - Thesis JL Pacherie Parallel perators

MotivationsMotivations

Parallel Programming, Why?

Constraints for the solution

Parallel Programming, How?

Available tools

Evolution

Encapsulating parallelism in a sequential OOL [ Jézéquel 91 ]

Method & Framework PALADIN [ Guidec 95 ]

Reusable expression of methods [ Pacherie 97 ]

Page 9: 1998 - Thesis JL Pacherie Parallel perators

RequirementsRequirementsExperts and Reusability

Beyond the software component reusability : Pattern

Where is expressed the knowledge in an application?

What kind of tools for reusability?

Page 10: 1998 - Thesis JL Pacherie Parallel perators

Library

OO Library

ComponentDesign

FrameworkFramework

Method

Pattern

Pattern Language

Architecture

Knowledge and ReusabilityKnowledge and Reusability

Evolution

Reusability level

Page 11: 1998 - Thesis JL Pacherie Parallel perators

RequirementsRequirementsKnowledge and Reusability

Beyond the software components reusability

Pattern

[ Gamma 94 ]

Express architecture to parallelize

Express common architecture involved in parallel mechanism

Page 12: 1998 - Thesis JL Pacherie Parallel perators

RequirementRequirementKnowledge and ReusabilityData Parallelism

Context : Data collection processing

1) Cut-out

From iteration start until iteration end loop action ( current item ) next iterationend

Collection :Aggregation of homogeneous items

Page 13: 1998 - Thesis JL Pacherie Parallel perators

RequirementsRequirementsKnowledge and ReusabilityData Parallelism

Increasing Datasize

Decreasing computationduration

1) Cut out

2) Layout

3) // Processing

Page 14: 1998 - Thesis JL Pacherie Parallel perators

RequirementsRequirementsKnowledge and ReusabilityData ParallelismData Driven Distribution

Parallel Code

Collection

Sequential Code ?

Code Proc 2Code Proc 2

Code Proc 1Code Proc 1

Code Proc 3Code Proc 3

Data LayoutOwner Compute ruleRemote Data RefreshingSPMD

Principles

Page 15: 1998 - Thesis JL Pacherie Parallel perators

ThesisThesis

Design patterns for data parallelism programming

Identify and organize the design pattern dedicatedto data collection processing

Apply the DDD mechanism to these patterns:Parallelization at the software architecture level

Use the design patterns of serialUse the design patterns of serialapplications to introduce parallelismapplications to introduce parallelism

Page 16: 1998 - Thesis JL Pacherie Parallel perators

Design Model for EnumerationDesign Model for EnumerationProcessingProcessing

Operator Design Pattern

Consequences

Introduction

Design Model for ProcessingDesign Model for Processing

Pattern System

Impact of the DDD

Fundamental Services for Data Parallelism

Conclusion

Page 17: 1998 - Thesis JL Pacherie Parallel perators

Towards a pattern...Towards a pattern...

Description of behavior

Behavior vs.. Implementation

Instaciation delegation trough the Factory Method pattern

AbstractClient

FactoryMethod : AbstractProduct

AnOperation

AbstractProduct

Service

…product := FactoryMethodproduct.service...

ConcreteClient

FactoryMethod : ConcreteProduct

ConcreteProduct

Service

!ConcreteProduct!Result

Page 18: 1998 - Thesis JL Pacherie Parallel perators

AbstractSolver

make_matrix : Matrix

solve

Matrix

Item

ConcreteSolver

make_matrix : SparseMatrix

SparseMatrix

Item

Towards a pattern...Towards a pattern...

Description of behavior

Behavior vs. Implementation

Instaciation delegation trough the Factory Method pattern

Page 19: 1998 - Thesis JL Pacherie Parallel perators

Factory Pattern

Extracting iteration domain through the Iterator pattern

ArrayIteratorArray

ConcreteClient

Independence from data structures

AbstractClient

Collection Iterator

collection := make_collectioniteration := collection.make_iterator from iteration.start until iteration.exhausted loop … iteration.nextend

Towards a pattern...Towards a pattern...

Description of behavior

Page 20: 1998 - Thesis JL Pacherie Parallel perators

AbstractClient

Collection Iterator

ArrayIteratorArray

ConcreteClient

Extracting iteration domain through the Iterator patternIndependence from data structures

Towards a pattern...Towards a pattern...

Description of behavior

Factory Pattern

Page 21: 1998 - Thesis JL Pacherie Parallel perators

Extracting control structure

AbstractClient

Collection Operator

collection := make_collectioniteration := collection.make_iterator from iteration.start until iteration.exhausted loop … iteration.nextend

Iterator

Extracting iteration domain through the Iterator pattern

Towards a pattern...Towards a pattern...

Description of behavior

Page 22: 1998 - Thesis JL Pacherie Parallel perators

AbstractClient

Collection Operator

collection := make_collectioniteration := collection.make_iterator operator.attach(iteration)operator.run

Iterator Operator

Extracting control structure

Extracting iteration domain through the Iterator pattern

Towards a pattern...Towards a pattern...

Description of behavior

Page 23: 1998 - Thesis JL Pacherie Parallel perators

ConsequencesConsequences

Separation of the responsibilitiesCollection, Iterator and Operators

The modularity encourage reusability [Meyer 97]

Page 24: 1998 - Thesis JL Pacherie Parallel perators

Redefining implementationUsing the factory method pattern

Data Collections

Processing operators

Iteration domains

Client Product

Application Collection

Operator

IteratorCollection

Application

ConsequencesConsequences

Separation of the responsibilities

Page 25: 1998 - Thesis JL Pacherie Parallel perators

Processing ???!!

ProcessingProcessing

StructuralStructural OperatorOperator

CommandCommand RequestRequest

EnumerativeEnumerative AtomicAtomic

Collections Enumerations

No results With results

List of items One item

Redefining implementation

ConsequencesConsequences

Separation of the responsibilities

Page 26: 1998 - Thesis JL Pacherie Parallel perators

Operators ?

Enumeration Free Monoïd [ A* , ( ) , . ]

Operator Morphism toward [ P , e , + ]

••••[A*, ( ) , . ]

••••[P*, ( ) , . ]

+ + + +[ P , e , + ]

RValuation +Valuation +

List of A

List of P

. +

f : A P

Redefining implementation

ConsequencesConsequences

Separation of the responsibilities

Page 27: 1998 - Thesis JL Pacherie Parallel perators

Operators !

MAP MAP A,B

CROSS CROSS A,B,C

FILTER FILTER A

REDUCE REDUCE A

FORALL FORALL A

BMFBMF

Eval_Morphism Eval_Morphism A,P

Iterator Iterator A

Morphism Morphism A,P

Homomorphism Homomorphism A,B

Operator_C Operator_C A,B

Command & RequestCommand & Request

Iterator Iterator B Morphism Morphism

A,P

Operator_NC Operator_NC A,P

Redefining implementation

ConsequencesConsequences

Separation of the responsibilities

Page 28: 1998 - Thesis JL Pacherie Parallel perators

Pattern SystemPattern System

Designing collections and iterators

Expressing Operators

Using Enumerations

Introduction

Design Model for Processing

Pattern SystemPattern System

Impact of the DDD

Fundamental Services for Data Parallelism

Conclusion

Page 29: 1998 - Thesis JL Pacherie Parallel perators

MethodMethodIdentification of significant characteristics

Accessor

CapacityIndexed

Hashed

LinearIndexed

Dictionary Bounded

Dynamic

FIFO

FILO

Classification with familiesRelations between characteristics

Page 30: 1998 - Thesis JL Pacherie Parallel perators

Specification of abstractions (Collections & Iterators)

A

B

C

a

b

c Abstr

action

MethodMethodIdentification of significant characteristicsClassification with familiesRelations between characteristics

Page 31: 1998 - Thesis JL Pacherie Parallel perators

Application to collectionsApplication to collectionsdeferred class ACCESSORfeature General definitions end

deferred class ACCESSORfeature General definitions end

FamilyFamilyFamilies: Abstract classes

Characteristic

deferred class INDEXED [ITEM,INDEX] inherit ACCESSORfeature read ( i : INDEX ) : ITEM is deferred end write ( i : INDEX ; e : ITEM ) is deferred endend

deferred class INDEXED [ITEM,INDEX] inherit ACCESSORfeature read ( i : INDEX ) : ITEM is deferred end write ( i : INDEX ; e : ITEM ) is deferred endend

Characteristics: Progressive specialization

deferred class COLLECTION [ ITEM ] inherit ACCESSOR CAPACITY ../.. -- Other familiesfeature ../..end

deferred class COLLECTION [ ITEM ] inherit ACCESSOR CAPACITY ../.. -- Other familiesfeature ../..end

collection

AccesseurAccesseur

capacitycapacity

Collections: Abstract classes using families and specializationusing characteristics

Page 32: 1998 - Thesis JL Pacherie Parallel perators

Mix-inMix-in

Indexed

Indexed_Iterator

Writable_Iterator

2Way_Iterator

Indexed

Indexed

Writable

Writable

Two_Way

Two_Way

CharacteristicsCharacteristics

accessors

Iterator

FamiliesFamilies

Application to iteratorsApplication to iterators

• Similar approach

• Characteristics: from the collections, Iterator’s own

• Designed with multiple inheritance

The type constraints are expressed using characteristics combination and not using collection types

Remark :

Collection

Page 33: 1998 - Thesis JL Pacherie Parallel perators

Building an OperatorBuilding an OperatorOperator properties • Items type

• First order function

• Second order function

• Type of enumeration

Implementation • Generic type

• Virtual method (deferred)

• Classification (BMF, etc.)

• Iterator type

Page 34: 1998 - Thesis JL Pacherie Parallel perators

Pattern for IteratorsPattern for IteratorsComposable operator and Iterator

Compositions

Factorization

static

dynamic

Multiplexer Demultiplexer

Page 35: 1998 - Thesis JL Pacherie Parallel perators

Impact of the DDDImpact of the DDD

Deriving the operator pattern

Equivalence Constraint

Introduction

Design Model for Processing

Pattern System

Impact of the DDD Impact of the DDD

Fundamental Services for Data Parallelism

Conclusion

Page 36: 1998 - Thesis JL Pacherie Parallel perators

Deriving the Operator patternDeriving the Operator patternReminder : Operator structure

Redefinition of collections : data distributionParallelisation of processing

AbstractClient

AbstractCollection OperatorIterator

collection := make_collectioniteration := collection.make_iterator operator.attach(iteration)operator.run

ConcreteOperator

ParaOperator

ConcreteIterator

SpreadIterator

SpreadCollection

Enumeration of local data

Enumeration of remote data

Page 37: 1998 - Thesis JL Pacherie Parallel perators

Conformity constraintsSpread collections and Local collectionsSequential and Parallel OperatorsSequential and Parallel execution

Deriving the Operator patternDeriving the Operator patternReminder : Operator structure

Page 38: 1998 - Thesis JL Pacherie Parallel perators

DerivationFactory method : select distributed services

Invocation : local computations

ParaOperator

Spread_Collection

ParaClient

make_collection : Spread_Collection

make_operation : ParaOperator

SeqClient

make_collection : ACollection

AnOperation

make_operation : AnOperatorConcreteOperator

Collection

collection := make_collectionoperator := make_operator(collection) operator.run

make_operation ( collection) : AnOperator isdo !!Result Result.attach(Collection.items)end

make_operation ( collection) : ParaOperator isdo !!Result Result.attach(Collection.local_items)end

Deriving the Operator patternDeriving the Operator patternReminder : Operator structure Conformity constraints

Page 39: 1998 - Thesis JL Pacherie Parallel perators

Parallel Evaluation SchemeParallel Evaluation Scheme

[A*, () , . ]

[ P , e , + ]

F

[ A**, () , . ][ A**, () , . ]DistDist

[ P*, () , . ]

F*

Aggregation

• Morphism (f,e,+)• Distribution

Data :

Intermediate :

• Computation of the local contributions

Result :

• Aggregation of the local contributions

Page 40: 1998 - Thesis JL Pacherie Parallel perators

Equivalence ConstraintEquivalence ConstraintIs there a problem???

Equivalence ConstraintAggregation order of local contributions

Page 41: 1998 - Thesis JL Pacherie Parallel perators

Particular situationsPropriety of morphismsCommutative operator

Morphism

+F ( ) F ( )

+{F ( ) F ( )} F ( )+

F ( ) F ( ) F ( )// Evaluation

Aggregation

Order of aggregation = initial order

Is there a problem???

Equivalence ConstraintEquivalence Constraint

Page 42: 1998 - Thesis JL Pacherie Parallel perators

F ( ) F ( ) F ( )//Evaluation

Inner composition rule is commutative

& : Commutative

&F ( ) F ( )

&{F ( ) F ( )} F ( )&Aggregation

Order of aggregation =/= initial order

& F ( ) F ( )=?=

Particular situationsPropriety of morphisms

Is there a problem???

Equivalence ConstraintEquivalence Constraint

Page 43: 1998 - Thesis JL Pacherie Parallel perators

General situationAn operator defines a partial order

The distribution layout implements this order

Warning : collaboration between operator and layout manager

Particular situationsIs there a problem???

Equivalence ConstraintEquivalence Constraint

Page 44: 1998 - Thesis JL Pacherie Parallel perators

Fundamental Services for Data Fundamental Services for Data ParallelismParallelism

Spreading of the Collections:

Spread Layout

Model of Memory and Communication

Introduction

Design Model for Processing

Pattern System

Impact of the DDD

Fundamental Services for Data ParallelismFundamental Services for Data Parallelism

Conclusion

Page 45: 1998 - Thesis JL Pacherie Parallel perators

Spreading of the CollectionsSpreading of the Collections

Proc

Collection

P1

P0 P2Instance

P1Instance

P2

InstanceP0

ConformityUbiquity of spreaded collections - Local Collection

Page 46: 1998 - Thesis JL Pacherie Parallel perators

ConformitySeparation of concerns

Spread model

Invocation

Id

Key

Owner

Layout

Proc 1 Proc 2

Layout

Dynamic DistributionDynamic DistributionLocal SharingLocal Sharing

Spreading of the CollectionsSpreading of the Collections

Page 47: 1998 - Thesis JL Pacherie Parallel perators

Memory model

Shared Memory

Local Storage

Shared Collections

ConformitySeparation of concerns

Spreading of the CollectionsSpreading of the Collections

Spread model

Page 48: 1998 - Thesis JL Pacherie Parallel perators

Local memoryLocal memory

Local memory

Local memory

Local copy Original

Distributed Collection

Memory model

ConformitySeparation of concerns

Spreading of the CollectionsSpreading of the Collections

Spread model

Page 49: 1998 - Thesis JL Pacherie Parallel perators

Redefinition of the accessors

Granularity

Fundamental Behavior

• read

• write

Use case• sequential (SPMD)

• parallel

Interpretation• local

• remote (distributed, shared, etc.)

• atomic

• enumerative

ConformitySeparation of concerns

Spreading of the CollectionsSpreading of the Collections

Page 50: 1998 - Thesis JL Pacherie Parallel perators

Structure

DIST_MEMORY DIST_MEMORY

SHD_MEMORY SHD_MEMORY SHD_COLLECTIONSHD_COLLECTION

DIST_COLLECTIONDIST_COLLECTION

MEMORY_MODEL MEMORY_MODEL SPREAD_COLLECTIONSPREAD_COLLECTION

SVM_LIBSVM_LIB

POMPOM PVMPVM MPIMPI

MP_APIMP_API

SHD_APISHD_API

Redefinition of the accessors

ConformitySeparation of concerns

Spreading of the CollectionsSpreading of the Collections

Page 51: 1998 - Thesis JL Pacherie Parallel perators

ConclusionConclusion

Experimentation

Assessment

Perspectives

Introduction

Design Model for Processing

Pattern System

Impact of the DDD

Fundamental Services for Data Parallelism

ConclusionConclusion

Page 52: 1998 - Thesis JL Pacherie Parallel perators

ExperimentationExperimentation

Linear Algebra

Genome

Forest Simulation

Contract Intel SSD

Collaboration D. Lavenier

Collaboration M.-A. MoravieLaboratory of Biometrics Lyon

N-Body Application derivation

Shared Memory API User, GC extensionsParagon, Origin2000, PowerChallenge

Origin2000, Clusters

Paragon

Clusters (Myrinet, ATM),Origin2000

Distributed Memory API User (POM) Origin2000, Myrinet, etc.

Theme Context Plate form

NoW

Page 53: 1998 - Thesis JL Pacherie Parallel perators

AssessmentAssessment

Pattern system for enumeration processing

Application of the patterns for data parallelism

Patterns dedicated to data parallelism

Method to design collections, iterators and operators

Page 54: 1998 - Thesis JL Pacherie Parallel perators

PerspectivesPerspectives

Research :

Industry :

Integration of research in the area of functional programming

Validation and conformity of parallel code

Dealing with data dependencies

A pattern system for data collection processing

Library for data collection processing (C++ & STL, Java & JGL, etc.)

Toward an automatic production of the code for parallel patterns