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

baunsgaard 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 b1fb351f59 [MINOR] Lop Properties toString for Debugging
b1fb351f59 is described below

commit b1fb351f59ad8c132efc431f0190681f4fb2cd7b
Author: Sebastian Baunsgaard <[email protected]>
AuthorDate: Fri Jan 5 12:33:22 2024 +0100

    [MINOR] Lop Properties toString for Debugging
---
 src/main/java/org/apache/sysds/lops/Data.java      | 10 ------
 src/main/java/org/apache/sysds/lops/Lop.java       |  6 ++--
 .../java/org/apache/sysds/lops/LopProperties.java  | 37 +++++++++++++++-------
 src/main/java/org/apache/sysds/lops/Unary.java     |  8 +++--
 4 files changed, 33 insertions(+), 28 deletions(-)

diff --git a/src/main/java/org/apache/sysds/lops/Data.java 
b/src/main/java/org/apache/sysds/lops/Data.java
index 93552852f2..a0546904c0 100644
--- a/src/main/java/org/apache/sysds/lops/Data.java
+++ b/src/main/java/org/apache/sysds/lops/Data.java
@@ -127,16 +127,6 @@ public class Data extends Lop
                lps.setProperties ( inputs, ExecType.INVALID);
        }
 
-       /**
-        * Data-Lop-specific method to set the execution type for persistent 
write.
-        * TODO: split lops into MR/CP lop.
-        *
-        * @param et execution type
-        */
-       public void setExecType( ExecType et ) {
-               lps.execType = et;
-       }
-
        /**
         * method to get format type for input, output files.
         * @return file format
diff --git a/src/main/java/org/apache/sysds/lops/Lop.java 
b/src/main/java/org/apache/sysds/lops/Lop.java
index 5f32650e05..b7ae1ffe78 100644
--- a/src/main/java/org/apache/sysds/lops/Lop.java
+++ b/src/main/java/org/apache/sysds/lops/Lop.java
@@ -501,13 +501,13 @@ public abstract class Lop
 
        /**
         * Set the execution type of LOP.
+        * 
         * @param newExecType new execution type
         */
-       public void setExecType(ExecType newExecType){
-               lps.setExecType(newExecType);
+       public void setExecType(ExecType newExecType) {
+               lps.setExecType(newExecType);
        }
 
-
        public boolean isExecSpark () {
                return (lps.getExecType() == ExecType.SPARK);
        }
diff --git a/src/main/java/org/apache/sysds/lops/LopProperties.java 
b/src/main/java/org/apache/sysds/lops/LopProperties.java
index efa3cd2fe2..e2b55d160c 100644
--- a/src/main/java/org/apache/sysds/lops/LopProperties.java
+++ b/src/main/java/org/apache/sysds/lops/LopProperties.java
@@ -24,14 +24,9 @@ import java.util.ArrayList;
 import org.apache.sysds.common.Types.ExecType;
 import org.apache.sysds.runtime.controlprogram.parfor.util.IDSequence;
 
-public class LopProperties 
-{
-       // static variable to assign an unique ID to every lop that is created
-       private static IDSequence UniqueLopID = null;
-       
-       static {
-               UniqueLopID = new IDSequence();
-       }
+public class LopProperties {
+       /** static variable to assign an unique ID to every lop that is created 
*/
+       private static IDSequence UniqueLopID =  new IDSequence();
        
        /** 
         * Execution properties for each lop.
@@ -42,10 +37,13 @@ public class LopProperties
         * isAligner = is this lop mainly used to reorder/sort/align the keys
         *   
         */
-       long ID;
-       int level;
-       ExecType execType;
-       boolean producesIntermediateOutput;
+       protected long ID;
+       /** The level in the dag. Specifying when this instruction can be 
executed. */
+       protected int level;
+       /** The execution type of this lop node, CP, Spark, GPU, Federated, 
etc*/
+       protected ExecType execType;
+       /** If this Lop produce some intermediate that have to be considered in 
the memory estimations */
+       protected boolean producesIntermediateOutput;
        
        public LopProperties() {
                ID = UniqueLopID.getNextID();
@@ -99,4 +97,19 @@ public class LopProperties
                execType = et;
                setLevel(inputs);
        }
+
+       @Override
+       public String toString(){
+               StringBuilder sb = new StringBuilder();
+               sb.append(this.getClass().getSimpleName());
+               sb.append(" ID: ");
+               sb.append(ID);
+               sb.append(" Level: ");
+               sb.append(level);
+               sb.append(" ExecType: ");
+               sb.append(execType);
+               sb.append(" Intermediate: ");
+               sb.append(producesIntermediateOutput);
+               return sb.toString();
+       }
 }
diff --git a/src/main/java/org/apache/sysds/lops/Unary.java 
b/src/main/java/org/apache/sysds/lops/Unary.java
index 5e83c1de4d..e7932695a8 100644
--- a/src/main/java/org/apache/sysds/lops/Unary.java
+++ b/src/main/java/org/apache/sysds/lops/Unary.java
@@ -112,10 +112,12 @@ public class Unary extends Lop
                if (valInput != null)
                        return "Operation: " + operation + " " + "Label: "
                                        + 
valInput.getOutputParameters().getLabel()
-                                       + " input types " + 
this.getInputs().get(0).toString()
-                                       + " " + 
this.getInputs().get(1).toString();
+                                       + " input types " + 
getInput(0).toString()
+                                       + " " + getInput(1).toString();
+               else if(getInput(0) != null)
+                       return "Operation: " + operation + " In: " + 
getInput(0) + " " + lps;
                else
-                       return "Operation: " + operation + " " + "Label: N/A";
+                       return "Operation: " + operation + " Label: N/A";
        }
 
        private String getOpcode() {

Reply via email to