You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemds.apache.org by ma...@apache.org on 2021/02/25 13:39:05 UTC

[systemds] branch master updated: [MINOR] Correcting a logic error while deciding to avoid execution on empty input in SpoofCUDACellwise

This is an automated email from the ASF dual-hosted git repository.

markd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/master by this push:
     new 3315eb6  [MINOR] Correcting a logic error while deciding to avoid execution on empty input in SpoofCUDACellwise
3315eb6 is described below

commit 3315eb62ab593f4526f307a6037a8d80109559db
Author: Mark Dokter <ma...@dokter.cc>
AuthorDate: Thu Feb 25 13:00:42 2021 +0100

    [MINOR] Correcting a logic error while deciding to avoid execution on empty input in SpoofCUDACellwise
---
 .../org/apache/sysds/runtime/codegen/SpoofCUDACellwise.java   | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/sysds/runtime/codegen/SpoofCUDACellwise.java b/src/main/java/org/apache/sysds/runtime/codegen/SpoofCUDACellwise.java
index 6963c2d..4ea153c 100644
--- a/src/main/java/org/apache/sysds/runtime/codegen/SpoofCUDACellwise.java
+++ b/src/main/java/org/apache/sysds/runtime/codegen/SpoofCUDACellwise.java
@@ -64,7 +64,6 @@ public class SpoofCUDACellwise extends SpoofCellwise implements SpoofCUDAOperato
 			LOG.error("SpoofCUDA " + getSpoofType() + " operator failed to execute. Trying Java fallback.\n");
 			// ToDo: java fallback
 		}
-		
 		LibMatrixCUDA.cudaSupportFunctions.deviceToHost(ec.getGPUContext(0), ptr, result, getName(), false);
 		
 		return new DoubleObject(result[0]);
@@ -110,7 +109,7 @@ public class SpoofCUDACellwise extends SpoofCellwise implements SpoofCUDAOperato
 		
 //		ec.setMetaData(outputName, out_rows, out_cols);
 		GPUObject g = a.getGPUObject(gctx);
-		boolean sparseOut = _type == CellType.NO_AGG && sparseSafe && g.isSparse();;
+		boolean sparseOut = _type == CellType.NO_AGG && sparseSafe && g.isSparse();
 		
 		long nnz = g.getNnz("spoofCUDA" + getSpoofType(), false);
 		if(sparseOut)
@@ -119,9 +118,9 @@ public class SpoofCUDACellwise extends SpoofCellwise implements SpoofCUDAOperato
 				(ec.getSparseMatrixOutputForGPUInstruction(outputName, out_rows, out_cols, (isSparseSafe() && nnz > 0) ?
 						nnz : out_rows * out_cols).getKey()) :
 				(ec.getDenseMatrixOutputForGPUInstruction(outputName, out_rows, out_cols).getKey());
-
+		
 		int offset = 1;
-		if(!(inputIsEmpty(a.getGPUObject(gctx)) && sparseSafe )) {
+		if(!inputIsEmpty(a.getGPUObject(gctx)) || !sparseSafe) {
 			if(call.exec(ec, this, ID, prepareInputPointers(ec, inputs, offset), prepareSideInputPointers(ec, inputs, offset, false),
 				prepareOutputPointers(ec, out_obj, sparseOut), scalarObjects, 0) != 0) {
 				LOG.error("SpoofCUDA " + getSpoofType() + " operator failed to execute. Trying Java fallback.(ToDo)\n");
@@ -132,9 +131,7 @@ public class SpoofCUDACellwise extends SpoofCellwise implements SpoofCUDAOperato
 	}
 	
 	private boolean inputIsEmpty(GPUObject g) {
-		if(g.getDensePointer() != null || g.getSparseMatrixCudaPointer() != null)
-			return true;
-		return false;
+		return g.getDensePointer() == null && g.getSparseMatrixCudaPointer() == null;
 	}
 	
 	// used to determine sparse safety