Class DistributedSDFDirector
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.actor.Director
-
- ptolemy.actor.sched.StaticSchedulingDirector
-
- ptolemy.domains.sdf.kernel.SDFDirector
-
- ptolemy.distributed.domains.sdf.kernel.DistributedSDFDirector
-
- All Implemented Interfaces:
java.lang.Cloneable
,Executable
,Initializable
,PeriodicDirector
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class DistributedSDFDirector extends SDFDirector
Director for the distributed version of the synchronous dataflow (SDF) model of computation.Distributed-SDF overview
The Distributed-SDF domain is an extended version of the existing SDF Domain that performs the simulation in a distributed manner.Requirements
- A distributed platform is required to perform the simulation.
- Every node in the distributed platform has to run a server application (DistributedServerRMIGeneric).
- A Jini service locator must be running on one of the nodes (peer discovery).
Features
- Exploits the degree of parallelism that many models expose in their topology.
- The distributed execution is transparent to the user.
- Keeps the existing software architecture untouched, only extending it. (Except some minor modifications in the SDFScheduler).
- It achieves smaller simulation times for models with certain degree of parallelism, specially those were: cost(computation) >>>> cost(communication).
- Allows for bigger models (in terms of memory consumption).
A DistributedSDFDirector is the class that controls execution of actors under the distributed version of the SDF domain. It extends SDFDirector.
By default, actor scheduling is handled by the DistributedSDFScheduler class. Furthermore, the newReceiver method creates Receivers of type DistributedSDFReceiver, which extends SDFReceiver.
See ptolemy.domains.sdf.kernel.SDFScheduler for more information about the SDF Domain.
Parameters
- The parallelSchedule parameter of this director determines whether a sequential or parallel schedule will be performed. The default value of the parallelSchedule parameter is a BooleanToken with the value false.
- The parallelExecution parameter of this director determines whether a sequential or parallel execution will be performed. The default value of the parallelExecution parameter is a BooleanToken with the value false.
- Since:
- Ptolemy II 5.1
- Version:
- $Id$
- Author:
- Daniel Lazaro Cuadrado (kapokasa@kom.aau.dk)
- See Also:
DistributedServerRMIGeneric
,DistributedSDFReceiver
,DistributedSDFScheduler
,SDFDirector
,SDFScheduler
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Red (kapokasa)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description Parameter
parallelExecution
A Parameter representing whether a sequential or parallel execution will be performed.Parameter
parallelSchedule
A Parameter representing whether a sequential or parallel schedule will be computed.Parameter
pipelining
A Parameter representing whether a pipelined parallel execution will be performed.-
Fields inherited from class ptolemy.domains.sdf.kernel.SDFDirector
_iterationCount, _periodicDirectorHelper, allowDisconnectedGraphs, allowRateChanges, AUTO_INTTOKEN, AUTO_NAME, constrainBufferSizes, iterations, ITERATIONS_NAME, period, synchronizeToRealTime, UNBOUNDED_INTTOKEN, UNBOUNDED_NAME, vectorizationFactor
-
Fields inherited from class ptolemy.actor.sched.StaticSchedulingDirector
_postfireReturns, _prefire
-
Fields inherited from class ptolemy.actor.Director
_actorsFinishedExecution, _aspectForActor, _aspectsPresent, _defaultMicrostep, _executionAspects, _finishRequested, _initializables, _nextScheduleTime, _stopRequested, _tokenSentToCommunicationAspect, _zeroTime, localClock, startTime, stopTime
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
-
-
Constructor Summary
Constructors Constructor Description DistributedSDFDirector()
Construct a director in the default workspace with an empty string as its name.DistributedSDFDirector(CompositeEntity container, java.lang.String name)
Construct a director in the given container with the given name.DistributedSDFDirector(Workspace workspace)
Construct a director in the workspace with an empty name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
attributeChanged(Attribute attribute)
React to a change in an attribute.void
fire()
Calculate the current schedule, if necessary, and iterate the contained actors in the order given by the schedule.void
initialize()
Initialize the actors associated with this director (super).Receiver
newReceiver()
Return a new receiver consistent with the Distributed-SDF domain.void
preinitialize()
Preinitialize the actors associated with this director and compute the schedule (super).void
wrapup()
Invoke the wrapup() method of all the actors contained in the director's container (super).-
Methods inherited from class ptolemy.domains.sdf.kernel.SDFDirector
clone, createSchedule, fireAt, getIterations, getModelNextIterationTime, periodValue, postfire, prefire, suggestedModalModelDirectors, supportMultirateFiring, transferInputs, transferOutputs
-
Methods inherited from class ptolemy.actor.sched.StaticSchedulingDirector
_setScheduler, addDebugListener, getScheduler, invalidateSchedule, isScheduleValid, removeDebugListener, resumeActor, setScheduler
-
Methods inherited from class ptolemy.actor.Director
_actorFinished, _consultTimeRegulators, _description, _isEmbedded, _isTopLevel, _schedule, _transferInputs, _transferOutputs, addInitializable, defaultDependency, delayDependency, elapsedTimeSinceStart, finish, fireAt, fireAt, fireAtCurrentTime, fireContainerAt, fireContainerAt, getCausalityInterface, getCurrentTime, getDeadline, getEnvironmentTime, getExecutionAspect, getGlobalTime, getModelStartTime, getModelStopTime, getModelTime, getNextIterationTime, getStartTime, getStopTime, getTimeResolution, implementsStrictActorSemantics, initialize, invalidateResolvedTypes, isEmbedded, isFireFunctional, isStopRequested, isStrict, iterate, mutexLockObject, notifyTokenSentToCommunicationAspect, preinitialize, removeInitializable, requestInitialization, resume, scheduleContainedActors, setContainer, setCurrentTime, setEmbedded, setModelTime, setTimeResolution, stop, stopFire, suspend, terminate, transferOutputs
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, removeInitializable
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
Methods inherited from interface ptolemy.actor.util.PeriodicDirector
isEmbedded
-
-
-
-
Field Detail
-
parallelSchedule
public Parameter parallelSchedule
A Parameter representing whether a sequential or parallel schedule will be computed. This parameter must be a boolean. The default value is false BooleanToken.
-
pipelining
public Parameter pipelining
A Parameter representing whether a pipelined parallel execution will be performed. A pipelined execution only makes sense when parallel execution is true. This parameter must be a boolean. The default value is false BooleanToken.
-
parallelExecution
public Parameter parallelExecution
A Parameter representing whether a sequential or parallel execution will be performed. This parameter must be a boolean. The default value is false BooleanToken.
-
-
Constructor Detail
-
DistributedSDFDirector
public DistributedSDFDirector() throws IllegalActionException, NameDuplicationException
Construct a director in the default workspace with an empty string as its name. The director is added to the list of objects in the workspace. Increment the version number of the workspace. The DistributedSDFDirector will have a default scheduler of type DistributedSDFScheduler.- Throws:
IllegalActionException
- If the name has a period in it, or the director is not compatible with the specified container.NameDuplicationException
- If the container already contains an entity with the specified name.
-
DistributedSDFDirector
public DistributedSDFDirector(Workspace workspace) throws IllegalActionException, NameDuplicationException
Construct a director in the workspace with an empty name. The director is added to the list of objects in the workspace. Increment the version number of the workspace. The DistributedSDFDirector will have a default scheduler of type DistributedSDFScheduler.- Parameters:
workspace
- The workspace for this object.- Throws:
IllegalActionException
- If the name has a period in it, or the director is not compatible with the specified container.NameDuplicationException
- If the container already contains an entity with the specified name.
-
DistributedSDFDirector
public DistributedSDFDirector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct a director in the given container with the given name. The container argument must not be null, or a NullPointerException will be thrown. If the name argument is null, then the name is set to the empty string. Increment the version number of the workspace. The DistributedSDFDirector will have a default scheduler of type DistributedSDFScheduler.- Parameters:
container
- Container of the director.name
- Name of this director.- Throws:
IllegalActionException
- If the director is not compatible with the specified container. May be thrown in a derived class.NameDuplicationException
- If the container is not a CompositeActor and the name collides with an entity in the container.
-
-
Method Detail
-
attributeChanged
public void attributeChanged(Attribute attribute) throws IllegalActionException
React to a change in an attribute. If the changed attribute matches a parameter of the director, then the corresponding local copy of the parameter value will be updated. If the attribute that changes is parallelSchedule the schedule is invalidated.- Overrides:
attributeChanged
in classSDFDirector
- Parameters:
attribute
- The changed parameter.- Throws:
IllegalActionException
- If the parameter set is not valid.
-
fire
public void fire() throws IllegalActionException
Calculate the current schedule, if necessary, and iterate the contained actors in the order given by the schedule. Depending on the value of parallelSchedule either a sequential or a parallel schedule will be computed. Depending on the value of parallelExecution either a sequential or a parallel execution of the schedule will be computed. No internal state of the director is updated during fire, so it may be used with domains that require this property, such as CT.Iterating an actor involves calling the actor's iterate() method, which is equivalent to calling the actor's prefire(), fire() and postfire() methods in succession. If iterate() returns NOT_READY, indicating that the actor is not ready to execute, then an IllegalActionException will be thrown. The values returned from iterate() are recorded and are used to determine the value that postfire() will return at the end of the director's iteration.
This method may be overridden by some domains to perform additional domain-specific operations.
- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classSDFDirector
- Throws:
IllegalActionException
- If any actor executed by this actor return false in prefire.
-
initialize
public void initialize() throws IllegalActionException
Initialize the actors associated with this director (super). If parallelExecution is true, the infrastructure for a distributed execution is initialized. Once the required number of services are discovered, the actors are mapped on to them, sent to the distributed services and virtually connected over the network.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classSDFDirector
- Throws:
IllegalActionException
- If the initialize() method of one of the associated actors throws it, or if there is no scheduler.
-
newReceiver
public Receiver newReceiver()
Return a new receiver consistent with the Distributed-SDF domain.- Overrides:
newReceiver
in classSDFDirector
- Returns:
- A new DistributedSDFReceiver.
-
preinitialize
public void preinitialize() throws IllegalActionException
Preinitialize the actors associated with this director and compute the schedule (super). The schedule is computed during preinitialization so that hierarchical opaque composite actors can be scheduled properly, since the act of computing the schedule sets the rate parameters of the external ports. In addition, performing scheduling during preinitialization enables it to be present during code generation. The order in which the actors are preinitialized is arbitrary. The schedule computed will be either sequential or parallel depending on the value of parallelSchedule.- Specified by:
preinitialize
in interfaceInitializable
- Overrides:
preinitialize
in classSDFDirector
- Throws:
IllegalActionException
- If the preinitialize() method of one of the associated actors throws it.
-
wrapup
public void wrapup() throws IllegalActionException
Invoke the wrapup() method of all the actors contained in the director's container (super). In case of parallelExecution being true, exit from all the client threads is performed. This method should be invoked once per execution. None of the other action methods should be invoked after it in the execution. This method is not synchronized on the workspace, so the caller should be.- Specified by:
wrapup
in interfaceInitializable
- Overrides:
wrapup
in classDirector
- Throws:
IllegalActionException
- If the wrapup() method of one of the associated actors throws it.- See Also:
ClientThread
-
-