|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.actor.sched.Scheduler
ptolemy.domains.sdf.kernel.BaseSDFScheduler
ptolemy.domains.sdf.kernel.SDFScheduler
A scheduler that implements basic scheduling of SDF graphs. This class calculates the SDF schedule in two phases. First, the balance equations for the rates between actors are solved to determine the firing vector (also known as the repetitions vector). The firing vector is the least integer solution such that the number of tokens created on each channel of each relation is equal to the number of tokens consumed. In some cases, no solution exists. Such graphs are not executable under SDF.
Then the actors are ordered such that each actor only fires when the scheduler has determined that enough tokens will be present on its input ports to allow it to fire. In cases where the dataflow graph is cyclic, a valid firing vector exists, but no actor can fire, since they all depend on the output of another actor. This situation is known as deadlock. Deadlock must be prevented in SDF by manually inserting delay actors, which represent initial tokens on each relation. Such delay actors are responsible for creating tokens during initialization that will prevent deadlock. These actors set the tokenInitProduction parameter of their output ports to represent the number of tokens they will create during initialization. The SDFScheduler uses this parameter to break the dependency in a cyclic graph.
Note that this scheduler only ensures that the number of firings is minimal. Most notably, it does not attempt to minimize the size of the buffers that are associated with each relation. The resulting schedule is a linear schedule (as opposed to a looped schedule) and is not suitable for multiprocessing environments.
Any actors may be scheduled by this scheduler, which will, by default, assume homogeneous behavior for each actor. (i.e. each output port produces one token for each firing, and each input port consumes one token on each firing, and no tokens are created during initialization.) If this is not the case then parameters named tokenConsumptionRate, tokenProductionRate, and tokenInitProduction must be set. The SDFIOPort class provides easier access to these parameters.
Note that reconstructing the schedule is expensive, so the schedule is locally cached for as long as possible, and mutations under SDF should be avoided.
Note that this scheduler supports actors with 0-rate ports as long as the graph is not equivalent to a disconnected graph. This scheduler is somewhat conservative in this respect.
Disconnected graphs are supported if the SDF Director parameter allowDisconnectedGraphs is true.
Scheduler,
SDFIOPort,
SampleDelay,
Serialized Form
| Green (neuendor) |
| Green (neuendor) |
| Nested Class Summary |
| Nested classes inherited from class ptolemy.kernel.util.NamedObj |
NamedObj.ContainedObjectsIterator |
| Field Summary |
| Fields inherited from class ptolemy.domains.sdf.kernel.BaseSDFScheduler |
VERBOSE |
| Fields inherited from class ptolemy.actor.sched.Scheduler |
_DEFAULT_SCHEDULER_NAME |
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
| Constructor Summary | |
SDFScheduler()
Construct a scheduler with no container(director) in the default workspace, the name of the scheduler is "Scheduler". |
|
SDFScheduler(Director container,
java.lang.String name)
Construct a scheduler in the given container with the given name. |
|
SDFScheduler(Workspace workspace)
Construct a scheduler in the given workspace with the name "Scheduler". |
|
| Method Summary | |
protected void |
_checkDynamicRateVariables(CompositeActor model,
java.util.List rateVariables)
|
protected Schedule |
_getSchedule()
Return the scheduling sequence. |
protected void |
_localMemberInitialize()
Initialize the local data members of this object. |
protected void |
_normalizeFirings(int vectorizationFactor,
java.util.Map entityToFiringsPerIteration,
java.util.Map externalRates)
Normalize fractional firing ratios into a firing vector that corresponds to a single SDF iteration. |
protected java.util.Map |
_solveBalanceEquations(CompositeActor container,
java.util.List actorList,
java.util.Map externalRates)
Solve the balance equations for the list of connected Actors. |
void |
declareRateDependency()
Declare the rate dependency on any external ports of the model. |
java.util.Map |
getExternalRates()
Get the external port rates. |
int |
getFiringCount(Entity entity)
Create the schedule. |
void |
setContainerRates(java.util.Map externalRates)
This method simply calls _saveContainerRates(Map externalRates). |
void |
valueChanged(Settable settable)
React to the fact that the specified Settable has changed. |
| Methods inherited from class ptolemy.domains.sdf.kernel.BaseSDFScheduler |
_declareDependency, _getChannel, _saveBufferSizes, _saveContainerRates, _saveFiringCounts |
| Methods inherited from class ptolemy.actor.sched.Scheduler |
clone, getSchedule, isValid, setContainer, setValid |
| Methods inherited from class ptolemy.kernel.util.Attribute |
_getContainedObject, _propagateExistence, getContainer, setName |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public SDFScheduler()
public SDFScheduler(Workspace workspace)
workspace - Object for synchronization and version tracking.
public SDFScheduler(Director container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
container - The container.name - The name of this attribute.
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.| Method Detail |
public void declareRateDependency()
throws IllegalActionException
declareRateDependency in class BaseSDFSchedulerIllegalActionExceptionpublic java.util.Map getExternalRates()
public int getFiringCount(Entity entity)
throws IllegalActionException
IllegalActionException
public void setContainerRates(java.util.Map externalRates)
throws NotSchedulableException,
IllegalActionException
externalRates - A map from external port to the rate of that
port.
NotSchedulableException - If an external port is both
an input and an output, or neither an input or an output, or
connected on the inside to ports that have different
tokenInitProduction.
IllegalActionException - If any called method throws it.public void valueChanged(Settable settable)
valueChanged in interface ValueListenersettable - The object that has changed value.
protected Schedule _getSchedule()
throws NotSchedulableException,
IllegalActionException
_getSchedule in class SchedulerNotSchedulableException - 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.CompositeEntity.deepGetEntities()protected void _localMemberInitialize()
protected void _normalizeFirings(int vectorizationFactor,
java.util.Map entityToFiringsPerIteration,
java.util.Map externalRates)
vectorizationFactor - An integer scaling factor to multiply
the firing vector by.entityToFiringsPerIteration - Map of firing ratios to be normalized.externalRates - Map of token production rates that will
be scaled along with the entityToFiringsPerIteration map.
InternalErrorException - If the calculated LCM does not
normalize all of the fractions.
protected java.util.Map _solveBalanceEquations(CompositeActor container,
java.util.List actorList,
java.util.Map externalRates)
throws NotSchedulableException,
IllegalActionException
container - The container that is being scheduled.actorList - The actors that we are interested in.externalRates - A map from external ports of container to
the fractional rates of that port. This starts out initialized with
Fraction.ZERO and will be populated during this method.
NotSchedulableException - If the graph is not consistent
under the synchronous dataflow model, or if the graph is not connected.
IllegalActionException - If any called method throws it.
protected void _checkDynamicRateVariables(CompositeActor model,
java.util.List rateVariables)
throws IllegalActionException
IllegalActionException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||