Repository: systemml
Updated Branches:
  refs/heads/master 7019f3bc8 -> 9a1f64b42


[SYSTEMML-2506] Improved cumagg compilation (intermediate memory)

This patch improves the compilation of cumulative aggregate operations,
to correctly account for potential dense-sparse conversions when
computing memory estimates.


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

Branch: refs/heads/master
Commit: b96807b907203ce8ef1bbd017d06f3c6c9ef8fec
Parents: 7019f3b
Author: Matthias Boehm <mboe...@gmail.com>
Authored: Tue Dec 11 16:58:27 2018 +0100
Committer: Matthias Boehm <mboe...@gmail.com>
Committed: Tue Dec 11 16:58:27 2018 +0100

----------------------------------------------------------------------
 src/main/java/org/apache/sysml/hops/UnaryOp.java | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/b96807b9/src/main/java/org/apache/sysml/hops/UnaryOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/UnaryOp.java 
b/src/main/java/org/apache/sysml/hops/UnaryOp.java
index 4071d6f..2952e85 100644
--- a/src/main/java/org/apache/sysml/hops/UnaryOp.java
+++ b/src/main/java/org/apache/sysml/hops/UnaryOp.java
@@ -42,6 +42,8 @@ import org.apache.sysml.lops.UnaryCP;
 import org.apache.sysml.parser.Expression.DataType;
 import org.apache.sysml.parser.Expression.ValueType;
 import org.apache.sysml.runtime.matrix.MatrixCharacteristics;
+import org.apache.sysml.runtime.matrix.data.MatrixBlock;
+import org.apache.sysml.runtime.util.UtilFunctions;
 
 
 /* Unary (cell operations): e.g, b_ij = round(a_ij)
@@ -562,15 +564,20 @@ public class UnaryOp extends MultiThreadedHop
        }
        
        @Override
-       protected double computeIntermediateMemEstimate( long dim1, long dim2, 
long nnz )
+       protected double computeIntermediateMemEstimate(long dim1, long dim2, 
long nnz)
        {
                double ret = 0;
                
-               if ( _op == OpOp1.IQM || _op == OpOp1.MEDIAN) {
+               if( _op == OpOp1.IQM || _op == OpOp1.MEDIAN ) {
                        // buffer (=2*input_size) and output (=input_size) for 
SORT operation
                        // getMemEstimate works for both cases of known dims 
and worst-case stats
                        ret = getInput().get(0).getMemEstimate() * 3; 
                }
+               else if( isCumulativeUnaryOperation() ) {
+                       //account for potential final dense-sparse 
transformation (worst-case sparse representation)
+                       ret += MatrixBlock.estimateSizeSparseInMemory(dim1, 
dim2,
+                               MatrixBlock.SPARSITY_TURN_POINT - 
UtilFunctions.DOUBLE_EPS);
+               }
 
                if (isGPUEnabled()) {
                        // Intermediate memory required to convert sparse to 
dense

Reply via email to