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

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


The following commit(s) were added to refs/heads/main by this push:
     new 6c530e3957 [SYSTEMDS-3341] Add debug prints and bug fixes in UMM
6c530e3957 is described below

commit 6c530e39576e9d34e05fca7c0330142f5d6545a4
Author: Arnab Phani <[email protected]>
AuthorDate: Thu Jun 23 13:48:34 2022 +0200

    [SYSTEMDS-3341] Add debug prints and bug fixes in UMM
---
 .../caching/UnifiedMemoryManager.java              | 30 ++++++++++++++++++++++
 .../instructions/cp/ReshapeCPInstruction.java      |  2 +-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/sysds/runtime/controlprogram/caching/UnifiedMemoryManager.java
 
b/src/main/java/org/apache/sysds/runtime/controlprogram/caching/UnifiedMemoryManager.java
index e4b7761307..5bd48bd44c 100644
--- 
a/src/main/java/org/apache/sysds/runtime/controlprogram/caching/UnifiedMemoryManager.java
+++ 
b/src/main/java/org/apache/sysds/runtime/controlprogram/caching/UnifiedMemoryManager.java
@@ -203,6 +203,36 @@ public class UnifiedMemoryManager
                _pinnedVirtualMemSize = 0;
        }
 
+       /**
+        * Print current status of UMM, including all entries.
+        * NOTE: use only for debugging or testing.
+        */
+       public static void printStatus(String operation)
+       {
+               System.out.println("UMM STATUS AT "+operation+" --"); //before 
pin, after unpin, at makespace
+
+               synchronized (_mQueue) {
+                       // print UMM meta data
+                       System.out.println("\tUMM: Meta Data: " +
+                               "UMM limit="+_limit+", " +
+                               "size[bytes]="+_totCachedSize+", " +
+                               "size[elements]="+_mQueue.size()+", " +
+                               "pinned[elements]="+_pinnedEntries.size()+", " +
+                               "pinned[bytes]="+_pinnedPhysicalMemSize);
+
+                       // print current cached entries
+                       int count = _mQueue.size();
+                       for (Map.Entry<String, ByteBuffer> entry : 
_mQueue.entrySet()) {
+                               String fname = entry.getKey();
+                               ByteBuffer bbuff = entry.getValue();
+                               System.out.println("\tUMM: Cached element 
("+count+"): "
+                                       +fname+", 
"+(bbuff.isShallow()?bbuff._cdata.getClass().getSimpleName():"?")
+                                       +", "+bbuff.getSize()+", 
"+bbuff.isShallow());
+                               count--;
+                       }
+               }
+       }
+
        public static void setUMMLimit(long val) {
                _limit = val;
        }
diff --git 
a/src/main/java/org/apache/sysds/runtime/instructions/cp/ReshapeCPInstruction.java
 
b/src/main/java/org/apache/sysds/runtime/instructions/cp/ReshapeCPInstruction.java
index 8a3c001a47..f3fa3fb552 100644
--- 
a/src/main/java/org/apache/sysds/runtime/instructions/cp/ReshapeCPInstruction.java
+++ 
b/src/main/java/org/apache/sysds/runtime/instructions/cp/ReshapeCPInstruction.java
@@ -103,8 +103,8 @@ public class ReshapeCPInstruction extends 
UnaryCPInstruction {
                        LibMatrixReorg.reshape(in, out, rows, cols, 
byRow.getBooleanValue());
 
                        //set output and release inputs
-                       ec.setMatrixOutput(output.getName(), out);
                        ec.releaseMatrixInput(input1.getName());
+                       ec.setMatrixOutput(output.getName(), out);
                }
        }
        

Reply via email to