skeleton programming environments programming with

10
Master Degree (Laurea Magistrale) in Computer Science and Networking Academic Year 2009-2010 Skeleton programming environments Programming with ProActive Calcium Step-by-step Patrizio Dazzi ISTI - CNR Pisa Research Campus mail: [email protected] venerdì 23 ottobre 2009

Upload: others

Post on 06-Jan-2022

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Skeleton programming environments Programming with

Master Degree (Laurea Magistrale) inComputer Science and Networking

Academic Year 2009-2010

Skeleton programming environmentsProgramming with ProActive Calcium Step-by-step

Patrizio Dazzi ISTI - CNRPisa Research Campusmail: [email protected]

venerdì 23 ottobre 2009

Page 2: Skeleton programming environments Programming with

Distributed systems: paradigms and models (M. Danelutto) Slide #

Practical classes material

• Most of the files presented during this week are now available

• download from: http://www.isti.cnr.it/People/P.Dazzi/

• teaching blog still under construction !!!

• Tentative Question time for practical classes

• On monday, from 4 p.m. till 6 p.m.

• if it overlaps with your lessons send me a mail

2

venerdì 23 ottobre 2009

Page 3: Skeleton programming environments Programming with

Distributed systems: paradigms and models (M. Danelutto) Slide #

Outline

• Recapping ProActive model

• programming with futures

• Write/Compile/Run a Task Parallel Skeleton

• Step-by-step description using Eclipse

• Recapping how-to Install ProActive

• Software needed

• environmental variables

3

venerdì 23 ottobre 2009

Page 4: Skeleton programming environments Programming with

Distributed systems: paradigms and models (M. Danelutto) Slide #

Programming with Futures

• Typically used in RMI or RMI-like based communication models

• A Future represents the result of an asynchronous computation. Typically, it defines proper methods

• to check if the computation has been completed

• to wait for its completion, and to retrieve the result of the computation.

• From a more theoretical point of view this inter-object synchronization policy is known as wait-by-necessity

4

venerdì 23 ottobre 2009

Page 5: Skeleton programming environments Programming with

Distributed systems: paradigms and models (M. Danelutto) Slide #

A Future example

5

Object A Object B

RMI invocation without Futures

res = B.method();method(){ ... return value;}

Now value is available

value

venerdì 23 ottobre 2009

Page 6: Skeleton programming environments Programming with

Distributed systems: paradigms and models (M. Danelutto) Slide #

A Future example

6

Object A Object B

RMI invocation with Futures

method(){ ... return value;}put value in

the container already sent

res = B.method();

empty container

If the res variable is not accessed the computation can continue

venerdì 23 ottobre 2009

Page 7: Skeleton programming environments Programming with

Distributed systems: paradigms and models (M. Danelutto) Slide #

A Pipeline Example

7

Skeleton<Integer, String> root = new Pipe<Integer, String>(new Incr(), new StringMaker());

int->double double->string

int->string

main

venerdì 23 ottobre 2009

Page 8: Skeleton programming environments Programming with

Distributed systems: paradigms and models (M. Danelutto) Slide #

A Farm Example

8

Skeleton<Integer, Integer> root = new Farm<Integer, Integer>(new Worker());

main

int->intint->int

venerdì 23 ottobre 2009

Page 9: Skeleton programming environments Programming with

Distributed systems: paradigms and models (M. Danelutto) Slide #

Compiling a Calcium Application

• Java Compiler, version >= 5

• use sun complier, if possible

• Add to the Java CLASSPATH the jar file in dist/lib

• a lot of jar files!

• Use javac <source code>

9

venerdì 23 ottobre 2009

Page 10: Skeleton programming environments Programming with

Distributed systems: paradigms and models (M. Danelutto) Slide #

Questions ?

10

venerdì 23 ottobre 2009