22
Managed by Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

  • View
    226

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

Managed by

Applying the collective entity concept to POP-C++

Pierre Kuonen & Christian Pérez

EIA-Fr & INRIA

WP3 – Task 3.1

Krakow Meeting, June 27th 2006

Page 2: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 2

Outline

• Context• Collective entities• POP-C++• Collective entities in POP-C++• Conclusion

Page 3: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 3

Context

• Work started during a short visit of Christian Pérez to EIA-Fr (January 2006)

• Collective entity: set up to specify MxN communications between two parallel codes– Originally developed for distributed parallel

objects (PaCO++) and components (GridCCM)

• POP-C++: object oriented programming model for based on task programming

Page 4: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 4

Collective entity : issue

Parallel code A Parallel code B

MPI PVM

How to easily and efficiently handle MxN communications?

Page 5: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 5

Collective entity: objective

HPCEntity

A

HPCEntity

B

What the application designer should see…

… and how it must be implemented!

Coll. Entity. A Coll Entity B

Page 6: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 6

Collective entity : overview (1/3)

• Abstract model• Foundation for building other models

– CE + CORBA = PaCO++: Distributed parallel objects– CE + CCM = GridCCM: Distributed parallel components

• Made of four models– Definition of a distributed collective entity– Connection and communication model

• Dynamic and parallel connections

– MxN data management model• Support for unlimited data redistribution methods

– Exception handling model in a communication

Page 7: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 7

Collective entity : overview (2/3)

• Definition of a distributed collective entity– May have managers

a) an entity

eb) a distributed entity

e

c) a collective entity

State

Internal communication

capabilitye0

e1

en

d) a distributed collective entity (general case)

e0

e1

en

m0

mn

Page 8: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 8

Collective entity : overview (3/3)

• Specialization: the connection managers– Input proxy

• Enable a unique (logical) connection point• Hide the parallel nature of the collective entity

– Output proxy• Deals with out connection requests• Deals with the scalar or parallel nature of remote entity

e) a collective entity (specialized case)

e0

e1

en

OutProxy

InProxyi j

Page 9: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 9

The POP Model: Parallel OO ProgrammingObject oriented application Grid environment

execute

• Heterogeneous• Large scale• Unstructured• Dynamic and unknown topology

• Distributed objects• Heterogeneous• Dynamic• “Autonomous”

ObjectObj

Object

ObjectObject

Object

Page 10: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 10

POP: An extension of the OO sequential model

• Generalization of the concept of (sequential) object– But objects can be “efficiently” executed on different

machines ….nevertheless modifies as little as possible the OO sequential semantic

• The “good” proprieties of OO programming paradigm must be conserved– Encapsulation, Interaction by method invocations, Inheritance,

Polymorphism,…• Parallel object

– Various method invocation semantics– Transparent and dynamic object allocation guided by the

object resources need.– Shareable, “transmissible”– No explicit send/receive – No (as few as possible) loss of performance

Page 11: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 11

POP: communication model

• The POP model uses the Inactive objects model– Objects are active only when an method is invocated– Asynchronous method invocation is possible

• The POP model defines three ways to execute a method– Concurrent

• No order no atomicity

– Sequential• Ordered and atomic regarding others sequential methods

invocations

– Mutex• Totally ordered and atomic

Page 12: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 12

Method call semantics: example

O1 O2

O 2.Mseq()

D ela yed

D ela yed

D ela yed

D ela yed

O 2.Mseq()

O 2.Mconc ()

O 2.Mm ut()

O 2.Mconc ()

O 2.Mconc ()

O 2.Mseq()

Page 13: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 13

POP-C++: exemple

File: integer.h

1: class Integer {

2: public:

3: Integer(int wanted, int mini);

4: Integer(char *machine);

5: void Set(int val);

6: int Get();

7: void Add(Integer &other);

8: private:

9: int data;

10: };

parclass Integer {

@{power>=wanted?: mini;};

@{host=machine;};seq async void Set(int val);

conc int Get();mutex void Add(Integer &other);

Page 14: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 14

Collective entity and POP-C++

• Objective– Support parallel object implementation

• Example: embed a MPI code into a POP-C++ object• Definition

– A “collective entity” in POP-C++ is a collection (list) of objects of the same class acting altogether as an SPMD program

• Features:– Invoke a method on all elements (global view)– Invoke a method on a particular element (individual view)

Object

e0

e1

en

OutProxy

InProxyObject

Page 15: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 15

Collective method

• Rationale– Enable a method to be collectively called on all

elements of the collective entity– Support for distributed parameters

• Declare with a dedicated keyword: coll

float x[6]=

o

b0

b1

b2

ipb opb

a0

a1ipa opa

void foo(float x[])void bar(float x[])

Page 16: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 16

Group invocation (special case)

• Rationale– Invoke the method on all the elements of the collective

entity– The parameters are replicated (broadcast mode)

• Declare with a dedicated keyword: all

void bar(float x[])

b0

b1

b2

ipb opb

a0

a1ipa opao

float x[6]=

void foo(float x[])

Page 17: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 17

Scalar method in collective entity

• Rationale– Invoke a scalar method of a collective entity

• Define the selected element of the collective entity• 4 “regular” cases have been selected

– first: the first instance of the collection– last: the last instance of the collection– any: any instance of the collection can be selected– random: the instance is randomly chosen

b0

b1

b2

ipb opbo

Page 18: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 18

POP-C++ and collective entity: example

class MySPMDclass

{

public:

coll async conc void doComputation(…);

first sync mutex float getResult(…);

sync seq void aMethod(…);

};

=> Structural keywords (coll,first, …) are orthogonal to behavioral keywords (sync, async, …)

Page 19: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 19

Helper template to create collective object

• Two possibilities

– Add a new keyword to the language

– Use a template

• Second solution preferred

template <parclass SPMDproc>

parclass POPspmd

{

public:

POPspmd(); // n = 1

POPSpmd(int n);

SPMDproc* getSPMDprocRef(int no);

int getSPMDsize();

};

Page 20: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 20

Example of use (1/2)

// Create a collective entity of 10 elements

POPsmpd<MySPMDclass> mySPMDobject(10);

// collective call from any kind of object

mySPMDobject.doComputation(); // method is coll

// retrieve the result

float r = mySPMDobject.GetResult() // method is first

// retrieve the result from proc 4

float r = mySPMDobject.GetSPMDProcRef(4)->GetResult();

Page 21: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 21

Handling distributed data

• Current rationale– Attach a distribution to parameters– Define distribution as template

• Inherit from dataDistribution interface Contains methods called by the runtime to compute MxN

communication as define in the collective entity model• Example: block cyclic for vectors

template <T> class BCvector<vector<T>> : public dataDistribution {public:

// methods for “end-user”…// methods from dataDistribution… computeSchedule(…);…

private:vector<T> data; // example of private data to storeunsigned offset; // the local part of the vector

}

Page 22: Applying the collective entity concept to POP-C++ Pierre Kuonen & Christian Pérez EIA-Fr & INRIA WP3 – Task 3.1 Krakow Meeting, June 27 th 2006

European Research Network on Foundations, Software Infrastructures and Applications for large scale distributed, GRID and Peer-to-Peer Technologies 22

Conclusion

• Joint work– Apply the collective entity model to POP-C++

• Most of the rationale has been set up– Not presented: support of reduction operations – Specializations of the CE for POP-C++

• Individual access to any element of the CE

• Peaceful cohabitation of– Regular C++ method,

– “Scalar” POP-C++ methods, and

– Collective methods!

• Perspective

– Finish the rationale for the TR