Skip to content

Commit

Permalink
- the hpcom runtime is now using the *_eqs_prof.xml instead of the *_…
Browse files Browse the repository at this point in the history
…prof.xml - file as input

- some benchmarks were added to the hpcom-testsuite

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17915 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Marcus Walther committed Oct 28, 2013
1 parent 628d802 commit a7c18fe
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 14 deletions.
5 changes: 3 additions & 2 deletions Compiler/BackEnd/HpcOmScheduler.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ algorithm
end createExtSchedule;

protected function createExtSchedule1
input list<Task> iNodeList; //the sorted nodes -> this method will pick the first task
input list<Task> iNodeList; //the sorted nodes -> this method will pick the first task
input array<Integer> iThreadAssignments; //assignment taskIdx -> threadIdx
input HpcOmTaskGraph.TaskGraph iTaskGraph;
input HpcOmTaskGraph.TaskGraph iTaskGraphT;
Expand Down Expand Up @@ -1376,7 +1376,8 @@ algorithm
case({},_,_,_,_,_,_,_) then iSchedule;
else
equation
print("HpcOmScheduler.createExtSchedule1 failed\n");
print("HpcOmScheduler.createExtSchedule1 failed. Tasks in List:\n");
printTaskList(iNodeList);
then fail();
end matchcontinue;
end createExtSchedule1;
Expand Down
19 changes: 12 additions & 7 deletions Compiler/BackEnd/HpcOmSimCode.mo
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ algorithm
HpcOmScheduler.Schedule schedule;
HpcOmScheduler.ScheduleSimCode taskScheduleSimCode;

Integer graphOps;
Real graphCosts;

case (_, _, _, _, _, _, _, _, _, _, _, _) equation
uniqueEqIndex = 1;

Expand Down Expand Up @@ -196,7 +199,7 @@ algorithm

//Create Costs
//------------
taskGraphData = HpcOmTaskGraph.createCosts(inBackendDAE, filenamePrefix +& "_prof.xml" , simEqSccMapping, taskGraphData);
taskGraphData = HpcOmTaskGraph.createCosts(inBackendDAE, filenamePrefix +& "_eqs_prof.xml" , simEqSccMapping, taskGraphData);
Debug.execStat("hpcom create costs", GlobalScript.RT_CLOCK_EXECSTAT_HPCOM_MODULES);

//Get ODE System
Expand All @@ -217,6 +220,8 @@ algorithm
//----------------------------------
((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC),parallelSets) = HpcOmTaskGraph.longestPathMethod(taskGraphOde,taskGraphDataOde);
criticalPathInfo = HpcOmTaskGraph.dumpCriticalPathInfo((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC));
((graphOps,graphCosts)) = HpcOmTaskGraph.sumUpExecCosts(taskGraphDataOde);
criticalPathInfo = criticalPathInfo +& " sum: (" +& realString(graphCosts) +& " ; " +& intString(graphOps) +& ")";
fileName = ("taskGraph"+&filenamePrefix+&"ODE.graphml");
schedulerInfo = arrayCreate(arrayLength(taskGraphOde), (-1,-1));
HpcOmTaskGraph.dumpAsGraphMLSccLevel(taskGraphOde, taskGraphDataOde, fileName, criticalPathInfo, HpcOmTaskGraph.convertNodeListToEdgeTuples(List.first(criticalPaths)), HpcOmTaskGraph.convertNodeListToEdgeTuples(List.first(criticalPathsWoC)), sccSimEqMapping, schedulerInfo);
Expand All @@ -234,12 +239,12 @@ algorithm

fileName = ("taskGraph"+&filenamePrefix+&"ODE_schedule.graphml");
schedulerInfo = HpcOmScheduler.convertScheduleStrucToInfo(schedule,arrayLength(taskGraph));
// That's failing
//((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC),parallelSets) = HpcOmTaskGraph.longestPathMethod(taskGraph1,taskGraphData1);
//criticalPathInfo = HpcOmTaskGraph.dumpCriticalPathInfo((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC));
criticalPathInfo = "";
criticalPaths = {{}};
criticalPathsWoC = {{}};

((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC),parallelSets) = HpcOmTaskGraph.longestPathMethod(taskGraph1,taskGraphData1);
criticalPathInfo = HpcOmTaskGraph.dumpCriticalPathInfo((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC));
//criticalPathInfo = "";
//criticalPaths = {{}};
//criticalPathsWoC = {{}};
HpcOmTaskGraph.dumpAsGraphMLSccLevel(taskGraph1, taskGraphData1, fileName, criticalPathInfo, HpcOmTaskGraph.convertNodeListToEdgeTuples(List.first(criticalPaths)), HpcOmTaskGraph.convertNodeListToEdgeTuples(List.first(criticalPathsWoC)), sccSimEqMapping, schedulerInfo);
//HpcOmScheduler.printSchedule(taskSchedule);

Expand Down
33 changes: 32 additions & 1 deletion Compiler/BackEnd/HpcOmTaskGraph.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3809,7 +3809,7 @@ algorithm
else
equation
tmpTaskGraphMeta = estimateCosts(iDae,iTaskGraphMeta);
print("Warning: The costs have been estimated. Maybe the _prof.xml-file is missing.\n");
print("Warning: The costs have been estimated. Maybe " +& benchFileName +& "-file is missing.\n");
then tmpTaskGraphMeta;
end matchcontinue;
end createCosts;
Expand Down Expand Up @@ -5572,6 +5572,37 @@ algorithm
end matchcontinue;
end getHighestCommCost;

public function sumUpExecCosts
input TaskGraphMeta iMeta;
output tuple<Integer,Real> execCosts;
protected
tuple<Integer,Real> costs;
array<tuple<Integer,Real>> exeCosts;
algorithm
execCosts := match(iMeta)
case(TASKGRAPHMETA(exeCosts=exeCosts))
equation
costs = Util.arrayFold(exeCosts, sumUpExecCosts1, (0,0.0));
then costs;
else then ((0,0.0));
end match;
end sumUpExecCosts;

protected function sumUpExecCosts1
input tuple<Integer,Real> iEntry;
input tuple<Integer,Real> iCostsOps;
output tuple<Integer,Real> oCostsOps;
protected
Real tmpCosts, iCosts;
Integer tmpOps, iOps;
algorithm
(tmpOps,tmpCosts) := iEntry;
(iOps,iCosts) := iCostsOps;
tmpCosts := realAdd(iCosts,tmpCosts);
tmpOps := tmpOps + iOps;
oCostsOps := (tmpOps,tmpCosts);
end sumUpExecCosts1;

// public function arrangeGraphInLevels "
// author: Waurich TUD 2013-07"
// input TaskGraph graphIn;
Expand Down
8 changes: 4 additions & 4 deletions Compiler/Template/CodegenC.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2001,11 +2001,11 @@ case SIMULATION_CONTEXT(genDiscrete=true) then
#pragma omp section
{
#ifdef _OMC_MEASURE_TIME
SIM_PROF_TICK_EQEXT(<%ix%>);
//SIM_PROF_TICK_EQEXT(<%ix%>);
#endif
eqFunction_<%ix%>(data);
#ifdef _OMC_MEASURE_TIME
SIM_PROF_ACC_EQEXT(<%ix%>);
//SIM_PROF_ACC_EQEXT(<%ix%>);
#endif
}
>>
Expand All @@ -2017,11 +2017,11 @@ else
let ix = equationIndex(getSimCodeEqByIndex(derivativEquations, idx))
<<
#ifdef _OMC_MEASURE_TIME
SIM_PROF_TICK_EQEXT(<%ix%>);
//SIM_PROF_TICK_EQEXT(<%ix%>);
#endif
eqFunction_<%ix%>(data);
#ifdef _OMC_MEASURE_TIME
SIM_PROF_ACC_EQEXT(<%ix%>);
//SIM_PROF_ACC_EQEXT(<%ix%>);
#endif
>>
end equationNamesHPCOM_Thread_;
Expand Down

0 comments on commit a7c18fe

Please sign in to comment.