protected boolean hasLargeTotalResults(OptNode pn,ArrayList<String> resultVars,LocalVariableMap vars,boolean checkSize) throws DMLRuntimeException {
  double totalSize=0;
  PTaskPartitioner tp=PTaskPartitioner.valueOf(pn.getParam(ParamType.TASK_PARTITIONER));
  int k=pn.getK();
  long W=estimateNumTasks(tp,_N,k);
  for (  String var : resultVars) {
    Data dat=vars.get(var);
    if (dat != null && dat instanceof MatrixObject) {
      MatrixObject mo=(MatrixObject)vars.get(var);
      long rows=mo.getNumRows();
      long cols=mo.getNumColumns();
      long nnz=mo.getNnz();
      if (nnz > 0) {
        totalSize+=W * OptimizerUtils.estimateSizeExactSparsity(rows,cols,1.0);
      }
 else {
        totalSize+=OptimizerUtils.estimateSizeExactSparsity(rows,cols,1.0);
      }
    }
  }
  return (totalSize >= _lm);
}

protected boolean hasLargeTotalResults ( OptNode pn , ArrayList < String > resultVars , LocalVariableMap vars , boolean checkSize ) throws DMLRuntimeException { double totalSize = 0 ; PTaskPartitioner tp = PTaskPartitioner . valueOf ( pn . getParam ( ParamType . TASK_PARTITIONER ) ) ; int k = pn . getK ( ) ; long W = estimateNumTasks ( tp , _N , k ) ; for ( String var : resultVars ) { Data dat = vars . get ( var ) ; if ( dat != null && dat instanceof MatrixObject ) { MatrixObject mo = ( MatrixObject ) vars . get ( var ) ; long rows = mo . getNumRows ( ) ; long cols = mo . getNumColumns ( ) ; long nnz = mo . getNnz ( ) ; if ( nnz > 0 ) { totalSize += W * OptimizerUtils . estimateSizeExactSparsity ( rows , cols , 1.0 ) ; } else { totalSize += OptimizerUtils . estimateSizeExactSparsity ( rows , cols , 1.0 ) ; } } } return ( totalSize >= _lm ) ; }
heuristically compute total result sizes , if larger than local mem budget assumed to be large .
