Skip to content

Commit

Permalink
- don't calculate level in getCriticalPaths
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@21637 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Volker Waurich committed Jul 28, 2014
1 parent bc51f02 commit ffa477f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
6 changes: 3 additions & 3 deletions Compiler/BackEnd/HpcOmScheduler.mo
Expand Up @@ -1110,7 +1110,7 @@ algorithm
print("level: \n"+&stringDelimitList(List.map(level,intListString),"\n")+&"\n");

// get critical path and merge the criPathNodes to target size tasks
(_,(critPathNodes::_,_),_) := HpcOmTaskGraph.getCriticalPaths(iGraph,iMeta); // without communication costs
(_,(critPathNodes::_,_)) := HpcOmTaskGraph.getCriticalPaths(iGraph,iMeta); // without communication costs
critPathCosts := List.map1(critPathNodes,HpcOmTaskGraph.getExeCostReqCycles,iMeta);
print("critPathNodes: \n"+&stringDelimitList(List.map(critPathNodes,intString)," \n ")+&"\n");

Expand Down Expand Up @@ -4070,7 +4070,7 @@ algorithm
case(HpcOmSimCode.LEVELSCHEDULE(tasksOfLevels=levels),_,_,_)
equation
//get the criticalPath
((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC),_) = HpcOmTaskGraph.getCriticalPaths(taskGraphIn,taskGraphMetaIn);
((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC)) = HpcOmTaskGraph.getCriticalPaths(taskGraphIn,taskGraphMetaIn);
// predict speedUp
levelSectionCosts = List.map1(levels, getLevelListTaskCosts, taskGraphMetaIn);
serTime = realSum(List.map(levelSectionCosts,realSum));
Expand All @@ -4088,7 +4088,7 @@ algorithm
equation
Debug.fcall(Flags.HPCOM_DUMP,print,"the number of locks: "+&intString(listLength(lockIdc))+&"\n");
//get the criticalPath
((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC),_) = HpcOmTaskGraph.getCriticalPaths(taskGraphIn,taskGraphMetaIn);
((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC)) = HpcOmTaskGraph.getCriticalPaths(taskGraphIn,taskGraphMetaIn);
criticalPathInfo = HpcOmTaskGraph.dumpCriticalPathInfo((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC));
//predict speedup etc.
(serTime,parTime,speedUp,speedUpMax) = predictExecutionTime(scheduleIn,SOME(cpCostsWoC),numProcIn,taskGraphIn,taskGraphMetaIn);
Expand Down
15 changes: 12 additions & 3 deletions Compiler/BackEnd/HpcOmSimCodeMain.mo
Expand Up @@ -182,7 +182,7 @@ algorithm
(initDAE, _, _) = Initialization.solveInitialSystem(inBackendDAE);
removedInitialEquations = {};
createAndExportInitialSystemTaskGraph(initDAE, filenamePrefix);

//Setup
//-----
System.realtimeTick(GlobalScript.RT_CLOCK_EXECSTAT_HPCOM_MODULES);
Expand All @@ -192,6 +192,7 @@ algorithm
parameterEquations, removedEquations, algorithmAndEquationAsserts, zeroCrossingsEquations, jacobianEquations, stateSets, constraints, classAttributes, zeroCrossings, relations, timeEvents, whenClauses,
discreteModelVars, extObjInfo, makefileParams, delayedExps, jacobianMatrixes, simulationSettingsOpt, fileNamePrefix, _, _, _, crefToSimVarHT, backendMapping) = simCode;


//get SCC to simEqSys-mappping
//----------------------------
(allComps,_) = HpcOmTaskGraph.getSystemComponents(inBackendDAE);
Expand All @@ -208,11 +209,13 @@ algorithm
//dumpSimEqSCCMapping(simeqCompMapping);
//dumpSccSimEqMapping(sccSimEqMapping);


//Create TaskGraph for all strongly connected components
//------------------------------------------------------
(taskGraph,taskGraphData) = HpcOmTaskGraph.createTaskGraph(inBackendDAE,filenamePrefix);
SimCodeUtil.execStat("hpcom createTaskGraph");


//Create Costs
//------------
taskGraphData = HpcOmTaskGraph.createCosts(inBackendDAE, filenamePrefix +& "_eqs_prof" , simeqCompMapping, taskGraphData);
Expand All @@ -227,6 +230,7 @@ algorithm
//HpcOmTaskGraph.printTaskGraph(taskGraph);
//HpcOmTaskGraph.printTaskGraphMeta(taskGraphData);


//Get complete DAE System
//-----------------------
taskGraphDAE = arrayCopy(taskGraph);
Expand All @@ -243,6 +247,7 @@ algorithm
//HpcOmTaskGraph.printTaskGraph(taskGraphDAE);
//HpcOmTaskGraph.printTaskGraphMeta(taskGraphDataDAE);


//Get Event System
//----------------
taskGraphEvent = arrayCopy(taskGraph);
Expand All @@ -257,6 +262,7 @@ algorithm
HpcOmSimCode.TASKDEPSCHEDULE(tasks=eventSystemTasks) = HpcOmScheduler.createTaskDepSchedule(taskGraphEvent, taskGraphDataEvent, sccSimEqMapping);
eventSystemTaskList = List.map(eventSystemTasks, Util.tuple21);


//Get ODE System
//--------------
taskGraphOde = arrayCopy(taskGraph);
Expand All @@ -272,9 +278,10 @@ algorithm
//HpcOmTaskGraph.printTaskGraph(taskGraphOde);
//HpcOmTaskGraph.printTaskGraphMeta(taskGraphDataOde);

//Assign levels and get critcal path

//Get critical path
//----------------------------------
((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC),_) = HpcOmTaskGraph.getCriticalPaths(taskGraphOde,taskGraphDataOde);
((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC)) = HpcOmTaskGraph.getCriticalPaths(taskGraphOde,taskGraphDataOde);
criticalPathInfo = HpcOmTaskGraph.dumpCriticalPathInfo((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC));
((graphOps,graphCosts)) = HpcOmTaskGraph.sumUpExeCosts(taskGraphOde,taskGraphDataOde);
graphCosts = HpcOmTaskGraph.roundReal(graphCosts,2);
Expand All @@ -285,11 +292,13 @@ algorithm
HpcOmTaskGraph.dumpAsGraphMLSccLevel(taskGraphOde, taskGraphDataOde,inBackendDAE, fileName, criticalPathInfo, HpcOmTaskGraph.convertNodeListToEdgeTuples(List.first(criticalPaths)), HpcOmTaskGraph.convertNodeListToEdgeTuples(List.first(criticalPathsWoC)), sccSimEqMapping, schedulerInfo);
SimCodeUtil.execStat("hpcom dump ODE TaskGraph");


// Analyse Systems of Equations
//-----------------------------
(scheduledTasks,scheduledDAENodes) = HpcOmEqSystems.parallelizeTornSystems(taskGraphOde,taskGraphDataOde,sccSimEqMapping,inBackendDAE);
//HpcOmScheduler.printTaskList(scheduledTasks);


//Apply filters
//-------------
taskGraphDataSimplified = taskGraphDataOde;
Expand Down
18 changes: 6 additions & 12 deletions Compiler/BackEnd/HpcOmTaskGraph.mo
Expand Up @@ -4060,7 +4060,6 @@ public function createCosts "author: marcusw
input array<Integer> simeqCompMapping; //Map each simEq to the scc
input TaskGraphMeta iTaskGraphMeta;
output TaskGraphMeta oTaskGraphMeta;

protected
array<BackendDAE.EqSystem> compMapping;
array<tuple<BackendDAE.EqSystem,Integer>> compMapping_withIdx;
Expand All @@ -4074,7 +4073,6 @@ protected
array<Real> reqTimeOp; //Calculation time for each scc
array<list<Integer>> inComps;
array<list<tuple<Integer, Integer, Integer>>> commCosts;

algorithm
oTaskGraphMeta := matchcontinue(iDae,benchFilePrefix,simeqCompMapping,iTaskGraphMeta)
case(BackendDAE.DAE(shared=shared),_,_,TASKGRAPHMETA(inComps=inComps, commCosts=commCosts))
Expand Down Expand Up @@ -4756,12 +4754,11 @@ author: Waurich TUD 2013-07"
input TaskGraphMeta graphDataIn;
output tuple<list<list<Integer>>,Real> criticalPathOut; //criticalPath with communication costs <%paths, opCost%>
output tuple<list<list<Integer>>,Real> criticalPathOutWoC; //criticalPath without communication costs <%paths, opCost%>
output list<list<Integer>> parallelSetsOut;
algorithm
(criticalPathOut,criticalPathOutWoC,parallelSetsOut) := matchcontinue(graphIn,graphDataIn)
(criticalPathOut,criticalPathOutWoC) := matchcontinue(graphIn,graphDataIn)
local
TaskGraph graphT;
list<Integer> rootNodes,rootMarks;
list<Integer> rootNodes;
list<list<Integer>> cpWCpaths,CpWoCpaths, level;
Real cpWCcosts,cpWoCcosts;
array<Integer> nodeMark;
Expand All @@ -4770,26 +4767,23 @@ algorithm
true = arrayLength(graphIn) <> 0;
graphT = BackendDAEUtil.transposeMatrix(graphIn,arrayLength(graphIn));
(_,rootNodes) = List.filterOnTrueSync(arrayList(graphT),List.isEmpty,List.intRange(arrayLength(graphT)));
rootMarks = List.map1(rootNodes,Util.arrayGetIndexFirst,nodeMark);
(_,rootNodes) = List.filter1OnTrueSync(rootMarks,intNe,-2,rootNodes); // dont consider assert nodes
level = HpcOmScheduler.getGraphLevel(graphIn,{rootNodes});
(cpWCpaths,cpWCcosts) = getCriticalPath(graphIn,graphDataIn,rootNodes,true);

(cpWCpaths,cpWCcosts) = getCriticalPath(graphIn,graphDataIn,rootNodes,true);
(CpWoCpaths,cpWoCcosts) = getCriticalPath(graphIn,graphDataIn,rootNodes,false);
cpWCcosts = roundReal(cpWCcosts,2);
cpWoCcosts = roundReal(cpWoCcosts,2);
then
((cpWCpaths,cpWCcosts),(CpWoCpaths,cpWoCcosts),level);
((cpWCpaths,cpWCcosts),(CpWoCpaths,cpWoCcosts));
case(_,_)
equation
true = arrayLength(graphIn) == 0;
then
(({{}},0.0),({{}},0.0),{});
(({{}},0.0),({{}},0.0));
else
equation
print("getCriticalPaths failed!\n");
then
(({{}},0.0),({{}},0.0),{});
(({{}},0.0),({{}},0.0));
end matchcontinue;
end getCriticalPaths;

Expand Down

0 comments on commit ffa477f

Please sign in to comment.