Search in sources :

Example 1 with DMLDebuggerProgramInfo

use of org.apache.sysml.debug.DMLDebuggerProgramInfo in project incubator-systemml by apache.

the class DMLScript method launchDebugger.

/**
 * Launcher for DML debugger. This method should be called after
 * execution and debug properties have been correctly set, and customized parameters
 *
 * @param dmlScriptStr DML script contents (including new lines)
 * @param fnameOptConfig Full path of configuration file for SystemML
 * @param argVals Key-value pairs defining arguments of DML script
 * @param scriptType type of script (DML or PyDML)
 * @throws IOException if IOException occurs
 */
private static void launchDebugger(String dmlScriptStr, String fnameOptConfig, Map<String, String> argVals, ScriptType scriptType) throws IOException {
    DMLDebuggerProgramInfo dbprog = new DMLDebuggerProgramInfo();
    // Step 1: parse configuration files
    DMLConfig conf = DMLConfig.readConfigurationFile(fnameOptConfig);
    ConfigurationManager.setGlobalConfig(conf);
    // Step 2: parse dml script
    ParserWrapper parser = ParserFactory.createParser(scriptType);
    DMLProgram prog = parser.parse(DML_FILE_PATH_ANTLR_PARSER, dmlScriptStr, argVals);
    // Step 3: construct HOP DAGs (incl LVA and validate)
    DMLTranslator dmlt = new DMLTranslator(prog);
    dmlt.liveVariableAnalysis(prog);
    dmlt.validateParseTree(prog);
    dmlt.constructHops(prog);
    // Step 4: rewrite HOP DAGs (incl IPA and memory estimates)
    dmlt.rewriteHopsDAG(prog);
    // Step 5: construct LOP DAGs
    dmlt.constructLops(prog);
    // Step 6: generate runtime program
    dbprog.rtprog = dmlt.getRuntimeProgram(prog, conf);
    try {
        // set execution environment
        initHadoopExecution(conf);
        // initialize an instance of SystemML debugger
        DMLDebugger SystemMLdb = new DMLDebugger(dbprog, dmlScriptStr);
        // run SystemML debugger
        SystemMLdb.runSystemMLDebugger();
    } finally {
        // cleanup scratch_space and all working dirs
        cleanupHadoopExecution(conf);
    }
}
Also used : DMLConfig(org.apache.sysml.conf.DMLConfig) DMLDebuggerProgramInfo(org.apache.sysml.debug.DMLDebuggerProgramInfo) DMLProgram(org.apache.sysml.parser.DMLProgram) ParserWrapper(org.apache.sysml.parser.ParserWrapper) DMLDebugger(org.apache.sysml.debug.DMLDebugger) DMLTranslator(org.apache.sysml.parser.DMLTranslator)

Example 2 with DMLDebuggerProgramInfo

use of org.apache.sysml.debug.DMLDebuggerProgramInfo in project systemml by apache.

the class DMLScript method launchDebugger.

/**
 * Launcher for DML debugger. This method should be called after
 * execution and debug properties have been correctly set, and customized parameters
 *
 * @param dmlScriptStr DML script contents (including new lines)
 * @param fnameOptConfig Full path of configuration file for SystemML
 * @param argVals Key-value pairs defining arguments of DML script
 * @param scriptType type of script (DML or PyDML)
 * @throws IOException if IOException occurs
 */
private static void launchDebugger(String dmlScriptStr, String fnameOptConfig, Map<String, String> argVals, ScriptType scriptType) throws IOException {
    DMLDebuggerProgramInfo dbprog = new DMLDebuggerProgramInfo();
    // Step 1: parse configuration files
    DMLConfig conf = DMLConfig.readConfigurationFile(fnameOptConfig);
    ConfigurationManager.setGlobalConfig(conf);
    // Step 2: parse dml script
    ParserWrapper parser = ParserFactory.createParser(scriptType);
    DMLProgram prog = parser.parse(DML_FILE_PATH_ANTLR_PARSER, dmlScriptStr, argVals);
    // Step 3: construct HOP DAGs (incl LVA and validate)
    DMLTranslator dmlt = new DMLTranslator(prog);
    dmlt.liveVariableAnalysis(prog);
    dmlt.validateParseTree(prog);
    dmlt.constructHops(prog);
    // Step 4: rewrite HOP DAGs (incl IPA and memory estimates)
    dmlt.rewriteHopsDAG(prog);
    // Step 5: construct LOP DAGs
    dmlt.constructLops(prog);
    // Step 6: generate runtime program
    dbprog.rtprog = dmlt.getRuntimeProgram(prog, conf);
    try {
        // set execution environment
        initHadoopExecution(conf);
        // initialize an instance of SystemML debugger
        DMLDebugger SystemMLdb = new DMLDebugger(dbprog, dmlScriptStr);
        // run SystemML debugger
        SystemMLdb.runSystemMLDebugger();
    } finally {
        // cleanup scratch_space and all working dirs
        cleanupHadoopExecution(conf);
    }
}
Also used : DMLConfig(org.apache.sysml.conf.DMLConfig) DMLDebuggerProgramInfo(org.apache.sysml.debug.DMLDebuggerProgramInfo) DMLProgram(org.apache.sysml.parser.DMLProgram) ParserWrapper(org.apache.sysml.parser.ParserWrapper) DMLDebugger(org.apache.sysml.debug.DMLDebugger) DMLTranslator(org.apache.sysml.parser.DMLTranslator)

Aggregations

DMLConfig (org.apache.sysml.conf.DMLConfig)2 DMLDebugger (org.apache.sysml.debug.DMLDebugger)2 DMLDebuggerProgramInfo (org.apache.sysml.debug.DMLDebuggerProgramInfo)2 DMLProgram (org.apache.sysml.parser.DMLProgram)2 DMLTranslator (org.apache.sysml.parser.DMLTranslator)2 ParserWrapper (org.apache.sysml.parser.ParserWrapper)2