View
14
Download
0
Category
Preview:
Citation preview
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: patrizio.dazzi@isti.cnr.it
venerdì 23 ottobre 2009
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
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
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
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
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
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
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
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
Distributed systems: paradigms and models (M. Danelutto) Slide #
Questions ?
10
venerdì 23 ottobre 2009
Recommended