You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemds.apache.org by mb...@apache.org on 2022/08/07 13:53:50 UTC

[systemds] 01/02: [MINOR] Mark additional unary ops for multi-threaded operations

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

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

commit 89720cc90aab994ac2ff11d213a324b22d2b1498
Author: Matthias Boehm <mb...@gmail.com>
AuthorDate: Sun Aug 7 15:22:38 2022 +0200

    [MINOR] Mark additional unary ops for multi-threaded operations
    
    This patch adds a few missing operations so the compiler generates
    multi-threaded unary operations. On 10M x 1K (80GB) round operations
    this improved local performance substantially by more than 50s.
---
 src/main/java/org/apache/sysds/hops/UnaryOp.java | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/sysds/hops/UnaryOp.java b/src/main/java/org/apache/sysds/hops/UnaryOp.java
index 38a20fffc0..430c181552 100644
--- a/src/main/java/org/apache/sysds/hops/UnaryOp.java
+++ b/src/main/java/org/apache/sysds/hops/UnaryOp.java
@@ -173,8 +173,8 @@ public class UnaryOp extends MultiThreadedHop
 							final boolean inplace = OptimizerUtils.ALLOW_UNARY_UPDATE_IN_PLACE &&
 								input.getParent().size() == 1 && (!(input instanceof DataOp) || !((DataOp) input).isRead());
 
-							k = isCumulativeUnaryOperation() || isExpensiveUnaryOperation() ? OptimizerUtils
-								.getConstrainedNumThreads(_maxNumThreads) : 1;
+							k = isCumulativeUnaryOperation() || isExpensiveUnaryOperation() ?
+								OptimizerUtils.getConstrainedNumThreads(_maxNumThreads) : 1;
 							ret = new Unary(input.constructLops(), _op, getDataType(), getValueType(), et, k, inplace);
 						}
 					}
@@ -450,14 +450,13 @@ public class UnaryOp extends MultiThreadedHop
 			|| _op == OpOp1.CAST_AS_INT);
 	}
 	
-	public boolean isExpensiveUnaryOperation()  {
-		return (_op == OpOp1.EXP 
-			|| _op == OpOp1.LOG
-			|| _op == OpOp1.SIGMOID
-			|| _op == OpOp1.COMPRESS
-			|| _op == OpOp1.DECOMPRESS
-			|| _op == OpOp1.MEDIAN
-			|| _op == OpOp1.IQM);
+	public boolean isExpensiveUnaryOperation() {
+		return (_op == OpOp1.EXP || _op == OpOp1.LOG
+			|| _op == OpOp1.ROUND || _op == OpOp1.FLOOR || _op == OpOp1.CEIL
+			|| _op == OpOp1.SIGMOID || _op == OpOp1.SPROP || _op == OpOp1.SOFTMAX
+			|| _op == OpOp1.TAN || _op == OpOp1.TANH || _op == OpOp1.ATAN
+			|| _op == OpOp1.COMPRESS || _op == OpOp1.DECOMPRESS
+			|| _op == OpOp1.MEDIAN || _op == OpOp1.IQM);
 	}
 	
 	public boolean isMetadataOperation() {