Below we describe some of the issues and include a chart that describes what combinations should work.
Antoon Goderis, Christopher Brooks, Ilkay Altintas, Edward A. Lee, Carole Goble. Composing Different Models of Computation in Kepler and Ptolemy II, 2007 Proceedings, International Conference on Computational Science (ICCS), May, 2007.See also the ancillary site for the paper.
Although prior work has offered formalisms for comparing MoCs, e.g. [Lee & S.V. 98], MoC compositions have not been well treated. To address the void, we develop a classification of valid MoC combinations in Kepler/Ptolemy II.
In the Kepler environment, opaque composite actors can be put into workflows with a different type of director, thereby combining different models of computation in one workflow. The choice of director determines whether a given actor can be put on the inside or outside of other actors.
To determine which combinations are possible, we need to know two things about a director:
If a director’s exported properties match those assumed by another director, then it can be used within that other director. Otherwise, it cannot. If the SDF director exports properties that match those assumed by the PN director, then the SDF can be used inside PN. The properties in question can be formulated in terms of actor abstract semantics.
All models of computation in Kepler and Ptolemy II share a common abstraction that we call the actor abstract semantics.
Actors and directors are instances of Java classes that implement the Executable interface, which defines action methods. The action methods include two distinct initialization methods:
The action methods also include three distinct execution methods that are invoked in sequence repeatedly during an execution of the workflow:
Finally, there is a finalization method:
All of the methods are required to be finite (they must eventually return).
The method definitions specify a contract, but not all actors obey this contract. Any actor that strictly conforms to this contract is said to be domain polymorphic, and the actor may be used by any director that operates on actors (which is all the directors above except FSM, which operates on states).
Actors that do not obey the contract are more specialized, and may only work with specific directors. They are not domain polymorphic (strictly obeying the actor abstract semantics) and come in two flavors. The first flavor obeys a looser version of the abstract semantics where the fire() method provides no assurance that the state of the actor is unchanged. The second is still looser in that it that also provides no assurance that any of these methods is finite.
Based on these three levels of obeyance to actor abstract semantics, we can now classify the directors.
The PN director only assumes the loosest of these abstract semantics. It does not require that any method be finite because it invokes all of these methods, in order, in a thread that belongs entirely to the actors. If an actor chooses to run forever in the preinitialize() method, that does not create any problems for the director. The director will happily let it run. Dataflow directors require that actors conform with the loose actor semantics, where all methods are finite. But they do not require that actors leave the state unchanged in the fire() method. CT requires that actors obey the strictest form of the semantics. The director iteratively fires actors until some condition is satisfied. The strict actor semantics ensures that the answers will always be the same given the same inputs. FSM requires loose actor semantics. A firing of an FSM in Ptolemy II consists of a firing of the refinement of the current state (if there is one), followed by evaluation of the guards and a state transition. Clearly, the firing of the refinement must be finite for this to be useful.
A director also implements the Executable interface. If a director conforms to the strict actor semantics, then any opaque composite actor containing that director also conforms to the contract. Such a director can be used safely within opaque composite actors that use any of the directors. None ot the directors conforms to the strict actor semantics in the current version of Ptolemy II (version 6.0). The undiscussed SR director does however and in principle CT and DE can be made to conform. Currently these and the dataflow directors all conform to the looser version of the abstract semantics, but still guarantee that all methods return after finite time. PN only conforms to the loosest version, providing no guarantees about methods ever returning. The FSM director exports whatever the state refinements export.
We classify directors according to two criteria. They require that the actors they control are either strict, looser, or loosest, depending on whether they must conform with the strictest, looser, or loosest form of abstract semantics. They similarly export either strict, looser, or loosest. Ideally, any director should export the same version of the contract it assumes or a stricter version, but this is not the case in currently.
The current status of the directors is given in Table 1. The rule applied to determine director compatibility is that exported abstract semantics should be stricter or equal to required abstract semantics. The table is on-line (http://www.mygrid.org.uk/wiki/Papers/IccsPaper2007) and will evolve over time. Where available, the on-line version links each entry to example actors.
Table 1. Rules for hierarchically mixing directors in Kepler and Ptolemy II
Inner director ↓ (exports X) |
Outer director ↓
(requires Y) |
||||||
PN | SDF | DDF | CT | DE | SR | FSM | |
(loosest) | (loose) | (loose) | (strict) | (loose) | (strict) | (loose) | |
PN (loosest) | Yes | No | No | No | No | No | No |
SDF(loose) | Yes | Yes | Yes | No | Yes | No | Yes |
DDF(loose) | Yes | Yes | Yes | No | Yes | No | Yes |
CT (loose) | No | Yes | Yes | No | Yes | Yes | Yes |
DE (loose) | No | Yes | Yes | Yes | Yes | No | Yes |
SR (strict) | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
FSM (refinement) | Yes if the refinement is stricter than or equal to Y |
A key question may arise at this point. If actors can be made domain polymorphic by conforming to the strict actor semantics, then why not design all directors to conform? In some cases, the semantics of the MoC precludes this. In other cases, it would simply be too costly. We examine some of these cases.
PN. The PN director is apparently the least restrictive in the actors it can manage, but also the least useful in an opaque composite actor. The reason for this is very fundamental. If the PN director were to define a finite fire() method, what should that method do? Each of the actors under its control is executing in its own thread of control. How much execution should be performed? One possible answer is "as little as possible," but this would result in nondeterminate execution. If two actors have threads that are able to perform computation, which should be allowed to perform computation? The only other obvious answer is "as much as possible." This can be made determinate, but typical PN workflows can execute forever if given the opportunity. Hence, "as much as possible" turns out to be an infinite amount. Sometimes it is finite, in that a PN model may deadlock after a finite computation. However, PN is sufficiently expressive that determining whether a workflow deadlocks is equivalent to solving the famous halting problem in computation. Hence, whether a workflow deadlocks is undecidable [Buck 93].
When a workflow has potential to be reused inside others, PN should be avoided and, if possible, replaced by a more reusable director.
DDF. DDF is as expressive as PN, and hence potentially suffers from the same limitation. However, DDF has an advantage. It assumes that all actors under its control have finite firings. Thus, it is relatively easy for the designer of a workflow to specify how many firings of the component actors constitute a single firing of the enclosing opaque composite actor. The DDF director assumes a simple default if these numbers are not given by the workflow designer: one firing of a DDF opaque composite actor constitutes at most one firing of each component actor. The actor is fired if possible, and not fired if not, given the available input data. This yields a simple, finite, and determinate notion of a finite firing for the director to export.
SDF. SDF is still simpler in that it is not as expressive as PN, and there is a simple unique finite firing that is natural and easy to define [Lee & Messerschmitt 87]. However, for both DDF and SDF, it is difficult to define a fire() of an opaque composite actor that does not update the state of the workflow because data values stored on buffers change during the firing of the component actors. In order for SDF and DDF to export the strict actor semantics, they would have to backtrack or restore the state of these buffers on repeated invocations of the fire() method. While this is doable in principle, it might be sufficiently computationally expensive that it is not worth it. A promising technique, however, that could make it computationally attractive is the lightweight backtracking mechanism developed in [Feng & Lee 06].
FSM. A particularly interesting case is FSM and modal models. Modal models always use opaque composite actors as state refinements, and these must at a minimum have finite firings to be useful (given the semantics of an FSM in Ptolemy II discussed before). Hence, it does not make sense to use PN inside the refinement of a state. But any other of the directors described above can be used in a Modal Model.
Click on the + or - to see examples that work and don't work.
Note that not all combinations make semantic sense.
Outer Director
(requires Y) |
|||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CSP | Rendezvous | PN | CT | DDF | DE | FSM | Giotto | GR | PSDF | SDF | Continuous | DE2 | SR | ||
(loosest) | (loosest) | (loosest) | (strict) | (loose)4 | (loose) | (loose) | (loose)5 | (loose) | (loose) | (strict) | (strict) | (strict) | |||
Inner Director (exports X) |
CSP (loosest) | ||||||||||||||
Rendezvous (loosest) | |||||||||||||||
PN (loosest) | PN/PN - | DE/PN - | |||||||||||||
DDF (loose) | CSP/DDF | PN/DDF | DDF/DDF | DE/DDF | FSM/DDF | ? | PSDF/DDF | SDF/DDF +, +, + | |||||||
CT (loose) | CSP/CT | Rendezvous/CT | PN/CT | CT/CT3 CT was removed between Ptolemy II 8.0 and 10.0. $PTII/ptolemy/domains/ct/test/auto/CTCompositeActor.xml +, $PTII/ptolemy/domains/ct/test/auto/CTCompositeActor2.xml +, $PTII/ptolemy/domains/ct/test/auto/CTCompositeActor3.xml +, $PTII/ptolemy/domains/ct/test/auto/CTCompositeActor4.xml +, $PTII/ptolemy/domains/ct/test/auto/CTCompositeActor5.xml + | DDF/CT | DE/CT $PTII/ptolemy/domains/ct/demo/CTInsideDE/CTInsideDE.xml +, $PTII/ptolemy/domains/ct/demo/SigmaDelta/SigmaDelta.xml +, $PTII/ptolemy/domains/ct/test/auto/CTInsideDESimplel.xml + | FSM/CT | ? | GR/CT + | PSDF/CT | SDF/CT | ||||
SDF (loose) | CSP/SDF + | Rendezvous/SDF +, + | PN/SDF +, - +, + | CT/SDF $PTII/ptolemy/domains/ct/demo/CarTracking/CarTracking.xml + + | DDF/SDF + | DE/SDF + | FSM/SDF | ? | GR/SDF + | PSDF/SDF | SDF/SDF + | SR/SDF +, -, - | |||
PSDF (loose) | CSP/PSDF | Rendezvous/PSDF | PSDF/PSDF + | CT/PSDF | DDF/PSDF | DE/PSDF | FSM/PSDF | ? | GR/PSDF | PN/PSDF + | PSDF/PSDF | SR/PSDF | |||
DE (loose) | PN/DE< + | CT/DE +, + | DDF/SDF | DE/DE + | FSM/DE | ? | GR/DE | PSDF/DE | ? | ||||||
FSM (refinement) | CSP/FSM1 | RendezvousCSP/FSM1 | PN/FSM1 | CT/FSM2 $PTII/ptolemy/domains/ct/demo/Switch/Switch.xml+ | DDF/FSM1 | DE/FSM1 + | FSM/FSM | ? | GR/FSM | PSDF/FSM1 | SDF/FSM1 + | Continuous/FSM1 + | DE2/FSM1 | SR/FSM1 | |
Giotto | ? | ? | ? | ? | ? | DE/Giotto + | ? | Giotto/Giotto + | ? | ? | ? | ? | ? | ? | |
Continuous(strict) | CSP/Continuous | Rendezvous/Continuous | PN/Continuous | CT/Continuous | DDF/Continuous | DE/Continuous + | FSM/Continuous + | ? | GR/Continuous | PSDF/Continuous | SDF/Continuous | Continuous/Continuous + | DE2/Continuous | SR/Continuous | |
DE2(strict)6 | CSP/DE2 | Rendezvous/DE2 | PN/DE2 | CT/DE2 | DDF/DE2 | DE/DE2 | FSM/DE2 | ? | GR/DE2 | PSDF/DE2 | SDF/DE2 | Continuous/DE2 | DE2/DE2 | SR/DE2 | |
GR(strict) | CSP/GR | Rendezvous/GR | PN/GR | CT/GR $PTII/ptolemy/domains/ct/demo/BouncingBall/BouncingBall.xml +, $PTII/ptolemy/domains/ct/demo/CartPendulum/CartPendulum.xml +, $PTII/ptolemy/domains/ct/demo/NewtonsCradle/NewtonsCradleAnimated.xml + | DDF/GR + | DE/GR + | FSM/GR | ? | GR/GR | PSDF/GR | SDF/GR + | Continuous/GR + | DE2/GR | SR/GR | |
SR(strict) | CSP/SR +, + | Rendezvous/SR | PN/SR +, +, -, - | CT/SR | DDF/SR | DE/SR + | FSM/SR | ? | GR/SR | PSDF/SR | SDF/SR +, +, - | Continuous/SR | DE2/SR | SR/SR + |
The rules are
Loose goes into Loose Loose goes inside Strict Strict goes inside Strict
Last updated $Id$