sebwrede commented on a change in pull request #1395:
URL: https://github.com/apache/systemds/pull/1395#discussion_r723250338



##########
File path: src/main/java/org/apache/sysds/hops/cost/FederatedCostEstimator.java
##########
@@ -196,6 +194,90 @@ private FederatedCost costEstimate(Hop root){
                }
        }
 
+       /**
+        * Return cost estimate in bytes of Hop DAG starting from given root 
HopRel.
+        * @param root HopRel of Hop DAG for which cost is estimated
+        * @param hopRelMemo memo table of HopRels for calculating input costs
+        * @return cost estimation of Hop DAG starting from given root HopRel
+        */
+       public FederatedCost costEstimate(HopRel root, Map<Long, List<HopRel>> 
hopRelMemo){
+               // Check if root is in memo table.
+               if ( hopRelMemo.containsKey(root.hopRef.getHopID())
+                       && 
hopRelMemo.get(root.hopRef.getHopID()).stream().anyMatch(h -> h.fedOut == 
root.fedOut) ){
+                       return root.getCostObject();
+               }
+               else {
+                       // If no input has FOUT, the root will be processed by 
the coordinator
+                       boolean hasFederatedInput = 
root.inputDependency.stream().anyMatch(in -> in.hopRef.hasFederatedOutput());
+                       //the input cost is included the first time the input 
hop is used
+                       //for additional usage, the additional cost is zero 
(disregarding potential read cost)

Review comment:
       I will add the space, but I can also tell you that the code formatter 
does not add a space before `//`. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@systemds.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to