Search in sources :

Example 31 with RUNTIME_PLATFORM

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;
}
Also used : RUNTIME_PLATFORM(org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM) Test(org.junit.Test)

Example 32 with RUNTIME_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;
}
Also used : RUNTIME_PLATFORM(org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM) TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Example 33 with RUNTIME_PLATFORM

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;
    }
}
Also used : RUNTIME_PLATFORM(org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM) TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Example 34 with RUNTIME_PLATFORM

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;
    }
}
Also used : RUNTIME_PLATFORM(org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM) TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Example 35 with RUNTIME_PLATFORM

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;
    }
}
Also used : RUNTIME_PLATFORM(org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM) MatrixBlock(org.apache.sysml.runtime.matrix.data.MatrixBlock) MatrixCharacteristics(org.apache.sysml.runtime.matrix.MatrixCharacteristics)

Aggregations

RUNTIME_PLATFORM (org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM)248 CellIndex (org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex)173 TestConfiguration (org.apache.sysml.test.integration.TestConfiguration)171 MatrixCharacteristics (org.apache.sysml.runtime.matrix.MatrixCharacteristics)42 Test (org.junit.Test)17 FrameBlock (org.apache.sysml.runtime.matrix.data.FrameBlock)16 IOException (java.io.IOException)14 MatrixBlock (org.apache.sysml.runtime.matrix.data.MatrixBlock)13 CSVFileFormatProperties (org.apache.sysml.runtime.matrix.data.CSVFileFormatProperties)9 FrameReader (org.apache.sysml.runtime.io.FrameReader)8 Random (java.util.Random)7 Row (org.apache.spark.sql.Row)5 ValueType (org.apache.sysml.parser.Expression.ValueType)5 HashMap (java.util.HashMap)4 DMLScript (org.apache.sysml.api.DMLScript)4 Script (org.apache.sysml.api.mlcontext.Script)4 DMLRuntimeException (org.apache.sysml.runtime.DMLRuntimeException)4 Matrix (org.apache.sysml.api.mlcontext.Matrix)3 InputInfo (org.apache.sysml.runtime.matrix.data.InputInfo)3 MatrixIndexes (org.apache.sysml.runtime.matrix.data.MatrixIndexes)3