ptolemy.distributed.domains.sdf.kernel
Class DistributedSDFScheduler
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.actor.sched.Scheduler
ptolemy.domains.sdf.kernel.BaseSDFScheduler
ptolemy.domains.sdf.kernel.SDFScheduler
ptolemy.distributed.domains.sdf.kernel.DistributedSDFScheduler
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, ValueListener
public class DistributedSDFScheduler
- extends SDFScheduler
A scheduler that extends the SDFScheduler. This class relies on the extended
SDFScheduler to calculate sequential schedules. In case a parallelSchedule
is requested, it performs a topological sort of the graph that can be
constructed from the data dependencies among the actors.
The existing SDFScheduler produces schedules in a depth-first fashion.
From the topological sort a schedule is created containing subschedules that
contain the actors in the different levels, indicating they can be executed
in parallel.
I.e.:
- Sequential: (ABDECFG)
- Parallel: ((A)(BC)(DEFG))
To allow extending the actor, the SDFScheduler class has been modified.
The members:
- _rateVariables
- _externalRates
- _firingVector
and methods:
- _serFiringVector
- _simulateExternalInputs
- _countUnfulfilledInputs
- _computeMaximumFirings
- _simulateInputConsumption
- _getFiringCount
have been modified their visibility from private to protected.
- Since:
- Ptolemy II 5.1
- Version:
- $Id: DistributedSDFScheduler.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Daniel Lazaro Cuadrado (kapokasa@kom.aau.dk)
- See Also:
SDFScheduler
,
Serialized Form
- Accepted Rating:
- Proposed Rating:
Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Method Summary |
protected Schedule |
_getParallelSchedule()
Return a parallelSchedule result of performing a topological
sort of the graph that can be constructed from the model's data
dependencies. |
protected Schedule |
_getSchedule()
Return the scheduling sequence. |
protected Schedule |
_scheduleInParallelConnectedActors(java.util.Map minimumBufferSize,
java.util.Map externalRates,
java.util.LinkedList actorList,
CompositeActor container,
java.util.LinkedList allActorList)
Duplicate with modifications of the _scheduleConnectedActors
method. |
protected void |
_simulateTokensCreatedLast(IOPort outputPort,
int createdTokens,
java.util.LinkedList actorList,
java.util.LinkedList readyToScheduleActorList)
Duplicate and modification of the _simulateTokensCreated
method. |
Methods inherited from class ptolemy.domains.sdf.kernel.SDFScheduler |
_checkDynamicRateVariables, _computeMaximumFirings, _countUnfulfilledInputs, _getFiringCount, _simulateExternalInputs, _simulateInputConsumption, _solveBalanceEquations, _vectorizeFirings, clone, declareRateDependency, getExternalRates, getFiringCount, valueChanged |
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, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, 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, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, 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 |
DistributedSDFScheduler
public DistributedSDFScheduler()
- Construct a scheduler with no container(director)
in the default workspace.
DistributedSDFScheduler
public DistributedSDFScheduler(Workspace workspace)
- Construct a scheduler in the given workspace.
- Parameters:
workspace
- Object for synchronization and version tracking.
DistributedSDFScheduler
public DistributedSDFScheduler(Director container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
- Construct a scheduler in the given container with the given name.
The container argument must not be null, or a
NullPointerException will be thrown. This attribute will use the
workspace of the container for synchronization and version counts.
If the name argument is null, then the name is set to the empty string.
Increment the version of the workspace.
- Parameters:
container
- The container.name
- The name of this attribute.
- Throws:
IllegalActionException
- If the attribute is not of an
acceptable class for the container, or if the name contains a period.
NameDuplicationException
- If the name coincides with
an attribute already in the container.
_getParallelSchedule
protected Schedule _getParallelSchedule()
throws NotSchedulableException,
IllegalActionException
- Return a parallelSchedule result of performing a topological
sort of the graph that can be constructed from the model's data
dependencies. This method duplicates and modifies the code in
_getSchedule from the extended SDFScheduler class. It differs on
the call to the _scheduleConnectedActors, that in this case is
substituted by a call to the _scheduleInParallelConnectedActors
method.
Modifications are marked with NEW!.
- Returns:
- A parallelSchedule.
- Throws:
NotSchedulableException
- If the rates specified for
the model imply that the model is not statically schedulable.
IllegalActionException
- If the rate parameters
of the model are not correct, or the computed rates for
external ports are not correct.
_getSchedule
protected Schedule _getSchedule()
throws NotSchedulableException,
IllegalActionException
- Return the scheduling sequence. In case the parameter
parallelSchedule is true, it returns a parallel Schedule,
otherwise it calls the parent's _getSchedule() method returning
the given result.
- Overrides:
_getSchedule
in class SDFScheduler
- Returns:
- A schedule of the deeply contained opaque entities
in the firing order, sequential or parallel depending of the
value of the parameter parallelSchedule.
- Throws:
NotSchedulableException
- If the rates specified for
the model imply that the model is not statically schedulable.
IllegalActionException
- If the rate parameters
of the model are not correct, or the computed rates for
external ports are not correct.- See Also:
CompositeEntity.deepEntityList()
_scheduleInParallelConnectedActors
protected Schedule _scheduleInParallelConnectedActors(java.util.Map minimumBufferSize,
java.util.Map externalRates,
java.util.LinkedList actorList,
CompositeActor container,
java.util.LinkedList allActorList)
throws NotSchedulableException
- Duplicate with modifications of the _scheduleConnectedActors
method.
Modifications are marked with NEW!.
- Parameters:
minimumBufferSize
- A map from relation to an Integer
representing the minimum size buffer necessary for the computed
schedule. The map will be populated during the execution of this
method.externalRates
- Map from external port to an Integer
representing the number of tokens produced or consumed from
that port during the course of an iteration.actorList
- The actors that need to be scheduled.container
- The container.allActorList
- All the actors, including those that do
not need to be scheduled. These actors will still be
initialized, which means we must take their initial tokens
into account when calculating buffer sizes.
- Returns:
- An instance of the Schedule class, indicating the order
in which actors should fire.
- Throws:
NotSchedulableException
- If the algorithm encounters an SDF
graph that is not consistent with the firing vector, or detects an
inconsistent internal state, or detects a graph that cannot be
scheduled.
_simulateTokensCreatedLast
protected void _simulateTokensCreatedLast(IOPort outputPort,
int createdTokens,
java.util.LinkedList actorList,
java.util.LinkedList readyToScheduleActorList)
throws IllegalActionException
- Duplicate and modification of the _simulateTokensCreated
method.
Modifications are marked with NEW!.
- Parameters:
outputPort
- The port that is creating the tokens.createdTokens
- The number of tokens to create.actorList
- The list of actors that are being scheduled.readyToScheduleActorList
- The list of actors that are ready
to be scheduled. This will be updated if any actors that receive
tokens from outputPort are now ready to fire.
- Throws:
IllegalActionException
- If the rate parameters are invalid.