use of org.apache.sysml.runtime.instructions.MRJobInstruction in project incubator-systemml by apache.
the class Statistics method getCPHeavyHitterCode.
public static String getCPHeavyHitterCode(Instruction inst) {
String opcode = null;
if (inst instanceof MRJobInstruction) {
MRJobInstruction mrinst = (MRJobInstruction) inst;
opcode = "MR-Job_" + mrinst.getJobType();
} else if (inst instanceof SPInstruction) {
opcode = "SP_" + InstructionUtils.getOpCode(inst.toString());
if (inst instanceof FunctionCallCPInstruction) {
FunctionCallCPInstruction extfunct = (FunctionCallCPInstruction) inst;
opcode = extfunct.getFunctionName();
}
} else // CPInstructions
{
opcode = InstructionUtils.getOpCode(inst.toString());
if (inst instanceof FunctionCallCPInstruction) {
FunctionCallCPInstruction extfunct = (FunctionCallCPInstruction) inst;
opcode = extfunct.getFunctionName();
}
}
return opcode;
}
use of org.apache.sysml.runtime.instructions.MRJobInstruction in project incubator-systemml by apache.
the class ResourceOptimizer method annotateMRJobInstructions.
private static ArrayList<Instruction> annotateMRJobInstructions(ArrayList<Instruction> inst, long cp, long mr) {
// check for empty instruction lists (e.g., predicates)
if (inst == null || !COSTS_MAX_PARALLELISM)
return inst;
try {
for (int i = 0; i < inst.size(); i++) {
Instruction linst = inst.get(i);
if (linst instanceof MRJobInstruction) {
// copy mr job instruction
MRJobResourceInstruction newlinst = new MRJobResourceInstruction((MRJobInstruction) linst);
// compute and annotate
long maxMemPerNode = (long) YarnClusterAnalyzer.getMaxAllocationBytes();
long nNodes = YarnClusterAnalyzer.getNumNodes();
long totalMem = nNodes * maxMemPerNode;
long maxMRTasks = (long) (totalMem - DMLYarnClient.computeMemoryAllocation(cp)) / (long) DMLYarnClient.computeMemoryAllocation(mr);
newlinst.setMaxMRTasks(maxMRTasks);
// write enhanced instruction back
inst.set(i, newlinst);
}
}
} catch (Exception ex) {
throw new DMLRuntimeException(ex);
}
return inst;
}
Aggregations