Master 1 Informatique | Programmation Répartie et Architecture N Tiers |
TD-TP - n°5 : ProActive - 2 | |
Durée: 3H | |
Denis Caromel, Brian Amedro | |
Université Nice-Sophia Antipolis, Département Informatique |
Download this archive.
A first principle is to fully eliminate from the source code the following elements:
A second key principle is the capability to abstractly describe an application, or part of it, in terms of its conceptual activities. The description should indicate the various parallel or distributed entities in the program. For instance, an application that is designed to use three interactive visualization nodes, a node to capture input from a physics experiment, and a simulation engine designed to run on a cluster of machines should somewhere clearly advertise this information.
Now, one should note that the abstract description of an application and the way to deploy it are not independent piece of information. If for example, we have a simulation engine, it might register in a specific registry protocol, and if so, the other entities of the computation might have to use that lookup protocol to bind to the engine. Moreover, one part of the program can just lookup for the engine (assuming it is started independently), or explicitly create the engine itself. To summarize, in order to abstract away the underlying execution platform, and to allow a source-independent deployment, a framework has to provide the following elements:
Moreover, a Virtual Node is a concept of a distributed program or component, while a Node is actually a deployment concept: it is an object that lives in a JVM, hosting Active Objects. There is of course a correspondence between Virtual Nodes and Nodes: the function created by the deployment, the mapping. This mapping is specified in the Application Descriptor. The grid facilities are described in two deployment descriptor separated by the different concerns of the application developer and grid infrastructure administrator. In the grid deployment descriptor we describe:
Look at and study the descriptor files GCMD_Local.xml
, GCMD_SSH.xml
and GCMA.xml
.
Q | Write a Deployment Descriptor and an Application Descriptor file to deploy your ProActive application onto the classroom's machines. |
---|
Now, we will see how to start a monitoring agent on a remote machine using the deployment methods explained previously. To be able to deploy on remote machines we just have to use the deployment file, add a method that tells ProActive to activate the nodes used and tell the active object to start on the remote node.
We will use different classes:
org.objectweb.proactive.extensions.gcmdeployment.PAGCMDeployment
- used to create a GCMApplication from an Application Descriptororg.objectweb.proactive.gcmdeployment.GCMApplication
- represents the application which is being deployedorg.objectweb.proactive.core.ProActiveException
- used to catch exceptionorg.objectweb.proactive.gcmdeployment.GCMVirtualNode
- used to control and instantiate virtual node objectsorg.objectweb.proactive.core.node.Node
- used to control and instantiate node objectsQ |
|
---|
Now, we will show how to use groups of active objects. We will create several active objects that we add and remove from a group. The group will be used to retrieve the a State object from all the active objects in the group. In order to ease the use of the group communication, ProActive provides a set of static methods in the PAGroup class and a set of methods in the Group interface. ProActive also provides typed group communication, meaning that only methods defined on classes or interfaces implemented by members of the group can be called. There are several ways to create groups of active objects. Similar to active objects, we have instantiation based creation and object based creation. Instantiation based creation is done through newGroup(..) and newGroupInParallel while object based creation is done through turnActiveAsGroup(...).
To deal with ProActive Groups, we will have to work with two main classes:
org.objectweb.proactive.api.PAGroup
- used to create a group of active objectsorg.objectweb.proactive.core.group.Group
- used to control the group of objectsQ |
|
---|
SPMD stands for Single Program Multiple Data, which is a technique used in parallelizing applications by separating task and running them simultaneously on different machines or processors. ProActive allows the use of object oriented programming combined with the SPMD techniques. ProActive uses group communication with SPMD in order to free the programmer from having to implement the complex communication code required for setting identical groups in each SPMD activity. Group communication allows the focus to be on the application itself and not on the synchronizations. An SPMD group is a group of active objects where each one has a group referencing all the active objects. This chapter presents the mechanism of typed group communication as an new alternative to the old SPMD programming model. While being placed in an object-oriented context, this mechanism helps the definition and the coordination of distributed activities. The approach offers a better structuring flexibility and implementation through a modest size API. The automation of key communication mechanisms and synchronization simplifies code writing. The typed group communication system can be used to simulate MPI-style collective communication. Contrary to MPI that requires all members of a group to collectively call the same communication primitive, our group communication scheme makes possible for one activity to call methods on the group.
The main class for the SPMD groups is org.objectweb.proactive.api.PASPMD
.
This class contains methods for creating and controlling ProActive SPMD groups.
For this exercise, we want to distribute a Primality test using the SPMD API. Our test will be a naive one:
private boolean isPrime(long candidate, long begin, long end) { for (long divider = begin; divider < end; divider++) { if ((candidate % divider) == 0) { return false; } } return true; }This test has to be performed on the range [2;ceil(sqrt(n))]. Distribution will consist on making the test with subranges on different machines.
Q |
"From scratch", develop a small ProActive program to distribute our Primality test. You have write two classes:
|
---|
Q |
Use the ProActive immediate services to know which is the current divider for a given active object |
---|