Search in sources :

Example 11 with TestConfiguration

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

the class ColSumTest method setUp.

@Override
public void setUp() {
    // positive tests
    addTestConfiguration(TEST_GENERAL, new TestConfiguration(TEST_CLASS_DIR, "ColSumTest", new String[] { "vector_colsum", "matrix_colsum" }));
    // negative tests
    addTestConfiguration(TEST_SCALAR, new TestConfiguration(TEST_CLASS_DIR, "ColSumScalarTest", new String[] { "computed" }));
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Example 12 with TestConfiguration

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

the class FullGroupedAggregateTest method setUp.

@Override
public void setUp() {
    addTestConfiguration(TEST_NAME1, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] { "C" }));
    addTestConfiguration(TEST_NAME2, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME2, new String[] { "D" }));
    TestUtils.clearAssertionInformation();
    if (TEST_CACHE_ENABLED) {
        setOutAndExpectedDeletionDisabled(true);
    }
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Example 13 with TestConfiguration

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

the class FullRowAggregateTest method runRowAggregateOperationTest.

/**
	 * 
	 * @param sparseM1
	 * @param sparseM2
	 * @param instType
	 */
private void runRowAggregateOperationTest(OpType type, boolean sparse, boolean vector, ExecType instType, boolean specialData, boolean rewrites) {
    RUNTIME_PLATFORM platformOld = rtplatform;
    switch(instType) {
        case MR:
            rtplatform = RUNTIME_PLATFORM.HADOOP;
            break;
        case SPARK:
            rtplatform = RUNTIME_PLATFORM.SPARK;
            break;
        default:
            rtplatform = RUNTIME_PLATFORM.HYBRID;
            break;
    }
    boolean sparkConfigOld = DMLScript.USE_LOCAL_SPARK_CONFIG;
    if (rtplatform == RUNTIME_PLATFORM.SPARK)
        DMLScript.USE_LOCAL_SPARK_CONFIG = true;
    boolean oldRewritesFlag = OptimizerUtils.ALLOW_ALGEBRAIC_SIMPLIFICATION;
    OptimizerUtils.ALLOW_ALGEBRAIC_SIMPLIFICATION = rewrites;
    try {
        String TEST_NAME = null;
        switch(type) {
            case ROW_SUMS:
                TEST_NAME = TEST_NAME1;
                break;
            case ROW_MEANS:
                TEST_NAME = TEST_NAME2;
                break;
            case ROW_MAX:
                TEST_NAME = TEST_NAME3;
                break;
            case ROW_MIN:
                TEST_NAME = TEST_NAME4;
                break;
            case ROW_INDEXMAX:
                TEST_NAME = TEST_NAME5;
                break;
            case ROW_INDEXMIN:
                TEST_NAME = TEST_NAME6;
                break;
        }
        int rows = (vector) ? rows1 : rows2;
        double sparsity = (sparse) ? sparsity1 : sparsity2;
        TestConfiguration config = getTestConfiguration(TEST_NAME);
        //generate actual dataset
        double min, max;
        // in case of ROW_INDEXMIN, generate all positive data.
        if (type == OpType.ROW_INDEXMAX) {
            //special data: negative, 0 is actual max
            min = specialData ? -1 : -0.05;
            max = specialData ? -0.05 : 1;
        } else if (type == OpType.ROW_INDEXMIN) {
            //special data: positive, 0 is actual min
            min = specialData ? 0.05 : -1;
            max = specialData ? 1 : 0.05;
        } else {
            min = -0.05;
            max = 1;
        }
        String TEST_CACHE_DIR = "";
        if (TEST_CACHE_ENABLED) {
            TEST_CACHE_DIR = type.ordinal() + "_" + rows + "_" + specialData + "_" + sparsity + "/";
        }
        loadTestConfiguration(config, TEST_CACHE_DIR);
        /* 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[] { "-explain", "-args", input("A"), Integer.toString(rows), Integer.toString(cols), output("B") };
        fullRScriptName = HOME + TEST_NAME + ".R";
        rCmd = "Rscript" + " " + fullRScriptName + " " + inputDir() + " " + expectedDir();
        double[][] A = getRandomMatrix(rows, cols, min, max, sparsity, 7);
        writeInputMatrix("A", A, true);
        boolean exceptionExpected = false;
        runTest(true, exceptionExpected, null, -1);
        runRScript(true);
        //compare matrices 
        HashMap<CellIndex, Double> dmlfile = readDMLMatrixFromHDFS("B");
        HashMap<CellIndex, Double> rfile = readRMatrixFromFS("B");
        TestUtils.compareMatrices(dmlfile, rfile, eps, "Stat-DML", "Stat-R");
    } finally {
        rtplatform = platformOld;
        DMLScript.USE_LOCAL_SPARK_CONFIG = sparkConfigOld;
        OptimizerUtils.ALLOW_ALGEBRAIC_SIMPLIFICATION = oldRewritesFlag;
    }
}
Also used : RUNTIME_PLATFORM(org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM) CellIndex(org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex) TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Example 14 with TestConfiguration

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

the class FullRowAggregateTest method setUp.

@Override
public void setUp() {
    addTestConfiguration(TEST_NAME1, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] { "B" }));
    addTestConfiguration(TEST_NAME2, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME2, new String[] { "B" }));
    addTestConfiguration(TEST_NAME3, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME3, new String[] { "B" }));
    addTestConfiguration(TEST_NAME4, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME4, new String[] { "B" }));
    addTestConfiguration(TEST_NAME5, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME5, new String[] { "B" }));
    addTestConfiguration(TEST_NAME6, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME6, new String[] { "B" }));
    if (TEST_CACHE_ENABLED) {
        setOutAndExpectedDeletionDisabled(true);
    }
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Example 15 with TestConfiguration

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

the class LengthTest method testGeneral.

@Test
public void testGeneral() {
    int rows = 10;
    int cols = 10;
    TestConfiguration config = getTestConfiguration(TEST_GENERAL);
    config.addVariable("rows", rows);
    config.addVariable("cols", cols);
    loadTestConfiguration(config);
    createHelperMatrix();
    double[][] vector = getRandomMatrix(rows, 1, 0, 1, 1, -1);
    writeInputMatrix("vector", vector);
    writeExpectedHelperMatrix("vector_length", rows);
    double[][] matrix = getRandomMatrix(rows, cols, 0, 1, 1, -1);
    writeInputMatrix("matrix", matrix);
    writeExpectedHelperMatrix("matrix_length", (rows * cols));
    runTest();
    compareResults();
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration) Test(org.junit.Test)

Aggregations

TestConfiguration (org.apache.sysml.test.integration.TestConfiguration)781 Test (org.junit.Test)298 CellIndex (org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex)169 RUNTIME_PLATFORM (org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM)138 MatrixCharacteristics (org.apache.sysml.runtime.matrix.MatrixCharacteristics)48 IOException (java.io.IOException)18 MatrixBlock (org.apache.sysml.runtime.matrix.data.MatrixBlock)13 DMLRuntimeException (org.apache.sysml.runtime.DMLRuntimeException)10 Modulus (org.apache.sysml.runtime.functionobjects.Modulus)9 HashMap (java.util.HashMap)8 FrameBlock (org.apache.sysml.runtime.matrix.data.FrameBlock)8 Random (java.util.Random)6 DMLException (org.apache.sysml.api.DMLException)6 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