use of org.apache.sysml.hops.rewrite.RewriteInjectSparkLoopCheckpointing in project incubator-systemml by apache.
the class OptimizerRuleBased method rewriteInjectSparkLoopCheckpointing.
// /////
// REWRITE inject spark loop checkpointing
// /
protected void rewriteInjectSparkLoopCheckpointing(OptNode n) {
// get program blocks of root parfor
Object[] progobj = OptTreeConverter.getAbstractPlanMapping().getMappedProg(n.getID());
ParForStatementBlock pfsb = (ParForStatementBlock) progobj[0];
ParForStatement fs = (ParForStatement) pfsb.getStatement(0);
ParForProgramBlock pfpb = (ParForProgramBlock) progobj[1];
boolean applied = false;
try {
// apply hop rewrite inject spark checkpoints (but without context awareness)
RewriteInjectSparkLoopCheckpointing rewrite = new RewriteInjectSparkLoopCheckpointing(false);
ProgramRewriter rewriter = new ProgramRewriter(rewrite);
ProgramRewriteStatus state = new ProgramRewriteStatus();
rewriter.rRewriteStatementBlockHopDAGs(pfsb, state);
fs.setBody(rewriter.rRewriteStatementBlocks(fs.getBody(), state, true));
// recompile if additional checkpoints introduced
if (state.getInjectedCheckpoints()) {
pfpb.setChildBlocks(ProgramRecompiler.generatePartitialRuntimeProgram(pfpb.getProgram(), fs.getBody()));
applied = true;
}
} catch (Exception ex) {
throw new DMLRuntimeException(ex);
}
LOG.debug(getOptMode() + " OPT: rewrite 'inject spark loop checkpointing' - result=" + applied);
}
use of org.apache.sysml.hops.rewrite.RewriteInjectSparkLoopCheckpointing in project systemml by apache.
the class OptimizerRuleBased method rewriteInjectSparkLoopCheckpointing.
// /////
// REWRITE inject spark loop checkpointing
// /
protected void rewriteInjectSparkLoopCheckpointing(OptNode n) {
// get program blocks of root parfor
Object[] progobj = OptTreeConverter.getAbstractPlanMapping().getMappedProg(n.getID());
ParForStatementBlock pfsb = (ParForStatementBlock) progobj[0];
ParForStatement fs = (ParForStatement) pfsb.getStatement(0);
ParForProgramBlock pfpb = (ParForProgramBlock) progobj[1];
boolean applied = false;
try {
// apply hop rewrite inject spark checkpoints (but without context awareness)
RewriteInjectSparkLoopCheckpointing rewrite = new RewriteInjectSparkLoopCheckpointing(false);
ProgramRewriter rewriter = new ProgramRewriter(rewrite);
ProgramRewriteStatus state = new ProgramRewriteStatus();
rewriter.rRewriteStatementBlockHopDAGs(pfsb, state);
fs.setBody(rewriter.rRewriteStatementBlocks(fs.getBody(), state, true));
// recompile if additional checkpoints introduced
if (state.getInjectedCheckpoints()) {
pfpb.setChildBlocks(ProgramRecompiler.generatePartitialRuntimeProgram(pfpb.getProgram(), fs.getBody()));
applied = true;
}
} catch (Exception ex) {
throw new DMLRuntimeException(ex);
}
LOG.debug(getOptMode() + " OPT: rewrite 'inject spark loop checkpointing' - result=" + applied);
}
Aggregations