Repository: incubator-systemml
Updated Branches:
  refs/heads/master 3caae2718 -> 1c4e9de4e


[HOTFIX] Add missing getSparseMatrixOutputForGPUInstruction method

Closes #321.


Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/1c4e9de4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/1c4e9de4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/1c4e9de4

Branch: refs/heads/master
Commit: 1c4e9de4e9df8c0cc97caca0c83b6c38b26c54bf
Parents: 3caae27
Author: Nakul Jindal <[email protected]>
Authored: Mon Dec 19 10:50:02 2016 -0800
Committer: Deron Eriksson <[email protected]>
Committed: Mon Dec 19 10:50:02 2016 -0800

----------------------------------------------------------------------
 .../controlprogram/context/ExecutionContext.java  | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/1c4e9de4/src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContext.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContext.java
 
b/src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContext.java
index 325fa03..d6f4e6c 100644
--- 
a/src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContext.java
+++ 
b/src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContext.java
@@ -236,6 +236,24 @@ public class ExecutionContext
                return mo;
        }
 
+    /**
+     * Allocates a sparse matrix in CSR format on the GPU.
+     * Assumes that mat.getNumRows() returns a valid number
+     * 
+     * @param varName variable name
+     * @param nnz number of non zeroes
+     * @return matrix object
+     * @throws DMLRuntimeException if DMLRuntimeException occurs
+     */
+    public MatrixObject getSparseMatrixOutputForGPUInstruction(String varName, 
long nnz)
+        throws DMLRuntimeException
+    {
+        MatrixObject mo = allocateGPUMatrixObject(varName);
+        mo.getMatrixCharacteristics().setNonZeros(nnz);
+        mo.getGPUObject().acquireDeviceModifySparse();
+        return mo;
+    } 
+
        /**
         * Allocates the {@link GPUObject} for a given LOPS Variable (eg. 
_mVar3)
         * @param varName variable name

Reply via email to