Deron Eriksson created SYSTEMML-651:
---------------------------------------

             Summary: Fix scalar input support for JMLC
                 Key: SYSTEMML-651
                 URL: https://issues.apache.org/jira/browse/SYSTEMML-651
             Project: SystemML
          Issue Type: Bug
          Components: APIs
            Reporter: Deron Eriksson
            Assignee: Deron Eriksson
            Priority: Minor


Currently scalar input variables via JMLC do not work. 

Sample DML (matrix input, scalar input, and a matrix output):
{code}
inMatrix = read("./tmp/inMatrix", rows=-1, cols=-1);
print('inMatrix: ' + nrow(inMatrix) + 'x' + ncol(inMatrix));

inScalar = read("./tmp/inScalar", data_type="scalar", value_type="int");
print('inScalar: ' + inScalar);

outMatrix = matrix("1 2 3 0", rows=2, cols=2);
print('outMatrix: ' + nrow(outMatrix) + 'x' + ncol(outMatrix));
write(outMatrix, "./tmp", format="text");
{code}

JMLC code:
{code}
Connection conn = new Connection();
String dml = conn.readScript("scalar-test.dml");
PreparedScript script = conn.prepareScript(dml, new String[] { "inMatrix", 
"inScalar" }, new String[] { "outMatrix" }, false);

double[][] inMatrix = matrix(2, 2, new double[] { 1, 2, 3, 4 });
int inScalar = 5;

script.setMatrix("inMatrix", inMatrix);
script.setScalar("inScalar", inScalar);
ResultVariables results = script.executeScript();
double[][] result = results.getMatrix("outMatrix");
{code}

Generates the following error:
{code}
Exception in thread "main" org.apache.sysml.runtime.DMLRuntimeException: 
org.apache.sysml.runtime.DMLRuntimeException: ERROR: Runtime error in program 
block generated from statement block between lines 1 and 9 -- Error evaluating 
instruction: CP°read°_Var4·SCALAR·INT·false°./tmp/inScalar·SCALAR·STRING·true
        at 
org.apache.sysml.runtime.controlprogram.Program.execute(Program.java:152)
        at 
org.apache.sysml.api.jmlc.PreparedScript.executeScript(PreparedScript.java:390)
        at org.apache.sysml.JMLCExampleScalar.main(JMLCExampleScalar.java:26)
Caused by: org.apache.sysml.runtime.DMLRuntimeException: ERROR: Runtime error 
in program block generated from statement block between lines 1 and 9 -- Error 
evaluating instruction: 
CP°read°_Var4·SCALAR·INT·false°./tmp/inScalar·SCALAR·STRING·true
        at 
org.apache.sysml.runtime.controlprogram.ProgramBlock.executeSingleInstruction(ProgramBlock.java:333)
        at 
org.apache.sysml.runtime.controlprogram.ProgramBlock.executeInstructions(ProgramBlock.java:222)
        at 
org.apache.sysml.runtime.controlprogram.ProgramBlock.execute(ProgramBlock.java:166)
        at 
org.apache.sysml.runtime.controlprogram.Program.execute(Program.java:145)
        ... 2 more
Caused by: org.apache.sysml.runtime.DMLRuntimeException: 
java.io.FileNotFoundException: File tmp/inScalar does not exist
{code}

The matrix input and output work fine.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to