use of org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex in project incubator-systemml by apache.
the class IPAAssignConstantPropagationTest method runIPAAssignConstantPropagationTest.
private void runIPAAssignConstantPropagationTest(boolean branchRemoval, boolean IPA) {
boolean oldFlagBranchRemoval = OptimizerUtils.ALLOW_BRANCH_REMOVAL;
boolean oldFlagIPA = OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS;
try {
TestConfiguration config = getTestConfiguration(TEST_NAME);
loadTestConfiguration(config);
String HOME = SCRIPT_DIR + TEST_DIR;
fullDMLScriptName = HOME + TEST_NAME + ".dml";
programArgs = new String[] { "-explain", "-args", Integer.toString(rows), Integer.toString(cols), output("X") };
fullRScriptName = HOME + TEST_NAME + ".R";
rCmd = "Rscript" + " " + fullRScriptName + " " + Integer.toString(rows) + " " + Integer.toString(cols) + " " + expectedDir();
OptimizerUtils.ALLOW_BRANCH_REMOVAL = branchRemoval;
OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS = IPA;
runTest(true, false, null, -1);
runRScript(true);
// compare matrices
HashMap<CellIndex, Double> dmlfile = readDMLMatrixFromHDFS("X");
HashMap<CellIndex, Double> rfile = readRMatrixFromFS("X");
TestUtils.compareMatrices(dmlfile, rfile, 0, "Stat-DML", "Stat-R");
// check expected number of compiled and executed MR jobs
// rand
int expectedNumCompiled = branchRemoval ? 0 : 1;
int expectedNumExecuted = 0;
checkNumCompiledMRJobs(expectedNumCompiled);
checkNumExecutedMRJobs(expectedNumExecuted);
} finally {
OptimizerUtils.ALLOW_BRANCH_REMOVAL = oldFlagBranchRemoval;
OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS = oldFlagIPA;
}
}
use of org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex in project incubator-systemml by apache.
the class IPAConstantPropagationTest method runIPAConstantPropagationTest.
private void runIPAConstantPropagationTest(boolean update, boolean branchRemoval, boolean IPA) {
boolean oldFlagBranchRemoval = OptimizerUtils.ALLOW_BRANCH_REMOVAL;
boolean oldFlagIPA = OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS;
String TEST_NAME = update ? TEST_NAME2 : TEST_NAME1;
try {
TestConfiguration config = getTestConfiguration(TEST_NAME);
loadTestConfiguration(config);
String HOME = SCRIPT_DIR + TEST_DIR;
fullDMLScriptName = HOME + TEST_NAME + ".dml";
programArgs = new String[] { "-explain", "-args", Integer.toString(rows), Integer.toString(cols), output("X") };
fullRScriptName = HOME + TEST_NAME + ".R";
rCmd = "Rscript" + " " + fullRScriptName + " " + Integer.toString(rows) + " " + Integer.toString(cols) + " " + expectedDir();
OptimizerUtils.ALLOW_BRANCH_REMOVAL = branchRemoval;
OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS = IPA;
runTest(true, false, null, -1);
runRScript(true);
// compare matrices
HashMap<CellIndex, Double> dmlfile = readDMLMatrixFromHDFS("X");
HashMap<CellIndex, Double> rfile = readRMatrixFromFS("X");
TestUtils.compareMatrices(dmlfile, rfile, 0, "Stat-DML", "Stat-R");
// check expected number of compiled and executed MR jobs
// rand
int expectedNumCompiled = (branchRemoval && !update) ? 0 : 1;
int expectedNumExecuted = 0;
checkNumCompiledMRJobs(expectedNumCompiled);
checkNumExecutedMRJobs(expectedNumExecuted);
} finally {
OptimizerUtils.ALLOW_BRANCH_REMOVAL = oldFlagBranchRemoval;
OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS = oldFlagIPA;
}
}
use of org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex in project incubator-systemml by apache.
the class IPAPropagationSizeMultipleFunctionsTest method runIPASizePropagationMultipleFunctionsTest.
private void runIPASizePropagationMultipleFunctionsTest(String TEST_NAME, boolean IPA) {
boolean oldFlagIPA = OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS;
try {
TestConfiguration config = getTestConfiguration(TEST_NAME);
loadTestConfiguration(config);
String HOME = SCRIPT_DIR + TEST_DIR;
fullDMLScriptName = HOME + TEST_NAME + ".dml";
programArgs = new String[] { "-explain", "-args", input("V"), output("R") };
fullRScriptName = HOME + TEST_NAME + ".R";
rCmd = "Rscript" + " " + fullRScriptName + " " + inputDir() + " " + expectedDir();
OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS = IPA;
// generate input data
double[][] V = getRandomMatrix(rows, cols, 0, 1, sparsity, 7);
writeInputMatrixWithMTD("V", V, true);
// run tests
runTest(true, false, null, -1);
runRScript(true);
// compare matrices
HashMap<CellIndex, Double> dmlfile = readDMLMatrixFromHDFS("R");
HashMap<CellIndex, Double> rfile = readRMatrixFromFS("R");
TestUtils.compareMatrices(dmlfile, rfile, 0, "Stat-DML", "Stat-R");
// check expected number of compiled and executed MR jobs
int expectedNumCompiled = (IPA) ? ((TEST_NAME.equals(TEST_NAME5)) ? 2 : 1) : // reblock, 2xGMR foo, GMR
(TEST_NAME.equals(TEST_NAME5) ? 5 : 4);
int expectedNumExecuted = 0;
checkNumCompiledMRJobs(expectedNumCompiled);
checkNumExecutedMRJobs(expectedNumExecuted);
} finally {
OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS = oldFlagIPA;
}
}
use of org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex in project incubator-systemml by apache.
the class MultipleReadsIPATest method runMultipleReadsTest.
/**
* @param condition
* @param branchRemoval
* @param IPA
*/
private void runMultipleReadsTest(ExecType et, boolean IPA) {
RUNTIME_PLATFORM platformOld = rtplatform;
boolean oldFlagIPA = OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS;
try {
TestConfiguration config = getTestConfiguration(TEST_NAME);
loadTestConfiguration(config);
/* This is for running the junit test the new way, i.e., construct the arguments directly */
String HOME = SCRIPT_DIR + TEST_DIR;
fullDMLScriptName = HOME + TEST_NAME + ".dml";
programArgs = new String[] { "-args", input("X1"), Integer.toString(rows1), Integer.toString(cols1), input("X2"), Integer.toString(rows2), Integer.toString(cols2), output("X") };
fullRScriptName = HOME + TEST_NAME + ".R";
rCmd = "Rscript" + " " + fullRScriptName + " " + inputDir() + " " + expectedDir();
rtplatform = (et == ExecType.MR) ? RUNTIME_PLATFORM.HADOOP : RUNTIME_PLATFORM.HYBRID;
OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS = IPA;
double[][] X1 = getRandomMatrix(rows1, cols1, -1, 1, 1.0d, 7);
writeInputMatrix("X1", X1, true);
double[][] X2 = getRandomMatrix(rows2, cols2, -1, 1, 1.0d, 7);
writeInputMatrix("X2", X2, true);
runTest(true, false, null, -1);
runRScript(true);
// compare matrices
HashMap<CellIndex, Double> dmlfile = readDMLMatrixFromHDFS("X");
HashMap<CellIndex, Double> rfile = readRMatrixFromFS("X");
TestUtils.compareMatrices(dmlfile, rfile, 0, "Stat-DML", "Stat-R");
} finally {
rtplatform = platformOld;
OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS = oldFlagIPA;
}
}
use of org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex in project incubator-systemml by apache.
the class RandJobRecompileTest method runRandJobRecompileTest.
/**
* @param estSizeEval
*/
private void runRandJobRecompileTest(boolean estSizeEval) {
boolean oldFlagSizeEval = OptimizerUtils.ALLOW_WORSTCASE_SIZE_EXPRESSION_EVALUATION;
try {
TestConfiguration config = getTestConfiguration(TEST_NAME);
loadTestConfiguration(config);
/* This is for running the junit test the new way, i.e., construct the arguments directly */
String HOME = SCRIPT_DIR + TEST_DIR;
fullDMLScriptName = HOME + TEST_NAME + ".dml";
programArgs = new String[] { "-args", input("X"), Integer.toString(rows), output("Z") };
fullRScriptName = HOME + TEST_NAME + ".R";
rCmd = "Rscript" + " " + fullRScriptName + " " + inputDir() + " " + expectedDir();
OptimizerUtils.ALLOW_WORSTCASE_SIZE_EXPRESSION_EVALUATION = estSizeEval;
double[][] V = TestUtils.round(getRandomMatrix(rows, cols, min, max, 1.0d, 7));
writeInputMatrix("X", V, true);
runTest(true, false, null, -1);
runRScript(true);
// compare matrices
HashMap<CellIndex, Double> dmlfile = readDMLMatrixFromHDFS("Z");
HashMap<CellIndex, Double> rfile = readRMatrixFromFS("Z");
TestUtils.compareMatrices(dmlfile, rfile, 0, "Stat-DML", "Stat-R");
// check expected number of compiled and executed MR jobs
// rand, write
int expectedNumCompiled = (estSizeEval ? 1 : 2);
int expectedNumExecuted = 0;
checkNumCompiledMRJobs(expectedNumCompiled);
checkNumExecutedMRJobs(expectedNumExecuted);
} finally {
OptimizerUtils.ALLOW_WORSTCASE_SIZE_EXPRESSION_EVALUATION = oldFlagSizeEval;
}
}
Aggregations