diff --git a/Compiler/BackEnd/HpcOmScheduler.mo b/Compiler/BackEnd/HpcOmScheduler.mo index a1bab44f94a..0b6c08b5b89 100644 --- a/Compiler/BackEnd/HpcOmScheduler.mo +++ b/Compiler/BackEnd/HpcOmScheduler.mo @@ -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"); @@ -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)); @@ -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); diff --git a/Compiler/BackEnd/HpcOmSimCodeMain.mo b/Compiler/BackEnd/HpcOmSimCodeMain.mo index 337dda821d5..460cd7274d9 100644 --- a/Compiler/BackEnd/HpcOmSimCodeMain.mo +++ b/Compiler/BackEnd/HpcOmSimCodeMain.mo @@ -182,7 +182,7 @@ algorithm (initDAE, _, _) = Initialization.solveInitialSystem(inBackendDAE); removedInitialEquations = {}; createAndExportInitialSystemTaskGraph(initDAE, filenamePrefix); - + //Setup //----- System.realtimeTick(GlobalScript.RT_CLOCK_EXECSTAT_HPCOM_MODULES); @@ -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); @@ -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); @@ -227,6 +230,7 @@ algorithm //HpcOmTaskGraph.printTaskGraph(taskGraph); //HpcOmTaskGraph.printTaskGraphMeta(taskGraphData); + //Get complete DAE System //----------------------- taskGraphDAE = arrayCopy(taskGraph); @@ -243,6 +247,7 @@ algorithm //HpcOmTaskGraph.printTaskGraph(taskGraphDAE); //HpcOmTaskGraph.printTaskGraphMeta(taskGraphDataDAE); + //Get Event System //---------------- taskGraphEvent = arrayCopy(taskGraph); @@ -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); @@ -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); @@ -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; diff --git a/Compiler/BackEnd/HpcOmTaskGraph.mo b/Compiler/BackEnd/HpcOmTaskGraph.mo index 9a5dfc3c4f8..41480d704b6 100644 --- a/Compiler/BackEnd/HpcOmTaskGraph.mo +++ b/Compiler/BackEnd/HpcOmTaskGraph.mo @@ -4060,7 +4060,6 @@ public function createCosts "author: marcusw input array simeqCompMapping; //Map each simEq to the scc input TaskGraphMeta iTaskGraphMeta; output TaskGraphMeta oTaskGraphMeta; - protected array compMapping; array> compMapping_withIdx; @@ -4074,7 +4073,6 @@ protected array reqTimeOp; //Calculation time for each scc array> inComps; array>> commCosts; - algorithm oTaskGraphMeta := matchcontinue(iDae,benchFilePrefix,simeqCompMapping,iTaskGraphMeta) case(BackendDAE.DAE(shared=shared),_,_,TASKGRAPHMETA(inComps=inComps, commCosts=commCosts)) @@ -4756,12 +4754,11 @@ author: Waurich TUD 2013-07" input TaskGraphMeta graphDataIn; output tuple>,Real> criticalPathOut; //criticalPath with communication costs <%paths, opCost%> output tuple>,Real> criticalPathOutWoC; //criticalPath without communication costs <%paths, opCost%> - output list> parallelSetsOut; algorithm - (criticalPathOut,criticalPathOutWoC,parallelSetsOut) := matchcontinue(graphIn,graphDataIn) + (criticalPathOut,criticalPathOutWoC) := matchcontinue(graphIn,graphDataIn) local TaskGraph graphT; - list rootNodes,rootMarks; + list rootNodes; list> cpWCpaths,CpWoCpaths, level; Real cpWCcosts,cpWoCcosts; array nodeMark; @@ -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;