You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by ni...@apache.org on 2018/10/11 20:55:02 UTC

systemml git commit: [MINOR] Provide an useful error message when copying a large dense block to device memory

Repository: systemml
Updated Branches:
  refs/heads/master 97fd7d1aa -> 11c67055a


[MINOR] Provide an useful error message when copying a large dense block
to device memory

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

Branch: refs/heads/master
Commit: 11c67055accecf8582de0ca6dc62d0e3952e2804
Parents: 97fd7d1
Author: Niketan Pansare <np...@us.ibm.com>
Authored: Thu Oct 11 13:52:36 2018 -0700
Committer: Niketan Pansare <np...@us.ibm.com>
Committed: Thu Oct 11 13:52:36 2018 -0700

----------------------------------------------------------------------
 .../sysml/runtime/instructions/gpu/context/GPUObject.java       | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/11c67055/src/main/java/org/apache/sysml/runtime/instructions/gpu/context/GPUObject.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/context/GPUObject.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/context/GPUObject.java
index 6d7d73b..b95d471 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/context/GPUObject.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/context/GPUObject.java
@@ -889,6 +889,10 @@ public class GPUObject {
 					GPUStatistics.maintainCPMiscTimes(opcode, GPUInstruction.MISC_TIMER_HOST_TO_DEVICE, System.nanoTime() - t1);
 			}
 		} else {
+			if(((long)tmp.getNumRows())*((long)tmp.getNumColumns()) > Integer.MAX_VALUE) {
+				throw new DMLRuntimeException("Cannot allocate a dense double array on the GPU for a matrix with "
+						+ "dimensions [" + tmp.getNumRows() + "," + tmp.getNumColumns() + "]");  
+			}
 			double[] data = tmp.getDenseBlockValues();
 
 			if (data == null && tmp.getSparseBlock() != null)
@@ -982,6 +986,7 @@ public class GPUObject {
 		if (!isDensePointerNull()) {
 			tmp = new MatrixBlock(toIntExact(mat.getNumRows()), toIntExact(mat.getNumColumns()), false);
 			tmp.allocateDenseBlock();
+			// No need to double-check if tmp.getDenseBlockValues() is valid here. 
 			LibMatrixCUDA.cudaSupportFunctions.deviceToHost(getGPUContext(),
 						getDensePointer(), tmp.getDenseBlockValues(), instName, isEviction);
 			if(eagerDelete)