26
The P-Calculus Supratik Mukhopadhyay PEMWS-2 April 6 th 2011

The P-Calculus Supratik Mukhopadhyay PEMWS-2 April 6 th 2011

  • View
    217

  • Download
    0

Embed Size (px)

Citation preview

The P-Calculus

Supratik Mukhopadhyay

PEMWS-2

April 6th 2011

Introduction & Motivation

• Next generation data-intensive exascale computing architectures will have significantly different execution models: – Instead of data moving to work, work should move

to data– Execution should be message-driven– Need to expose different granularities of

parallelism: determinism, non-determinism, dataflow, globally asynchronous locally synchronous (GALS) semantics, …

– Security & Reliability– Fault-tolerance

Motivation (Contd.)

• Communicating Sequential Processes (CSP: Hoare 1978) served as the foundation for MPI

• Limitations of CSP limit existing models with respect to expressiveness in terms of fine granularities of parallelism, fault-tolerance, security, localities, hierarchical partitioning of address spaces, …

• Next generation ubiquitous high performance computing needs new execution models

• What is the CSP for next generation exascale computing? – Abstract formal specification of parallel execution

Existing Specification Formalisms

• Petri Nets• -calculus, CSP, CCS, Pi Calculus, Ambient

Calculus, Actors, Kahn Process Networks, …– Do not support globally asynchronous locally

synchronous semantics– Not message driven– Cannot expose different granularities of

parallelism (deterministic/dataflow, nondeterministic, fine-grained, coarse-grained)

– Does not support work moving to data

The P-calculus: A Specifcation Formalism for Exascale Computation

• Nominal process calculus as a formal execution model for future-generation exascale computation– Has formal operational semantics involving interactions

of external and internal actions• Allows answering questions about the execution

models unambigously• Allows (automatic) checking for inconsistencies and

incompleteness in the execution model• Allows checking (automatically) whether a claimed

implementation of an execution model such as ParalleX or Codelets really implements it

The P-calculus (contd.)

• Uniform representation of synchronous and asynchronous semantics

• Has an equational theory that allows comparison of different implementations of an execution model

• Equipped with a type system (the first order P-calculus) for correctness, security, …

The Untyped P-calculus

• Chromosomes: Primitive computing elements in the P-calculus– Internal Actions– External Actions

• Chromatins• Regulators• Boards• Nucleus

Chromosomes

• Chromosomes are the most basic kind of computational entity defined in the P-Calculus.

• Their role is to execute fundamental computations.

||.|.|::

::

MDDIDED

DC

Object

}... ...{ 11 ln EEIImain

)(),...( 11 kk xmxmprivate

)(),...,( 11 jjkk xmxmpublic

Chromosomes (Contd.)

• Chromosomes may also declare methods:– The set of declared methods is partitioned

into private and public methods.

)}(),...,();(),...,({:: 1111 nnkkkk xmxmxmxmM

Formal Parameters

Internal Actions

• A chromosome may perform either an internal or external action.

|.

|),()^'(:

|

| einstantiatlet ::

''

'

II

contfm

D else DthenIif

DI xI

i

tiatetanins

)x(floor:z

let

einstantiat

)y(getDouble:x

let else )y(getSqr:x

let then 0rand(): if

3

2

1

tiatetanins

))y(getSqr(floorz

let

.

Chromatins

• Chromosomes are only capable of performing sequential computations.

• A Chromatin is defined as a group of coexisting chromosomes organized together by parallel composition.

CnCnCCn |||::

Regulators

• Aside from being executed computations need to be managed.

• Managing computations involves: – Controlling and synchronizing data access– Moving work to data

||.||).(:: RRgrdRxR

RAS1

@T(x)

(y)…@C(y)

y

Regulators – Guarded Commands

• Each regulator is denoted by a deterministic state machine that is defined by a set of guarded commands.

ngrdgrdgrd ::...:::: 1• Each guard is denoted by an event

which triggers an action. At most one of the guards can be triggered by an event

Actegrd i ::

Regulators – Event Language

• Each event can be an atomic event (extending Parnas).

)(|)(|)(|)(:: xxxxe @Comp@C@F@T• Or an event could also be a complex

event.

eeeeee ||::• An action (for now) is the creation of a

chromosome. )(:: CCreateAct

Board

• Regulators can coexist may be composed• A “parallel” composition of regulators is

known as a board.

BBRB |||:: AS2

@T(x)

@C(y)

@F(z)

Nucleus• We can perform computations (via

chromatins and chromosomes)• We can manage computations (via boards

and regulators).• A nucleus is a composition of coexisting

chromatins and boards.

NNCnBN ||||::

AS2

@T(x)

@C(y)

@F(z)

Nucleus

Activity Space

• Computations need a context i.e. a place in which they take place.

• An Activity Space is the context in which a cooperating and coexisting chromatin and a board interacts (i.e., a nucleus exists).

ASASNAS .|][|]||[::

AS1

Example – Activity Spaces and Nuclei

let z = … .<<z>>

let x = … .let y = ….

AS2

@T(x)

@C(y)

@F(z)

System

• A System is a composition of Activity Spaces

• Multilevel hierarchy

External Actions

• Boards and chromatins were capable of performing and coordinating/managing internal computations.

• External actions coordinate computations across Activity Spaces.

KMigE |::

| | :: openoutinMig '^^^:: contK

Example – External Actions

AS1

let z = … .<<z>>

let x = … .let y = ….

AS2

@T(x)

@C(y)

@F(z)

<<foo>>

(foo)

AS3

In AS3

out AS1.in AS2

Operational Semantics – Visual Example

@C(cont)

let x = getInput()

let y = sort(x)^f(sort,cont)

<<y>>^cont’^^’

(y^cont)

let z = shuffle(y)

<<z>>^cont^^’’

()}{;2 getInputReaderC

)}();({; 214 xshufflexsortSorterC

Example – Operational Semantics

'^''cont^;y.einstantiat )'contf(sort,sort(x)^: Sortery letS

Seinstantiat )cont,sort(f()^getInput:Readerx letsortC

'1

'1

'1

()}{;2 getInputReaderC

'.'^^^

)()().^( '

3

3

contz einstantiat shuffle(y): Sorterz letC

CCreatecontconty

@C

)}();({; 214 xshufflexsortSorterC

Example (Cont’d)

]||'[||]||||[ 31421 CRCCC

]||[||]||)...,(())^([ 314 CRCcontsortfgetInputsort

Future Work

• First Order P-calculus• Confluence Properties• Tool Building• Query Languages

Questions?