@@ -4086,7 +4086,7 @@ protected
4086
4086
tuple< Integer ,Integer > reqTimeCom;
4087
4087
// These mappings are for simEqSystems
4088
4088
list< tuple< Integer ,Integer ,Real >> reqTimeOpLstSimCode; // <simEqIdx,numberOfCalcs,calcTimeSum>
4089
- array< tuple< Integer ,Real >> reqTimeOpSimCode;
4089
+ array< tuple< Integer ,Real >> reqTimeOpSimCode; // <simEqIdx,calcTime>
4090
4090
TaskGraphMeta tmpTaskGraphMeta;
4091
4091
array< Real > reqTimeOp; // Calculation time for each scc
4092
4092
array< list< Integer >> inComps;
@@ -4099,10 +4099,13 @@ algorithm
4099
4099
compMapping = Util . arrayMap(compMapping_withIdx, Util . tuple21);
4100
4100
((_,reqTimeCom)) = HpcOmBenchmark . benchSystem();
4101
4101
reqTimeOpLstSimCode = HpcOmBenchmark . readCalcTimesFromFile(benchFilePrefix);
4102
+ // print("createCosts: read files\n");
4102
4103
reqTimeOpSimCode = arrayCreate(listLength(reqTimeOpLstSimCode),(-1 ,-1 . 0 ));
4103
4104
reqTimeOpSimCode = List . fold(reqTimeOpLstSimCode, createCosts1, reqTimeOpSimCode);
4105
+ // print("createCosts: reqTimeOpSimCode created\n");
4104
4106
reqTimeOp = arrayCreate(listLength(comps),-1 . 0 );
4105
4107
reqTimeOp = convertSimEqToSccCosts(reqTimeOpSimCode, simeqCompMapping, reqTimeOp);
4108
+ // print("createCosts: scc costs converted\n");
4106
4109
commCosts = createCommCosts(commCosts,1 ,reqTimeCom);
4107
4110
((_,tmpTaskGraphMeta)) = Util . arrayFold4(inComps,createCosts0,(comps,shared ),compMapping, reqTimeOp, reqTimeCom, (1 ,iTaskGraphMeta));
4108
4111
then tmpTaskGraphMeta;
@@ -4301,35 +4304,35 @@ protected function convertSimEqToSccCosts
4301
4304
input array< Real > iReqTimeOp;
4302
4305
output array< Real > oReqTimeOp; // calcTime for each scc
4303
4306
algorithm
4304
- ((_,oReqTimeOp)) := Util . arrayFold1(iReqTimeOpSimCode, convertSimEqToSccCosts1, iSimeqCompMapping, (0 ,iReqTimeOp));
4307
+ ((_,oReqTimeOp)) := Util . arrayFold1(iReqTimeOpSimCode, convertSimEqToSccCosts1, iSimeqCompMapping, (1 ,iReqTimeOp));
4305
4308
end convertSimEqToSccCosts;
4306
4309
4307
4310
protected function convertSimEqToSccCosts1
4308
4311
input tuple< Integer ,Real > iReqTimeOpSimCode;
4309
4312
input array< Integer > iSimeqCompMapping; // Map each simEq to the scc
4310
4313
input tuple< Integer ,array< Real >> iReqTimeOp;
4311
- output tuple< Integer ,array< Real >> oReqTimeOp; // calcTime for each scc
4314
+ output tuple< Integer ,array< Real >> oReqTimeOp; // <simEqIdx, calcTime>
4312
4315
protected
4313
4316
Integer simEqCalcCount, simEqIdx;
4314
4317
Real simEqCalcTime, realSimEqCalcCount;
4315
4318
array< Real > reqTime;
4316
4319
algorithm
4317
4320
oReqTimeOp := matchcontinue(iReqTimeOpSimCode,iSimeqCompMapping,iReqTimeOp)
4318
- case (_,_,_ )
4321
+ case ((simEqCalcCount, simEqCalcTime),_,(simEqIdx,reqTime) )
4319
4322
equation
4320
- (simEqCalcCount, simEqCalcTime) = iReqTimeOpSimCode;
4321
- (simEqIdx,reqTime) = iReqTimeOp;
4322
4323
realSimEqCalcCount = intReal(simEqCalcCount);
4323
4324
true = realNe(realSimEqCalcCount,0 . 0 );
4324
4325
reqTime = convertSimEqToSccCosts2(reqTime, realDiv(simEqCalcTime,realSimEqCalcCount), simEqIdx, iSimeqCompMapping);
4325
4326
then ((simEqIdx+ 1 ,reqTime));
4326
- else
4327
+ case ((simEqCalcCount, simEqCalcTime),_,(simEqIdx,reqTime))
4327
4328
equation
4328
- (simEqCalcCount, simEqCalcTime) = iReqTimeOpSimCode;
4329
- (simEqIdx,reqTime) = iReqTimeOp;
4330
4329
realSimEqCalcCount = intReal(simEqCalcCount);
4331
4330
reqTime = convertSimEqToSccCosts2(reqTime, 0 . 0 , simEqIdx, iSimeqCompMapping);
4332
4331
then ((simEqIdx+ 1 ,reqTime));
4332
+ else
4333
+ equation
4334
+ print("convertSimEqToSccCosts1 failed! \n " );
4335
+ then fail();
4333
4336
end matchcontinue;
4334
4337
end convertSimEqToSccCosts1;
4335
4338
@@ -4350,7 +4353,7 @@ algorithm
4350
4353
sccIdx = arrayGet(iSimeqCompMapping, iSimEqIdx);
4351
4354
true = intGt(sccIdx,0 );
4352
4355
reqTime = arrayUpdate(reqTime,sccIdx, iSimEqCalcTime);
4353
- // print("convertSimEqToSccCosts2 sccIdx: " +& intString(sccIdx) +& " reqTime: " +& realString(iSimEqCalcTime) +& "\n");
4356
+ // print("convertSimEqToSccCosts2 sccIdx: " +& intString(sccIdx) +& " simEqIdx: " +& intString(iSimEqIdx) +& " reqTime: " +& realString(iSimEqCalcTime) +& "\n");
4354
4357
then
4355
4358
reqTime;
4356
4359
else
@@ -4396,10 +4399,15 @@ protected
4396
4399
Integer simEqIdx,calcTimeCount;
4397
4400
Real calcTime;
4398
4401
algorithm
4399
- tmpArray := iReqTime;
4400
- (simEqIdx,calcTimeCount,calcTime) := iTuple;
4401
- tmpArray := arrayUpdate(iReqTime, simEqIdx+ 1 ,(calcTimeCount,calcTime));
4402
- oReqTime := tmpArray;
4402
+ oReqTime := match(iTuple, iReqTime)
4403
+ case ((0 ,calcTimeCount,calcTime),_)
4404
+ then iReqTime;
4405
+ case ((simEqIdx,calcTimeCount,calcTime),tmpArray)
4406
+ equation
4407
+ // print("createCosts1: simEqIdx: " +& intString(simEqIdx) +& " calc-time: " +& realString(calcTime) +& " array-length: " +& intString(arrayLength(iReqTime)) +& "\n");
4408
+ tmpArray = arrayUpdate(iReqTime, simEqIdx,(calcTimeCount,calcTime));
4409
+ then tmpArray;
4410
+ end match;
4403
4411
end createCosts1;
4404
4412
4405
4413
protected function createExecCost "author: marcusw
@@ -4416,6 +4424,7 @@ algorithm
4416
4424
tuple< Integer ,Real > execCost;
4417
4425
case (_,_,_,_,_,_)
4418
4426
equation
4427
+ // print("\tcreateExecCost: sccs: " +& stringDelimitList(List.map(iNodeSccs, intString), ",") +& "\n");
4419
4428
execCost = List . fold3(iNodeSccs, createExecCost0, icomps_shared, compMapping, iRequiredTime, (0 ,0 . 0 ));
4420
4429
_ = arrayUpdate(iExecCosts,iNodeIdx,execCost);
4421
4430
then ();
@@ -4447,6 +4456,7 @@ algorithm
4447
4456
comp := listGet(comps,sccIndex);
4448
4457
syst := arrayGet(compMapping,sccIndex);
4449
4458
reqTime := arrayGet(iRequiredTime, sccIndex);
4459
+ // print("createExecCost0: Handling scc " +& intString(sccIndex) +& " with cost " +& realString(reqTime) +& "\n");
4450
4460
((costAdd,costMul,costTrig)) := countOperations(comp, syst, shared );
4451
4461
oCosts := (costAdd+ costMul+ costTrig + iCosts_op, realAdd(iCosts_cyc,reqTime));
4452
4462
end createExecCost0;
0 commit comments