/** 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(); }
@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); } } }
/** Gets the current total schedule of the ABC */ @Override public final VertexOrderList getTotalOrder() { return orderManager.getTotalOrder().toOrderList(); }
/** Sets the total orders in the dag */ @Override public final void retrieveTotalOrder() { orderManager.tagDAG(dag); }
/** Gets the total rank of the given vertex. -1 if the vertex has no rank */ @Override public final int getSchedTotalOrder(MapperDAGVertex vertex) { vertex = translateInImplementationVertex(vertex); return orderManager.totalIndexOf(vertex); }