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" }));
}
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);
}
}
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;
}
}
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);
}
}
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();
}
Aggregations