use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class IPAFunctionInliningTest method runIPAFunInlineTest.
private void runIPAFunInlineTest(String testName, boolean IPA) {
boolean oldFlagIPA = OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS;
try {
TestConfiguration config = getTestConfiguration(testName);
loadTestConfiguration(config);
String HOME = SCRIPT_DIR + TEST_DIR;
fullDMLScriptName = HOME + testName + ".dml";
programArgs = new String[] { "-explain", "-stats", "-args", output("R") };
fullRScriptName = HOME + testName + ".R";
rCmd = getRCmd(expectedDir());
OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS = IPA;
// run script and compare output
runTest(true, false, null, -1);
// compare results
if (!testName.equals(TEST_NAME6)) {
double val = readDMLMatrixFromHDFS("R").get(new CellIndex(1, 1));
Assert.assertTrue("Wrong result: 7 vs " + val, Math.abs(val - 7) < Math.pow(10, -14));
}
// compare inlined functions
boolean inlined = (IPA && ArrayUtils.contains(new String[] { TEST_NAME1, TEST_NAME2, TEST_NAME3, TEST_NAME6 }, testName));
Assert.assertTrue("Unexpected function call: " + inlined, !heavyHittersContainsSubString("foo") == inlined);
// check for incorrect operation replication
if (testName.equals(TEST_NAME6))
Assert.assertTrue(Statistics.getCPHeavyHitterCount("print") == 1);
} finally {
OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS = oldFlagIPA;
}
}
use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class IPALiteralReplacementTest method setUp.
@Override
public void setUp() {
TestUtils.clearAssertionInformation();
addTestConfiguration(TEST_NAME1, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] { "R" }));
addTestConfiguration(TEST_NAME2, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME2, new String[] { "R" }));
}
use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class IPANnzPropagationTest method runIPANnzPropgationTest.
private void runIPANnzPropgationTest(String testname) {
// Save old settings
boolean sparkConfigOld = DMLScript.USE_LOCAL_SPARK_CONFIG;
RUNTIME_PLATFORM platformOld = rtplatform;
try {
// Setup test
TestConfiguration config = getTestConfiguration(testname);
loadTestConfiguration(config);
String HOME = SCRIPT_DIR + TEST_DIR;
fullDMLScriptName = HOME + testname + ".dml";
programArgs = new String[] { "-stats", "-explain", "recompile_hops" };
DMLScript.USE_LOCAL_SPARK_CONFIG = true;
rtplatform = RUNTIME_PLATFORM.HYBRID_SPARK;
runTest(true, false, null, -1);
// check for propagated nnz
checkNumCompiledSparkInst(testname.equals(TEST_NAME1) ? 0 : 1);
checkNumExecutedSparkInst(0);
} finally {
DMLScript.USE_LOCAL_SPARK_CONFIG = sparkConfigOld;
rtplatform = platformOld;
}
}
use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class IPAScalarVariablePropagationTest method runIPAScalarVariablePropagationTest.
/**
* @param testname
* @param IPA
*/
private void runIPAScalarVariablePropagationTest(String testname, boolean IPA) {
boolean oldFlagIPA = OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS;
try {
TestConfiguration config = getTestConfiguration(testname);
loadTestConfiguration(config);
String HOME = SCRIPT_DIR + TEST_DIR;
fullDMLScriptName = HOME + testname + ".dml";
programArgs = new String[] { "-stats", "-args", String.valueOf(10) };
OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS = IPA;
// run test, incl expected MR jobs (in case if IPA 0 due to scalar propagation)
runTest(true, false, null, IPA ? 0 : 28);
// check for applied rewrites (in both cases, we expect the rewrites to happen:
// - without IPA it should be marked for recompilation and recompiled per iteration
// - with IPA the scalar rank should be directly propagated into the function
Assert.assertTrue("Missing opcode wdivmm", Statistics.getCPHeavyHitterOpCodes().contains(WeightedDivMM.OPCODE_CP));
Assert.assertTrue("Missing opcode wcemm", Statistics.getCPHeavyHitterOpCodes().contains(WeightedCrossEntropy.OPCODE_CP));
} finally {
OptimizerUtils.ALLOW_INTER_PROCEDURAL_ANALYSIS = oldFlagIPA;
}
}
use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class IPAScalarVariablePropagationTest method setUp.
@Override
public void setUp() {
TestUtils.clearAssertionInformation();
addTestConfiguration(TEST_NAME1, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] {}));
}
Aggregations