You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by de...@apache.org on 2016/12/19 18:56:01 UTC

incubator-systemml git commit: [HOTFIX] Add missing getSparseMatrixOutputForGPUInstruction method

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 <na...@gmail.com>
Authored: Mon Dec 19 10:50:02 2016 -0800
Committer: Deron Eriksson <de...@us.ibm.com>
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