Skip to content

Commit e9b0cc4

Browse files
author
Volker Waurich
committed
- fix analyseScheduledTaskGraph for serial level calcTasks
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@21345 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 329dc66 commit e9b0cc4

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

Compiler/BackEnd/HpcOmScheduler.mo

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ algorithm
11571157
// generate a serial section
11581158
compLst = List.flatten(List.map1(section,Util.arrayGetIndexFirst,inComps));
11591159
simEqSysIdcs = getSimEqSysIdcsForCompLst(compLst,iSccSimEqMapping);
1160-
task = HpcOmSimCode.CALCTASK_LEVEL(simEqSysIdcs,section);
1160+
task = HpcOmSimCode.CALCTASK_LEVEL_SERIAL(simEqSysIdcs,section);
11611161
then {task};
11621162
case(section::_,HpcOmTaskGraph.TASKGRAPHMETA(inComps=inComps),_)
11631163
equation
@@ -3926,7 +3926,7 @@ algorithm
39263926
levelSectionCosts = List.mapList1_1(levels, getLevelTaskCosts,taskGraphMetaIn);
39273927
serTime = realSum(List.map(levelSectionCosts,realSum));
39283928
serTime = HpcOmTaskGraph.roundReal(serTime,2);
3929-
levelCosts = List.map1(levelSectionCosts,getLevelParallelTime,arrayCreate(numProcIn,0.0));
3929+
levelCosts = List.map1(levelSectionCosts,getLevelParallelTime,numProcIn);
39303930
parTime = List.fold(levelCosts,realAdd,0.0);
39313931
parTime = HpcOmTaskGraph.roundReal(parTime,2);
39323932
criticalPathInfo = HpcOmTaskGraph.dumpCriticalPathInfo((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC));
@@ -3962,19 +3962,19 @@ end analyseScheduledTaskGraph;
39623962
protected function getLevelParallelTime"computes the the time for the parallel computation of a parallel section
39633963
author:Waurich TUD 2014-06"
39643964
input list<Real> sectionCosts;
3965-
input array<Real> threadWorkLoadIn;
3965+
input Integer numProc;
39663966
output Real levelCost;
39673967
protected
39683968
array<Real> workload;
39693969
algorithm
3970-
workload := List.fold1(sectionCosts,getLevelParallelTime1,arrayLength(threadWorkLoadIn),threadWorkLoadIn);
3971-
levelCost := Util.arrayFold(workload,realMax,0.0);
3970+
workload := arrayCreate(numProc,0.0);
3971+
workload := List.fold(sectionCosts,getLevelParallelTime1,workload);
3972+
levelCost := Util.arrayFold(workload,realMax,0.0);
39723973
end getLevelParallelTime;
39733974

39743975
protected function getLevelParallelTime1"helper function for getLevelParallelTime. distributes the current section to the thread with the least workload
39753976
author:Waurich TUD 2014-06"
39763977
input Real sectionCost;
3977-
input Integer size;
39783978
input array<Real> threadWorkLoadIn;
39793979
output array<Real> threadWorkLoadOut;
39803980
protected
@@ -4001,6 +4001,16 @@ algorithm
40014001
nodeCosts = List.map1(nodeIdc,HpcOmTaskGraph.getExeCostReqCycles,iMeta);
40024002
costs = List.fold(nodeCosts,realAdd,0.0);
40034003
then costs;
4004+
case(HpcOmSimCode.CALCTASK_LEVEL_SERIAL(nodeIdc=nodeIdc),_)
4005+
equation
4006+
nodeCosts = List.map1(nodeIdc,HpcOmTaskGraph.getExeCostReqCycles,iMeta);
4007+
costs = List.fold(nodeCosts,realAdd,0.0);
4008+
then costs;
4009+
else
4010+
equation
4011+
print("getLevelTaskCosts failed!\n");
4012+
then
4013+
fail();
40044014
end match;
40054015
end getLevelTaskCosts;
40064016

0 commit comments

Comments
 (0)