Search in sources :

Example 76 with TestConfiguration

use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.

the class ReadCSVTest method setUp.

@Override
public void setUp() {
    TestUtils.clearAssertionInformation();
    addTestConfiguration(TEST_NAME, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME, new String[] { "Rout" }));
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Example 77 with TestConfiguration

use of org.apache.sysml.test.integration.TestConfiguration 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 78 with TestConfiguration

use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.

the class FrameEncodeTest method runJMLCReuseTest.

private void runJMLCReuseTest(String testname, boolean sparse, boolean modelReuse) throws IOException {
    String TEST_NAME = testname;
    TestConfiguration config = getTestConfiguration(TEST_NAME);
    loadTestConfiguration(config);
    // generate inputs
    double[][] Fd = TestUtils.round(getRandomMatrix(rows, cols, 0.51, 7.49, sparse ? sparsity2 : sparsity1, 1234));
    String[][] F1s = FrameTransformTest.createFrameData(Fd);
    // run DML via JMLC
    ArrayList<String[][]> F2set = execDMLScriptviaJMLC(TEST_NAME, F1s, modelReuse);
    // check correct result
    for (String[][] data : F2set) for (int i = 0; i < F1s.length; i++) for (int j = 0; j < F1s[i].length; j++) Assert.assertEquals("Wrong result: " + data[i][j] + ".", data[i][j], F1s[i][j]);
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Example 79 with TestConfiguration

use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.

the class FrameIndexingAppendTest method runJMLCReuseTest.

private void runJMLCReuseTest(String testname, boolean sparse, boolean modelReuse) throws IOException {
    String TEST_NAME = testname;
    TestConfiguration config = getTestConfiguration(TEST_NAME);
    loadTestConfiguration(config);
    // generate inputs
    double[][] Fd = TestUtils.round(getRandomMatrix(rows, cols, 0.51, 7.49, sparse ? sparsity2 : sparsity1, 1234));
    String[][] F1s = FrameTransformTest.createFrameData(Fd);
    String[][] Ms = FrameTransformTest.createRecodeMaps(F1s);
    // run DML via JMLC
    ArrayList<String[][]> F2set = execDMLScriptviaJMLC(TEST_NAME, F1s, Ms, modelReuse);
    // check correct result
    for (String[][] data : F2set) for (int i = 0; i < F1s.length; i++) for (int j = 0; j < F1s[i].length; j++) Assert.assertEquals("Wrong result: " + data[i][j] + ".", data[i][j], F1s[i][j]);
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Example 80 with TestConfiguration

use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.

the class FrameLeftIndexingTest method runJMLCReuseTest.

private void runJMLCReuseTest(String testname, boolean sparse, boolean modelReuse) throws IOException {
    String TEST_NAME = testname;
    TestConfiguration config = getTestConfiguration(TEST_NAME);
    loadTestConfiguration(config);
    // generate inputs
    double[][] Fd = TestUtils.round(getRandomMatrix(rows, cols, 0.51, 7.49, sparse ? sparsity2 : sparsity1, 1234));
    String[][] F1s = FrameTransformTest.createFrameData(Fd);
    String[][] Ms = FrameTransformTest.createRecodeMaps(F1s);
    // run DML via JMLC
    ArrayList<String[][]> F2set = execDMLScriptviaJMLC(TEST_NAME, F1s, Ms, modelReuse);
    // check correct result
    for (String[][] data : F2set) for (int i = 0; i < F1s.length; i++) for (int j = 0; j < F1s[i].length; j++) Assert.assertEquals("Wrong result: " + data[i][j] + ".", data[i][j], F1s[i][j]);
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Aggregations

TestConfiguration (org.apache.sysml.test.integration.TestConfiguration)866 Test (org.junit.Test)299 CellIndex (org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex)201 RUNTIME_PLATFORM (org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM)171 MatrixCharacteristics (org.apache.sysml.runtime.matrix.MatrixCharacteristics)50 IOException (java.io.IOException)18 MatrixBlock (org.apache.sysml.runtime.matrix.data.MatrixBlock)14 Modulus (org.apache.sysml.runtime.functionobjects.Modulus)9 HashMap (java.util.HashMap)8 FrameBlock (org.apache.sysml.runtime.matrix.data.FrameBlock)8 DMLException (org.apache.sysml.api.DMLException)6 Random (java.util.Random)5 ValueType (org.apache.sysml.parser.Expression.ValueType)5 Date (java.util.Date)3 BufferedReader (java.io.BufferedReader)2 FileReader (java.io.FileReader)2 Connection (org.apache.sysml.api.jmlc.Connection)2 DMLConfig (org.apache.sysml.conf.DMLConfig)2 DMLProgram (org.apache.sysml.parser.DMLProgram)2 DMLTranslator (org.apache.sysml.parser.DMLTranslator)2