コード例 #1
0
ファイル: AbstractAbc.java プロジェクト: blaunay/preesm
  /** Unmaps all vertices from implementation */
  @Override
  public final void resetImplementation() {

    Iterator<DAGVertex> iterator = implementation.vertexSet().iterator();

    while (iterator.hasNext()) {
      unmap((MapperDAGVertex) iterator.next());
    }
  }
コード例 #2
0
ファイル: AbstractAbc.java プロジェクト: blaunay/preesm
  /** Returns the implementation vertex corresponding to the DAG vertex */
  @Override
  public final MapperDAGVertex translateInImplementationVertex(MapperDAGVertex vertex) {

    MapperDAGVertex internalVertex = implementation.getMapperDAGVertex(vertex.getName());

    if (internalVertex == null) {
      WorkflowLogger.getLogger()
          .log(Level.SEVERE, "No simulator internal vertex with id " + vertex.getName());
    }
    return internalVertex;
  }
コード例 #3
0
ファイル: AbstractAbc.java プロジェクト: blaunay/preesm
  /** Setting common constraints to a non-special vertex and its related init and end vertices */
  private void populateRelativeConstraint(MapperDAGVertex vertex) {

    Set<MapperDAGVertex> verticesToAssociate = new HashSet<MapperDAGVertex>();
    verticesToAssociate.add(vertex);

    if (SpecialVertexManager.isInit(vertex)) {
      SDFEndVertex sdfEndVertex =
          (SDFEndVertex) ((SDFInitVertex) vertex.getCorrespondingSDFVertex()).getEndReference();
      MapperDAGVertex end = (MapperDAGVertex) implementation.getVertex(sdfEndVertex.getName());
      verticesToAssociate.add(end);
    }
  }
コード例 #4
0
ファイル: AbstractAbc.java プロジェクト: blaunay/preesm
  /** Unmaps all vertices in both implementation and DAG Resets the order manager only at the end */
  @Override
  public final void resetDAG() {

    Iterator<DAGVertex> iterator = dag.vertexSet().iterator();

    while (iterator.hasNext()) {
      MapperDAGVertex v = (MapperDAGVertex) iterator.next();
      if (v.hasEffectiveComponent()) {
        unmap(v);
      }
    }

    orderManager.resetTotalOrder();
  }
コード例 #5
0
ファイル: AbstractAbc.java プロジェクト: blaunay/preesm
  /** ABC constructor */
  protected AbstractAbc(MapperDAG dag, Design archi, AbcType abcType, PreesmScenario scenario) {

    this.abcType = abcType;
    orderManager = new OrderManager(archi);

    this.dag = dag;

    // implementation is a duplicate from dag
    this.implementation = dag.clone();

    // Initializes relative constraints
    initRelativeConstraints();

    this.archi = archi;
    this.scenario = scenario;

    // Schedules the tasks in topological and alphabetical order. Some
    // better order should be looked for
    setTaskScheduler(new TaskSwitcher());
  }
コード例 #6
0
ファイル: AbstractAbc.java プロジェクト: blaunay/preesm
  /** resets the costs of a set of edges */
  private final MapperDAGEdge translateInImplementationEdge(MapperDAGEdge edge) {

    MapperDAGVertex sourceVertex =
        translateInImplementationVertex((MapperDAGVertex) edge.getSource());
    MapperDAGVertex destVertex =
        translateInImplementationVertex((MapperDAGVertex) edge.getTarget());

    if (destVertex == null || sourceVertex == null) {
      WorkflowLogger.getLogger()
          .log(
              Level.SEVERE,
              "Implementation vertex with id "
                  + edge.getSource()
                  + " or "
                  + edge.getTarget()
                  + " not found");
    } else {
      MapperDAGEdge internalEdge = (MapperDAGEdge) implementation.getEdge(sourceVertex, destVertex);
      return internalEdge;
    }

    return null;
  }
コード例 #7
0
  @Override
  public void execute(List<Object> resultList) {

    super.execute(resultList);

    MapperDAGVertex currentSource = (MapperDAGVertex) edge.getSource();
    MapperDAGVertex currentTarget = (MapperDAGVertex) edge.getTarget();

    if (edge instanceof PrecedenceEdge) {
      WorkflowLogger.getLogger()
          .log(Level.INFO, "no involvement vertex corresponding to a schedule edge");
      return;
    }

    String ivertexID =
        "__involvement (" + currentSource.getName() + "," + currentTarget.getName() + ")";

    if (involvementTime > 0) {
      iVertex = new InvolvementVertex(ivertexID, implementation);
      implementation.getTimings().dedicate(iVertex);
      implementation.getMappings().dedicate(iVertex);

      implementation.addVertex(iVertex);
      iVertex.getTiming().setCost(involvementTime);

      if (isSender) {
        iVertex.setEffectiveOperator(step.getSender());
        ((TransferVertex) currentTarget).setInvolvementVertex(iVertex);
      } else {
        iVertex.setEffectiveOperator(step.getReceiver());
        ((TransferVertex) currentSource).setInvolvementVertex(iVertex);
      }

      if (isSender) {
        MapperDAGEdge newInEdge = (MapperDAGEdge) implementation.addEdge(currentSource, iVertex);
        newInEdge.setInit(edge.getInit().clone());
        newInEdge.getTiming().setCost(0);

        MapperDAGVertex receiverVertex = currentTarget;
        do {
          Set<MapperDAGVertex> succs = receiverVertex.getSuccessors(false).keySet();
          if (succs.isEmpty() && receiverVertex instanceof TransferVertex) {
            WorkflowLogger.getLogger()
                .log(Level.SEVERE, "Transfer has no successor: " + receiverVertex.getName());
          }

          for (MapperDAGVertex next : receiverVertex.getSuccessors(false).keySet()) {
            if (next != null) {
              receiverVertex = next;
            }
          }
        } while (receiverVertex instanceof TransferVertex);

        MapperDAGEdge newoutEdge = (MapperDAGEdge) implementation.addEdge(iVertex, receiverVertex);
        newoutEdge.setInit(edge.getInit().clone());
        newoutEdge.getTiming().setCost(0);

        // TODO: Look at switching possibilities
        /*
         * if (false) { TaskSwitcher taskSwitcher = new TaskSwitcher();
         * taskSwitcher.setOrderManager(orderManager);
         * taskSwitcher.insertVertexBefore(currentTarget, iVertex); }
         * else
         */
        orderManager.insertBefore(currentTarget, iVertex);

      } else {
        MapperDAGEdge newOutEdge = (MapperDAGEdge) implementation.addEdge(iVertex, currentTarget);
        newOutEdge.setInit(edge.getInit().clone());
        newOutEdge.getTiming().setCost(0);

        orderManager.insertAfter(currentSource, iVertex);
      }

      // Scheduling involvement vertex
      new PrecedenceEdgeAdder(orderManager, implementation).scheduleVertex(iVertex);

      if (resultList != null) {
        resultList.add(iVertex);
      }
    }
  }
コード例 #8
0
ファイル: AbstractAbc.java プロジェクト: blaunay/preesm
 /**
  * Setting common constraints to all non-special vertices and their related init and end vertices
  */
 private void initRelativeConstraints() {
   for (DAGVertex v : implementation.vertexSet()) {
     populateRelativeConstraint((MapperDAGVertex) v);
   }
 }