Class 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)
    • 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 class SDFDirector
        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 interface Executable
        Overrides:
        fire in class SDFDirector
        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 interface Initializable
        Overrides:
        initialize in class SDFDirector
        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 class SDFDirector
        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 interface Initializable
        Overrides:
        preinitialize in class SDFDirector
        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 interface Initializable
        Overrides:
        wrapup in class Director
        Throws:
        IllegalActionException - If the wrapup() method of one of the associated actors throws it.
        See Also:
        ClientThread