use of org.apache.sysml.runtime.controlprogram.ParForProgramBlock.PTaskPartitioner in project incubator-systemml by apache.
the class OptimizerRuleBased method hasLargeTotalResults.
/**
* Heuristically compute total result sizes, if larger than local mem budget assumed to be large.
*
* @param pn internal representation of a plan alternative for program blocks and instructions
* @param resultVars list of result variables
* @param vars local variable map
* @param checkSize ?
* @return true if result sizes larger than local memory budget
* @throws DMLRuntimeException if DMLRuntimeException occurs
*/
protected boolean hasLargeTotalResults(OptNode pn, ArrayList<String> resultVars, LocalVariableMap vars, boolean checkSize) throws DMLRuntimeException {
double totalSize = 0;
//get num tasks according to task partitioning
PTaskPartitioner tp = PTaskPartitioner.valueOf(pn.getParam(ParamType.TASK_PARTITIONER));
int k = pn.getK();
long W = estimateNumTasks(tp, _N, k);
for (String var : resultVars) {
//Potential unknowns: for local result var of child parfor (but we're only interested in top level)
//Potential scalars: for disabled dependency analysis and unbounded scoping
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 (//w/ compare
nnz > 0) {
totalSize += W * OptimizerUtils.estimateSizeExactSparsity(rows, cols, 1.0);
} else //in total at most as dimensions (due to disjoint results)
{
totalSize += OptimizerUtils.estimateSizeExactSparsity(rows, cols, 1.0);
}
}
}
//heuristic: large if >= local mem budget
return (totalSize >= _lm);
}
use of org.apache.sysml.runtime.controlprogram.ParForProgramBlock.PTaskPartitioner in project incubator-systemml by apache.
the class OptimizerRuleBased method hasLargeTotalResults.
/**
* Heuristically compute total result sizes, if larger than local mem budget assumed to be large.
*
* @param pn internal representation of a plan alternative for program blocks and instructions
* @param resultVars list of result variables
* @param vars local variable map
* @param checkSize ?
* @return true if result sizes larger than local memory budget
*/
protected boolean hasLargeTotalResults(OptNode pn, ArrayList<ResultVar> resultVars, LocalVariableMap vars, boolean checkSize) {
double totalSize = 0;
// get num tasks according to task partitioning
PTaskPartitioner tp = PTaskPartitioner.valueOf(pn.getParam(ParamType.TASK_PARTITIONER));
int k = pn.getK();
long W = estimateNumTasks(tp, _N, k);
for (ResultVar var : resultVars) {
// Potential unknowns: for local result var of child parfor (but we're only interested in top level)
// Potential scalars: for disabled dependency analysis and unbounded scoping
Data dat = vars.get(var._name);
if (dat != null && dat instanceof MatrixObject) {
MatrixObject mo = (MatrixObject) dat;
long rows = mo.getNumRows();
long cols = mo.getNumColumns();
long nnz = mo.getNnz();
if (// w/ compare
nnz > 0) {
totalSize += W * OptimizerUtils.estimateSizeExactSparsity(rows, cols, 1.0);
} else // in total at most as dimensions (due to disjoint results)
{
totalSize += OptimizerUtils.estimateSizeExactSparsity(rows, cols, 1.0);
}
}
}
// heuristic: large if >= local mem budget
return (totalSize >= _lm);
}
use of org.apache.sysml.runtime.controlprogram.ParForProgramBlock.PTaskPartitioner in project systemml by apache.
the class OptimizerRuleBased method hasLargeTotalResults.
/**
* Heuristically compute total result sizes, if larger than local mem budget assumed to be large.
*
* @param pn internal representation of a plan alternative for program blocks and instructions
* @param resultVars list of result variables
* @param vars local variable map
* @param checkSize ?
* @return true if result sizes larger than local memory budget
*/
protected boolean hasLargeTotalResults(OptNode pn, ArrayList<ResultVar> resultVars, LocalVariableMap vars, boolean checkSize) {
double totalSize = 0;
// get num tasks according to task partitioning
PTaskPartitioner tp = PTaskPartitioner.valueOf(pn.getParam(ParamType.TASK_PARTITIONER));
int k = pn.getK();
long W = estimateNumTasks(tp, _N, k);
for (ResultVar var : resultVars) {
// Potential unknowns: for local result var of child parfor (but we're only interested in top level)
// Potential scalars: for disabled dependency analysis and unbounded scoping
Data dat = vars.get(var._name);
if (dat != null && dat instanceof MatrixObject) {
MatrixObject mo = (MatrixObject) dat;
long rows = mo.getNumRows();
long cols = mo.getNumColumns();
long nnz = mo.getNnz();
if (// w/ compare
nnz > 0) {
totalSize += W * OptimizerUtils.estimateSizeExactSparsity(rows, cols, 1.0);
} else // in total at most as dimensions (due to disjoint results)
{
totalSize += OptimizerUtils.estimateSizeExactSparsity(rows, cols, 1.0);
}
}
}
// heuristic: large if >= local mem budget
return (totalSize >= _lm);
}
Aggregations