use of org.apache.sysml.runtime.instructions.Instruction in project incubator-systemml by apache.
the class Recompiler method recompileHopsDag2Forced.
/**
* D) Recompile predicate hop DAG (single root), but forced to CP.
*
* This happens always 'inplace', without statistics updates, and
* without dynamic rewrites.
*
* @param hops list of high-level operators
* @param tid thread id
* @param et execution type
* @return list of instructions
* @throws DMLRuntimeException if DMLRuntimeException occurs
* @throws HopsException if HopsException occurs
* @throws LopsException if LopsException occurs
* @throws IOException if IOException occurs
*/
public static ArrayList<Instruction> recompileHopsDag2Forced(Hop hops, long tid, ExecType et) throws DMLRuntimeException, HopsException, LopsException, IOException {
ArrayList<Instruction> newInst = null;
//need for synchronization as we do temp changes in shared hops/lops
synchronized (hops) {
LOG.debug("\n**************** Optimizer (Recompile) *************\nMemory Budget = " + OptimizerUtils.toMB(OptimizerUtils.getLocalMemBudget()) + " MB");
// clear existing lops
hops.resetVisitStatus();
rClearLops(hops);
// update exec type
hops.resetVisitStatus();
rSetExecType(hops, et);
hops.resetVisitStatus();
// construct lops
Dag<Lop> dag = new Dag<Lop>();
Lop lops = hops.constructLops();
lops.addToDag(dag);
// generate runtime instructions (incl piggybacking)
newInst = dag.getJobs(null, ConfigurationManager.getDMLConfig());
}
// replace thread ids in new instructions
if (//only in parfor context
tid != 0)
newInst = ProgramConverter.createDeepCopyInstructionSet(newInst, tid, -1, null, null, null, false, false);
return newInst;
}
use of org.apache.sysml.runtime.instructions.Instruction in project incubator-systemml by apache.
the class Recompiler method recompileHopsDagInstructions.
public static ArrayList<Instruction> recompileHopsDagInstructions(Hop hops) throws DMLRuntimeException, HopsException, LopsException, IOException {
ArrayList<Instruction> newInst = null;
//need for synchronization as we do temp changes in shared hops/lops
synchronized (hops) {
LOG.debug("\n**************** Optimizer (Recompile) *************\nMemory Budget = " + OptimizerUtils.toMB(OptimizerUtils.getLocalMemBudget()) + " MB");
// clear existing lops
hops.resetVisitStatus();
rClearLops(hops);
// construct lops
Dag<Lop> dag = new Dag<Lop>();
Lop lops = hops.constructLops();
lops.addToDag(dag);
// generate runtime instructions (incl piggybacking)
newInst = dag.getJobs(null, ConfigurationManager.getDMLConfig());
}
// explain recompiled instructions
if (DMLScript.EXPLAIN == ExplainType.RECOMPILE_HOPS)
LOG.info("EXPLAIN RECOMPILE \nPRED (line " + hops.getBeginLine() + "):\n" + Explain.explain(hops, 1));
if (DMLScript.EXPLAIN == ExplainType.RECOMPILE_RUNTIME)
LOG.info("EXPLAIN RECOMPILE \nPRED (line " + hops.getBeginLine() + "):\n" + Explain.explain(newInst, 1));
return newInst;
}
use of org.apache.sysml.runtime.instructions.Instruction in project incubator-systemml by apache.
the class Recompiler method recompileHopsDagInstructions.
public static ArrayList<Instruction> recompileHopsDagInstructions(StatementBlock sb, ArrayList<Hop> hops) throws HopsException, LopsException, DMLRuntimeException, IOException {
ArrayList<Instruction> newInst = null;
//however, we create deep copies for most dags to allow for concurrent recompile
synchronized (hops) {
LOG.debug("\n**************** Optimizer (Recompile) *************\nMemory Budget = " + OptimizerUtils.toMB(OptimizerUtils.getLocalMemBudget()) + " MB");
// clear existing lops
Hop.resetVisitStatus(hops);
for (Hop hopRoot : hops) rClearLops(hopRoot);
// construct lops
Dag<Lop> dag = new Dag<Lop>();
for (Hop hopRoot : hops) {
Lop lops = hopRoot.constructLops();
lops.addToDag(dag);
}
// generate runtime instructions (incl piggybacking)
newInst = dag.getJobs(sb, ConfigurationManager.getDMLConfig());
}
// explain recompiled hops / instructions
if (DMLScript.EXPLAIN == ExplainType.RECOMPILE_HOPS) {
LOG.info("EXPLAIN RECOMPILE \nGENERIC (lines " + sb.getBeginLine() + "-" + sb.getEndLine() + "):\n" + Explain.explainHops(hops, 1));
}
if (DMLScript.EXPLAIN == ExplainType.RECOMPILE_RUNTIME) {
LOG.info("EXPLAIN RECOMPILE \nGENERIC (lines " + sb.getBeginLine() + "-" + sb.getEndLine() + "):\n" + Explain.explain(newInst, 1));
}
return newInst;
}
Aggregations