use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class RowBatchRightIndexingTest method runRightIndexingTest.
/**
* @param et
* @param sparse
*/
public void runRightIndexingTest(ExecType et, boolean sparse) {
RUNTIME_PLATFORM platformOld = rtplatform;
switch(et) {
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;
try {
TestConfiguration config = getTestConfiguration(TEST_NAME);
loadTestConfiguration(config);
double sparsity = sparse ? sparsity2 : sparsity1;
config.addVariable("rows", rows);
config.addVariable("cols", cols);
String RI_HOME = SCRIPT_DIR + TEST_DIR;
fullDMLScriptName = RI_HOME + TEST_NAME + ".dml";
programArgs = new String[] { "-args", input("A"), output("B") };
fullRScriptName = RI_HOME + TEST_NAME + ".R";
rCmd = "Rscript" + " " + fullRScriptName + " " + inputDir() + " " + expectedDir();
double[][] A = getRandomMatrix(rows, cols, 0, 1, sparsity, 23);
writeInputMatrixWithMTD("A", A, true);
// run tests
runTest(true, false, null, -1);
runRScript(true);
// compare output aggregate
HashMap<CellIndex, Double> dmlfile = readDMLMatrixFromHDFS("B");
HashMap<CellIndex, Double> rfile = readRMatrixFromFS("B");
TestUtils.compareMatrices(dmlfile, rfile, epsilon, "DML", "R");
} finally {
rtplatform = platformOld;
DMLScript.USE_LOCAL_SPARK_CONFIG = sparkConfigOld;
}
}
use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class UnboundedScalarRightIndexingTest method runRightIndexingTest.
/**
* @param et
*/
public void runRightIndexingTest(ExecType et, int val) {
RUNTIME_PLATFORM platformOld = rtplatform;
switch(et) {
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;
try {
TestConfiguration config = getTestConfiguration(TEST_NAME);
loadTestConfiguration(config);
String RI_HOME = SCRIPT_DIR + TEST_DIR;
fullDMLScriptName = RI_HOME + TEST_NAME + ".dml";
programArgs = new String[] { "-args", String.valueOf(val) };
fullRScriptName = RI_HOME + TEST_NAME + ".R";
// run test (expected runtime exception)
runTest(true, true, DMLException.class, -1);
} finally {
rtplatform = platformOld;
DMLScript.USE_LOCAL_SPARK_CONFIG = sparkConfigOld;
}
}
use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class IOTest2 method testSimple.
@Test
public void testSimple() {
int rows = 10;
int cols = 10;
TestConfiguration config = getTestConfiguration(TEST_NAME);
config.addVariable("rows", rows);
config.addVariable("cols", cols);
config.addVariable("format", "text");
loadTestConfiguration(config);
double[][] a = getRandomMatrix(rows, cols, -1, 1, 0.5, -1);
writeInputMatrix("a", a);
writeExpectedMatrix("a", a);
runTest(true, DMLException.class);
}
use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class IOTest3 method testSimple.
@Test
public void testSimple() {
int rows = 10;
int cols = 10;
TestConfiguration config = getTestConfiguration(TEST_NAME);
config.addVariable("rows", rows);
config.addVariable("cols", cols);
config.addVariable("format", "text");
loadTestConfiguration(config);
double[][] a = getRandomMatrix(rows, cols, -1, 1, 0.5, -1);
writeInputMatrix("a", a);
writeExpectedMatrix("a", a);
runTest(true, DMLException.class);
}
use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.
the class IOTest5 method testSimple.
@Test
public void testSimple() {
int rows = 10;
int cols = 10;
TestConfiguration config = getTestConfiguration(TEST_NAME);
config.addVariable("rows", rows);
config.addVariable("cols", cols);
config.addVariable("format", "text");
loadTestConfiguration(config);
double[][] a = getRandomMatrix(rows, cols, -1, 1, 0.5, -1);
writeInputMatrix("a", a);
writeExpectedMatrix("a", a);
runTest(true, DMLException.class);
}
Aggregations