use of org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM in project incubator-systemml by apache.
the class FormatChangeTest method testFormatChangeHybrid.
@Test
public void testFormatChangeHybrid() {
setup();
RUNTIME_PLATFORM old_platform = rtplatform;
rtplatform = RUNTIME_PLATFORM.HYBRID;
formatChangeTest();
rtplatform = old_platform;
}
use of org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM in project incubator-systemml by apache.
the class WriteCSVTest method runCSVWriteTest.
private void runCSVWriteTest(RUNTIME_PLATFORM platform, boolean header, String sep, boolean sparse) throws IOException {
RUNTIME_PLATFORM oldPlatform = rtplatform;
rtplatform = platform;
TestConfiguration config = getTestConfiguration(TEST_NAME);
loadTestConfiguration(config);
String HOME = SCRIPT_DIR + TEST_DIR;
// always read the same data, independent of testNumber
String inputMatrixName = HOME + INPUT_DIR + "transfusion_1";
String dmlOutput = output("dml.scalar");
String csvOutputName = output("transfusion_dml.data");
String rOutput = output("R.scalar");
fullDMLScriptName = HOME + TEST_NAME + ".dml";
programArgs = new String[] { "-explain", "-args", inputMatrixName, dmlOutput, csvOutputName, Boolean.toString(header), sep, Boolean.toString(sparse) };
runTest(true, false, null, -1);
// Verify produced CSV file w/ R
csvOutputName = TestUtils.processMultiPartCSVForR(csvOutputName);
fullRScriptName = HOME + "writecsv_verify.R";
rCmd = "Rscript" + " " + fullRScriptName + " " + csvOutputName + " " + Boolean.toString(header).toUpperCase() + " " + sep + " " + rOutput;
runRScript(true);
double dmlScalar = TestUtils.readDMLScalar(dmlOutput);
double rScalar = TestUtils.readRScalar(rOutput);
TestUtils.compareScalars(dmlScalar, rScalar, eps);
rtplatform = oldPlatform;
}
use of org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM in project incubator-systemml by apache.
the class IPAConstantFoldingScalarVariablePropagationTest method runIPAScalarVariablePropagationTest.
/**
* Test for static rewrites + IPA second chance compilation to allow
* for scalar propagation (IPA) of constant-folded DAG of literals
* (static rewrites) made possible by an initial scalar propagation
* (IPA).
*
* @param testname The name of the test.
* @param IPA_SECOND_CHANCE Whether or not to use IPA second chance.
*/
private void runIPAScalarVariablePropagationTest(String testname, boolean IPA_SECOND_CHANCE) {
// Save old settings
int oldIPANumRep = OptimizerUtils.IPA_NUM_REPETITIONS;
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" };
OptimizerUtils.IPA_NUM_REPETITIONS = IPA_SECOND_CHANCE ? 2 : 1;
DMLScript.USE_LOCAL_SPARK_CONFIG = true;
rtplatform = RUNTIME_PLATFORM.HYBRID_SPARK;
// Run test
runTest(true, false, null, -1);
// Check for correct number of compiled & executed Spark jobs
// (MB: originally, this required a second chance, but not anymore)
checkNumCompiledSparkInst(0);
checkNumExecutedSparkInst(0);
} finally {
// Reset
OptimizerUtils.IPA_NUM_REPETITIONS = oldIPANumRep;
DMLScript.USE_LOCAL_SPARK_CONFIG = sparkConfigOld;
rtplatform = platformOld;
}
}
use of org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM 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.api.DMLScript.RUNTIME_PLATFORM in project incubator-systemml by apache.
the class NrowNcolUnknownCSVReadTest method runNxxUnkownCSVTest.
/**
* @param cfc
* @param vt
*/
private void runNxxUnkownCSVTest(String testName) {
String TEST_NAME = testName;
RUNTIME_PLATFORM oldplatform = rtplatform;
try {
rtplatform = RUNTIME_PLATFORM.SINGLE_NODE;
// test configuration
getAndLoadTestConfiguration(TEST_NAME);
String HOME = SCRIPT_DIR + TEST_DIR;
fullDMLScriptName = HOME + TEST_NAME + ".dml";
programArgs = new String[] { "-args", input("A") };
// generate input data w/o mtd file (delete any mtd file from previous runs)
int rows = 1034;
int cols = 73;
double[][] A = getRandomMatrix(rows, cols, 0, 1, 1.0, 7);
MatrixBlock mb = DataConverter.convertToMatrixBlock(A);
DataConverter.writeMatrixToHDFS(mb, input("A"), OutputInfo.CSVOutputInfo, new MatrixCharacteristics(rows, cols, -1, -1));
MapReduceTool.deleteFileIfExistOnHDFS(input("A.mtd"));
// run tests
runTest(true, false, null, -1);
} catch (Exception ex) {
throw new RuntimeException(ex);
} finally {
rtplatform = oldplatform;
}
}
Aggregations