Class DistributedSDFScheduler

  • All Implemented Interfaces:
    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.:
    Schedules and subschedules
        A    
      B   C  
    D   E     F   G
    • 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$
    Author:
    Daniel Lazaro Cuadrado (kapokasa@kom.aau.dk)
    See Also:
    SDFScheduler
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (kapokasa)
    • Constructor Detail

      • 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.
    • Method Detail

      • _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.