[ https://issues.apache.org/jira/browse/SYSTEMML-649?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15256721#comment-15256721 ]
Deron Eriksson commented on SYSTEMML-649: ----------------------------------------- Do scalar inputs via JMLC currently work? If I have this DML: {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} and I do this: {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} I get: {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. > JMLC/MLContext support for scalar output variables > -------------------------------------------------- > > Key: SYSTEMML-649 > URL: https://issues.apache.org/jira/browse/SYSTEMML-649 > Project: SystemML > Issue Type: Task > Components: APIs > Reporter: Matthias Boehm > Assignee: Deron Eriksson > > Right now neither JMLC nor MLContext supports scalar output variables. This > task aims to extend both APIs with the required primitives. > The workaround is to cast any output scalar on script-level with as.matrix to > a 1-1 matrix and handle it in the calling application. However, especially > with MLContext this puts an unnecessary burden on the user as he needs to > deal with RDDs for a simple scalar too. -- This message was sent by Atlassian JIRA (v6.3.4#6332)