diff --git a/Compiler/BackEnd/HpcOmEqSystems.mo b/Compiler/BackEnd/HpcOmEqSystems.mo index df1d2597797..f7ea6a135d3 100644 --- a/Compiler/BackEnd/HpcOmEqSystems.mo +++ b/Compiler/BackEnd/HpcOmEqSystems.mo @@ -112,11 +112,10 @@ algorithm end matchcontinue; end partitionLinearTornSystem; - -public function reduceLinearTornSystem "checks the EqSystem for tornSystems in order to dissassemble them into various SingleEquation and a reduced EquationSystem. +public function reduceLinearTornSystem "author:Waurich TUD 2013-09 + checks the EqSystem for tornSystems in order to dissassemble them into various SingleEquation and a reduced EquationSystem. This is useful in order to reduce the execution costs of the equationsystem and generate a bunch of parallel singleEquations. use +d=doLienarTearing +partlintorn=x to activate it. -Remark: this is still under development -author:Waurich TUD 2013-09" +Remark: this is still under development" input BackendDAE.EqSystem systIn; input BackendDAE.Shared sharedIn; input Integer tornSysIdxIn; @@ -149,8 +148,8 @@ algorithm end reduceLinearTornSystem; -protected function reduceLinearTornSystem1 "traverses all StrongComponents for tornSystems, reduces them and rebuilds the BLT, the matching and the info about vars and equations -author: Waurich TUD 2013-09" +protected function reduceLinearTornSystem1 "author: Waurich TUD 2013-09 + traverses all StrongComponents for tornSystems, reduces them and rebuilds the BLT, the matching and the info about vars and equations" input Integer compIdx; input BackendDAE.StrongComponents compsIn; input array ass1; @@ -314,8 +313,8 @@ algorithm end matchcontinue; end reduceLinearTornSystem1; -protected function compHasDummyState"outputs true if the component solves a dummy state var -author: Waurich TUD 2014-12" +protected function compHasDummyState "author: Waurich TUD 2014-12 + outputs true if the component solves a dummy state var" input BackendDAE.StrongComponent comp; input BackendDAE.EqSystem syst; output Boolean hasDummy; @@ -348,8 +347,8 @@ algorithm end match; end compHasDummyState; -protected function updateAssignmentsByComp"updates the assignments by the information given in the component. -author:Waurich TUD 2014-11" +protected function updateAssignmentsByComp "author:Waurich TUD 2014-11 + updates the assignments by the information given in the component." input BackendDAE.StrongComponent comp; input array ass1; input array ass2; @@ -361,7 +360,7 @@ algorithm arrayUpdate(ass1,var,eqn); end updateAssignmentsByComp; -protected function matchComponent"" +protected function matchComponent input list eqLstIn; input list varLstIn; input list eqIdcs; @@ -397,8 +396,8 @@ algorithm end replaceIndecesInComp; -protected function reduceLinearTornSystem2 " builds from a torn system various linear equation systems that can be computed in parallel. -author: Waurich TUD 2013-07" +protected function reduceLinearTornSystem2 "author: Waurich TUD 2013-07 + builds from a torn system various linear equation systems that can be computed in parallel." input BackendDAE.EqSystem isyst; input BackendDAE.Shared ishared; input list tVarIdcs0; @@ -533,7 +532,8 @@ algorithm //BackendDump.dumpComponents(oComps); end reduceLinearTornSystem2; -protected function addDerReplacement"if var1 is a state and var2 is $DER.var, add a new replacement rule: $DER.var-->der(var)" +protected function addDerReplacement " + if var1 is a state and var2 is $DER.var, add a new replacement rule: $DER.var-->der(var)" input BackendDAE.Var var1; input BackendDAE.Var var2; input BackendVarTransform.VariableReplacements replIn; @@ -651,8 +651,8 @@ algorithm end matchcontinue; end simplifyNewEquations1; -protected function buildEqSystemComponent "builds a strongComponent for the reduced System. if the system size is 1, a SingleEquation is built, otherwise a EqSystem with jacobian. -author:Waurich TUD 2013-12" +protected function buildEqSystemComponent "author:Waurich TUD 2013-12 + builds a strongComponent for the reduced System. if the system size is 1, a SingleEquation is built, otherwise a EqSystem with jacobian." input list eqIdcsIn; input list varIdcsIn; input list resEqsIn; @@ -704,8 +704,8 @@ algorithm end buildEqSystemComponent; -protected function buildLinearJacobian "builds the jacobian out of the given jacobian-entries -author:Waurich TUD 2013-12" +protected function buildLinearJacobian "author:Waurich TUD 2013-12 + builds the jacobian out of the given jacobian-entries" input list> inElements; //outer list refers to the row, inner list to the column input list eqIdcs; input list varIdcs; @@ -719,8 +719,8 @@ algorithm end buildLinearJacobian; -protected function buildLinearJacobian1 "helper for buildLinearJacobian. -author:Waurich TUD 2013-12" +protected function buildLinearJacobian1 "author:Waurich TUD 2013-12 + helper for buildLinearJacobian." input Integer rowIdx; input list columns; input list> inElements; @@ -736,8 +736,8 @@ algorithm end buildLinearJacobian1; -protected function buildLinearJacobian2 "helper for buildLinearJacobian -author:Waurich TUD 2013-12" +protected function buildLinearJacobian2 "author:Waurich TUD 2013-12 + helper for buildLinearJacobian" input Integer colIdx; input list inElements; input Integer rowIdx; @@ -761,8 +761,8 @@ algorithm end buildLinearJacobian2; -protected function updateMatching "inserts the information of matching2 into matching1 by adding an index offset for the vars and eqs of matching2.Actually only one assignment for matching 2 is needed. -author: Waurich TUD 2013-09" +protected function updateMatching "author: Waurich TUD 2013-09 + inserts the information of matching2 into matching1 by adding an index offset for the vars and eqs of matching2.Actually only one assignment for matching 2 is needed." input Integer idx; input tuple offsetTpl; input tuple,array> matching2; @@ -783,8 +783,8 @@ algorithm end updateMatching; -protected function updateResidualMatching "sets the matching between tearingVars and residuals. -author: Waurich TUD 2013-09" +protected function updateResidualMatching "author: Waurich TUD 2013-09 + sets the matching between tearingVars and residuals." input Integer idx; input list tvars; input list resEqs; @@ -803,8 +803,8 @@ algorithm end updateResidualMatching; -protected function getOtherComps "builds ordered StrongComponents and matching for the other equations. -author: Waurich TUD 2013-09" +protected function getOtherComps "author: Waurich TUD 2013-09 + builds ordered StrongComponents and matching for the other equations." input list>> otherEqsVarTpl; input array ass1; input array ass2; @@ -819,8 +819,8 @@ algorithm end getOtherComps; -protected function getOtherComps1 "implementation of getOtherComps -author:waurich TUD 2013-09" +protected function getOtherComps1 "author:waurich TUD 2013-09 + implementation of getOtherComps" input tuple> otherEqsVarTpl; input tuple, array, BackendDAE.StrongComponents> tplIn; output tuple, array, BackendDAE.StrongComponents> tplOut; @@ -851,8 +851,8 @@ algorithm end getOtherComps1; -protected function replaceAtPositionFromList "replaces the entry from inLst indexed by positionLst[n] with the nth entry in replacingLst. n is first input so it can be used in a folding functions. -author: Waurich TUD 2013-09" +protected function replaceAtPositionFromList "author: Waurich TUD 2013-09 + replaces the entry from inLst indexed by positionLst[n] with the nth entry in replacingLst. n is first input so it can be used in a folding functions." replaceable type ElementType subtypeof Any; input Integer n; input list replacingLst; @@ -869,8 +869,8 @@ algorithm end replaceAtPositionFromList; -protected function updateIndicesInComp " raises the indices of the vars and eqs in the given component according to the given offsets. -author: Waurich TUD 2013-09" +protected function updateIndicesInComp "author: Waurich TUD 2013-09 + raises the indices of the vars and eqs in the given component according to the given offsets." input BackendDAE.StrongComponent compIn; input Integer varOffset; input Integer eqOffset; @@ -896,8 +896,8 @@ algorithm end matchcontinue; end updateIndicesInComp; -protected function buildNewResidualEquation "function to build the new linear residual equations res=0=A*xt+a0 whicht is solved for xt -author: Waurich TUD 2013-09" +protected function buildNewResidualEquation "author: Waurich TUD 2013-09 + function to build the new linear residual equations res=0=A*xt+a0 whicht is solved for xt" input Integer resIdx; input list> aCoeffLst; input list a0CoeffLst; @@ -943,8 +943,8 @@ algorithm end buildNewResidualEquation; -protected function buildNewResidualEquation2 "function to build the sum of the rhs of the new residual equation, i.e. the sum of all tvars and their coefficients -author: Waurich TUD 2013-09" +protected function buildNewResidualEquation2 "author: Waurich TUD 2013-09 + function to build the sum of the rhs of the new residual equation, i.e. the sum of all tvars and their coefficients" input Integer idx; input list coeffs; input list tVars; @@ -995,8 +995,8 @@ algorithm end buildNewResidualEquation2; -protected function addProductToExp " function to add the product of the given 2 BackendDAE.Var to the given inExp. expOut = expIn + fac1*fac2 -author: Waurich TUD 2013-09" +protected function addProductToExp "author: Waurich TUD 2013-09 + function to add the product of the given 2 BackendDAE.Var to the given inExp. expOut = expIn + fac1*fac2" input BackendDAE.Var var1; input BackendDAE.Var var2; input DAE.Exp inExp; @@ -1014,8 +1014,8 @@ algorithm end addProductToExp; -protected function buildSingleEquationSystem "function to build a system of singleEquations which can be solved partially parallel. -author: Waurich TUD 2013-07" +protected function buildSingleEquationSystem "author: Waurich TUD 2013-07 + function to build a system of singleEquations which can be solved partially parallel." input Integer eqSizeOrig; input list inEqs; input list inVars; @@ -1073,13 +1073,13 @@ algorithm end buildSingleEquationSystem; -protected function getTornSystemCoefficients "gets the co-efficients for the new residual equations of the linear torn system +protected function getTornSystemCoefficients "author: Waurich TUD 2013-08 + gets the co-efficients for the new residual equations of the linear torn system the first index is for the residualvar and the second for the tearingvar (r1) = (a11 a12..) (xt1)+(a01) (r2) = (a21 a22..)*(xt2)+(a02) (:) = (: : ) ( : )+( : ) -this is meant to be a matrix :) -author: Waurich TUD 2013-08" +this is meant to be a matrix :)" input list iValueRange; input Integer numTVars; input Integer tornSysIdx; @@ -1122,8 +1122,8 @@ algorithm end getTornSystemCoefficients; -protected function getTornSystemCoefficients1 "gets the equations with coefficients for one e_i -author: Waurich TUD 2013-08" +protected function getTornSystemCoefficients1 "author: Waurich TUD 2013-08 + gets the equations with coefficients for one e_i" input list resIdxLst; input Integer iIdx; input array> h_iArr; @@ -1221,8 +1221,8 @@ algorithm end matchcontinue; end getTornSystemCoefficients1; -protected function varExp "gets an DAE.Exp for the CREF of the given BackendDAE.Var -author: Waurich TUD 2013-08" +protected function varExp "author: Waurich TUD 2013-08 + gets an DAE.Exp for the CREF of the given BackendDAE.Var" input BackendDAE.Var varIn; output DAE.Exp expOut; protected @@ -1234,8 +1234,8 @@ algorithm expOut := DAE.CREF(cr,ty); end varExp; -protected function getResidualExpressions "adds a variable r_x to the right hand side of an equation. this corresponds to the residual value in a residual equation -author: Waurich TUD 2013-08" +protected function getResidualExpressions "author: Waurich TUD 2013-08 + adds a variable r_x to the right hand side of an equation. this corresponds to the residual value in a residual equation" input list iIn; input list resEqLstIn; input array replArrIn; @@ -1248,8 +1248,8 @@ algorithm h_iArrOut := List.fold2(iIn,getResidualExpressions1,resExps,replArrIn,h_iArrIn); end getResidualExpressions; -protected function getResidualExpressions1 "function to parse the expressions of one residualEquation. -author:Waurich TUD 2013-08 " +protected function getResidualExpressions1 "author:Waurich TUD 2013-08 + function to parse the expressions of one residualEquation." input Integer i; input list resExpsIn; input array replArr; @@ -1277,7 +1277,8 @@ algorithm end matchcontinue; end getResidualExpressions1; -protected function getResidualExpressionForEquation"subtracts the lhs from the rhs of the equation. a=b+c --> b+c-a " +protected function getResidualExpressionForEquation " + subtracts the lhs from the rhs of the equation. a=b+c --> b+c-a" input BackendDAE.Equation eq; output DAE.Exp exp; algorithm @@ -1299,8 +1300,8 @@ algorithm end getResidualExpressionForEquation; -protected function varInFrontList " puts the varIn at the front of the first list of lists -author: Waurich TUD 2013-08" +protected function varInFrontList "author: Waurich TUD 2013-08 + puts the varIn at the front of the first list of lists" input BackendDAE.Var varIn; input list> lstLstIn; output list> lstLstOut; @@ -1322,8 +1323,8 @@ algorithm end varInFrontList; -protected function eqInFrontList " puts the eqIn at the front of the first list of lists -author: Waurich TUD 2013-08" +protected function eqInFrontList "author: Waurich TUD 2013-08 + puts the eqIn at the front of the first list of lists" input BackendDAE.Equation eqIn; input list> lstLstIn; output list> lstLstOut; @@ -1345,10 +1346,10 @@ algorithm end eqInFrontList; -protected function getAlgebraicEquationsForEI "computes from otherEqs the equations to solve for xa_i by: +protected function getAlgebraicEquationsForEI "author: Waurich TUD 2013-08 + computes from otherEqs the equations to solve for xa_i by: -replacing (i+1)-times in all otherEqs the tvars with i=0: all tvars=0, i=1: all tvars=0 but tvar{1}=1, i=2: all tvars=0 but tvar{2}=1 etc. -- replacing (i+1)-times in all otherEqs the otherVars(algebraic vars) with $Xai.cref in order to solve for them -author: Waurich TUD 2013-08" +- replacing (i+1)-times in all otherEqs the otherVars(algebraic vars) with $Xai.cref in order to solve for them" input list iIn; input Integer size; input list otherEqLstIn; @@ -1437,8 +1438,8 @@ algorithm end getAlgebraicEquationsForEI; -protected function replaceTVarWithReal "adds the replacement rule to set the tvar to realIn -author: Waurich TUD 2013-08" +protected function replaceTVarWithReal "author: Waurich TUD 2013-08 + adds the replacement rule to set the tvar to realIn" input DAE.ComponentRef tVarCRefIn; input Real realIn; input BackendVarTransform.VariableReplacements replacementIn; @@ -1448,8 +1449,8 @@ algorithm end replaceTVarWithReal; -protected function replaceOtherVarsWithPrefixCref "adds the replacement rule to set the cref to $prefix.cref -author: Waurich TUD 2013-07" +protected function replaceOtherVarsWithPrefixCref "author: Waurich TUD 2013-07 + adds the replacement rule to set the cref to $prefix.cref" input Integer indxIn; input String prefix; input list oVarCRefLstIn; @@ -1481,8 +1482,8 @@ end replaceOtherVarsWithPrefixCref; // get EqSystem object //-------------------------------------------------// -protected function getEqSystem"gets a eqSys object for the given set of variables and equations. -author:Waurich TUD 2014-11" +protected function getEqSystem "author:Waurich TUD 2014-11 + gets a eqSys object for the given set of variables and equations." input list eqLst; input list varLst; output EqSys syst; @@ -1509,7 +1510,8 @@ algorithm sys := LINSYS(dim,matrixA,vectorB,listArray(varLst)); end createEqSystem; -protected function getEqSystem2"gets the coefficents and offsets from the equations" +protected function getEqSystem2 " + gets the coefficents and offsets from the equations" input BackendDAE.Equation eq; input list crefs; input tuple foldIn; @@ -1538,7 +1540,8 @@ algorithm foldOut := (sys,idx+1); end getEqSystem2; -protected function getEqSystem3"divides the given expressions into coefficient-terms and the rest" +protected function getEqSystem3 " + divides the given expressions into coefficient-terms and the rest" input DAE.ComponentRef cref; input tuple,list> foldIn; output tuple,list> foldOut; @@ -1558,7 +1561,8 @@ algorithm foldOut := (allTerms,coeff::coeffsIn); end getEqSystem3; -protected function containsFunctioncallOfCref"outputs true if the expIn contains a function call which has cref as input" +protected function containsFunctioncallOfCref " + outputs true if the expIn contains a function call which has cref as input" input DAE.Exp expIn; input DAE.ComponentRef cref; output Boolean hasCrefInCall; @@ -1573,8 +1577,8 @@ algorithm end if; end containsFunctioncallOfCref; -public function getCallExpLst "returns the list of expressions from a call. -author:Waurich TUD 2015-08" +public function getCallExpLst "author:Waurich TUD 2015-08 + returns the list of expressions from a call." input DAE.Exp eIn; input list eLstIn; output DAE.Exp eOut; @@ -1590,7 +1594,8 @@ algorithm end matchcontinue; end getCallExpLst; -protected function getSummands"gets all sum-terms in the equation" +protected function getSummands " + gets all sum-terms in the equation" input BackendDAE.Equation eq; output list exps; algorithm @@ -1684,8 +1689,8 @@ algorithm end matchcontinue; end ChiosCondensation2; -protected function generateCramerEqs"generate all equations to compute the xVector. -author:Waurich TUD 2014-11" +protected function generateCramerEqs "author:Waurich TUD 2014-11 + generate all equations to compute the xVector." input list varIdcs; input Integer dim; input array vectorX; @@ -1959,7 +1964,8 @@ algorithm end match; end CramerRule1; -protected function determinant"calculates the determinant of a matrix" +protected function determinant " + calculates the determinant of a matrix" input array> matrix; output DAE.Exp detOut; algorithm @@ -2040,7 +2046,8 @@ algorithm matrixOut := LINSYS(dim = listLength(bVars),matrixA=matrixA, vectorB=vectorB,vectorX=vectorX); end getMatrixFromJac; -protected function transposeMatrix"transposes a matrix of the form array>" +protected function transposeMatrix " + transposes a matrix of the form array>" input array> matrixIn; output array> matrixOut; protected @@ -2110,8 +2117,8 @@ algorithm end dumpMatrix; -protected function dumpVarArrLst "dumps a list> as a String. TODO: remove when finished -author: Waurich TUD 2013-08" +protected function dumpVarArrLst "author: Waurich TUD 2013-08 + dumps a list> as a String. TODO: remove when finished" input array> inArrLst; input String heading; protected @@ -2124,8 +2131,8 @@ algorithm end dumpVarArrLst; -protected function dumpVarArrLst1 "mapping function for dumpVarArrLst TODO: remove when finished -author: Waurich TUD 2013-08" +protected function dumpVarArrLst1 "author: Waurich TUD 2013-08 + mapping function for dumpVarArrLst TODO: remove when finished" input Integer lstIdx; input list> inLstLst; input String heading; @@ -2141,8 +2148,8 @@ algorithm end dumpVarArrLst1; -protected function dumpEqArrLst "dumps a list> as a String. TODO: remove when finished -author: Waurich TUD 2013-08" +protected function dumpEqArrLst "author: Waurich TUD 2013-08 + dumps a list> as a String. TODO: remove when finished" input array> inArrLst; input String heading; protected @@ -2155,8 +2162,8 @@ algorithm end dumpEqArrLst; -protected function dumpEqArrLst1 "mapping function for dumpEqArrLst TODO: remove when finished -author: Waurich TUD 2013-08" +protected function dumpEqArrLst1 "author: Waurich TUD 2013-08 + mapping function for dumpEqArrLst TODO: remove when finished" input Integer lstIdx; input list> inLstLst; input String heading; @@ -2176,8 +2183,8 @@ end dumpEqArrLst1; // solve torn systems in parallel //-------------------------------------------------// -public function parallelizeTornSystems"analyse torn systems. -author:Waurich TUD 2014-07" +public function parallelizeTornSystems "author:Waurich TUD 2014-07 + analyse torn systems." input HpcOmTaskGraph.TaskGraph graphIn; input HpcOmTaskGraph.TaskGraphMeta metaIn; input array> sccSimEqMapping; @@ -2423,8 +2430,9 @@ end genSystemVarIdcs; //05-09-2014 marcusw: Changed because of dependency-task restructuring for MPI -//protected function appendStringToLockIdcs"appends the suffix to the lockIds of the given tasks -//author: Waurich TUD 2014-07" +//protected function appendStringToLockIdcs "author: Waurich TUD 2014-07 +// appends the suffix to the lockIds of the given tasks +//" // input list taskLstIn; // input String suffix; // output list taskLstOut; @@ -2432,8 +2440,9 @@ end genSystemVarIdcs; // taskLstOut := List.map1(taskLstIn,appendStringToLockIdcs1,suffix); //end appendStringToLockIdcs; // -//protected function appendStringToLockIdcs1"appends the suffix to the lockIds of the given tasks -//author: Waurich TUD 2014-07" +//protected function appendStringToLockIdcs1 "author: Waurich TUD 2014-07 +// appends the suffix to the lockIds of the given tasks +//" // input HpcOmSimCode.Task taskIn; // input String suffix; // output HpcOmSimCode.Task taskOut; @@ -2485,8 +2494,8 @@ algorithm end matchcontinue; end buildMatchedGraphForTornSystem; -protected function buildTaskgraphMetaForTornSystem"creates a preliminary task graph meta object -author:Waurich TUD 2014-07" +protected function buildTaskgraphMetaForTornSystem "author:Waurich TUD 2014-07 + creates a preliminary task graph meta object" input HpcOmTaskGraph.TaskGraph graph; input list eqLst; input list varLst; @@ -2524,8 +2533,8 @@ algorithm metaOut := HpcOmTaskGraph.TASKGRAPHMETA(inComps,varCompMapping,eqCompMapping,compParamMapping,compNames,compDescs,exeCosts,commCosts,nodeMark,compInformations); end buildTaskgraphMetaForTornSystem; -protected function buildDummyCommCosts "generates preliminary commCosts for a children list. -author:Waurich TUD 2014-07" +protected function buildDummyCommCosts "author:Waurich TUD 2014-07 + generates preliminary commCosts for a children list." input list childNodes; output HpcOmTaskGraph.Communications commCosts; algorithm diff --git a/Compiler/BackEnd/HpcOmScheduler.mo b/Compiler/BackEnd/HpcOmScheduler.mo index 59a88eb45cc..1dc6994ea26 100644 --- a/Compiler/BackEnd/HpcOmScheduler.mo +++ b/Compiler/BackEnd/HpcOmScheduler.mo @@ -62,11 +62,11 @@ import Util; public type TaskAssignment = array; //the information which node is assigned to which processor + //-------------- // No Scheduling //-------------- -public function createEmptySchedule "function createEmptySchedule - author: marcusw +public function createEmptySchedule "author: marcusw Create a empty-schedule to produce serial code. The produces task list represents the computation order of the serial code." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -94,11 +94,11 @@ algorithm oSchedule := HpcOmSimCode.EMPTYSCHEDULE(HpcOmSimCode.SERIALTASKLIST(allTasks, true)); end createEmptySchedule; + //---------------- // List Scheduling //---------------- -public function createListSchedule "function createListSchedule - author: marcusw +public function createListSchedule "author: marcusw Create a list-schedule out of the given informations." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -134,9 +134,9 @@ algorithm oSchedule := setScheduleLockIds(tmpSchedule); end createListSchedule; -protected function createListSchedule1 "function createListSchedule1 - author: marcusw - Create a list schedule, starting with the given nodeList and ready times. This method will add calcTasks and assignLockTasks, but no releaseLockTasks!" +protected function createListSchedule1 "author: marcusw + Create a list schedule, starting with the given nodeList and ready times. This method will add calcTasks and + assignLockTasks, but no releaseLockTasks!" input list iNodeList; //the sorted nodes -> this method will pick the first task input array iThreadReadyTimes; //the time until the thread is ready to handle a new task input HpcOmTaskGraph.TaskGraph iTaskGraph; @@ -241,12 +241,10 @@ algorithm end createListSchedule1; - //---------------- // Random Scheduling //---------------- -public function createRandomSchedule "function createListSchedule - author: mflehmig +public function createRandomSchedule "author: mflehmig Create a schedule out of the given informations by randomly chose a thread for each task. This implementation is very close to list scheduling algorithm but we do not need to calculate a 'best schedule'." input HpcOmTaskGraph.TaskGraph iTaskGraph; @@ -286,9 +284,7 @@ algorithm oSchedule := setScheduleLockIds(tmpSchedule); end createRandomSchedule; - -protected function createRandomSchedule1 "function createRandomSchedule1 - author: mflehmig +protected function createRandomSchedule1 "author: mflehmig Create a random schedule starting with the given nodeList. This method will add calcTasks and assignLockTasks, but no releaseLockTasks!" input list iNodeList; //The sorted nodes -> this method will pick the first task @@ -370,7 +366,6 @@ algorithm simEqIdc = List.map(List.map1(eqIdc, getSimEqSysIdxForComp, iSccSimEqMapping), List.last); //simEqIdc = List.sort(simEqIdc,intGt); - //! Add task to thread newTask = HpcOmSimCode.CALCTASK(weighting, index, calcTime, threadFinishTime, threadId, simEqIdc); threadTasks = newTask::threadTasks; @@ -435,9 +430,8 @@ end createRandomSchedule1; //------------------------ // List Scheduling reverse //------------------------ -public function createListScheduleReverse "function createListScheduleReverse - author: marcusw - Create a list-schedule out of the given informations, starting with all leaves." +public function createListScheduleReverse "author: marcusw + Create a list-schedule out of the given information, starting with all leaves." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; input Integer iNumberOfThreads; @@ -629,7 +623,8 @@ algorithm oReleaseTasks := tmpTask :: iReleaseTasks; end addAssignLocksToSchedule; -protected function getSimEqSysIdxForComp"gets the simeqSys indexes for the given SCC index" +protected function getSimEqSysIdxForComp " + Gets the simeqSys indexes for the given SCC index." input Integer compIdx; input array> iSccSimEqMapping; output list simEqSysIdcs; @@ -637,7 +632,8 @@ algorithm simEqSysIdcs := arrayGet(iSccSimEqMapping,compIdx); end getSimEqSysIdxForComp; -protected function getSimEqSysIdcsForCompLst"gets a list of simeqSys indexes for the given list of SCC indexes" +protected function getSimEqSysIdcsForCompLst " + Gets a list of simeqSys indexes for the given list of SCC indexes." input list compIdcs; input array> iSccSimEqMapping; output list simEqSysIdcs; @@ -647,7 +643,8 @@ algorithm //print("simEqSysIdcs: \n"+stringDelimitList(List.map(simEqSysIdcs,intString),"\n")+"\n"); end getSimEqSysIdcsForCompLst; -public function getSimEqSysIdcsForNodeLst"gets a list of simeqSys indexes for the given nodes (node = list of comps)" +public function getSimEqSysIdcsForNodeLst " + Gets a list of simeqSys indexes for the given nodes (node = list of comps)." input list> nodeIdcs; input array> iSccSimEqMapping; output list> simEqSysIdcsLst; @@ -673,7 +670,8 @@ algorithm end getLocksByPredecessorList; protected function getLockTasksByPredecessorList "author: marcusw - Append a incoming dependency between the given iTask and the predecessor task to the output-list if they are not handled by the same thread." + Append a incoming dependency between the given iTask and the predecessor task to the output-list if they are + not handled by the same thread." input tuple iPredecessorTask; input HpcOmSimCode.Task iTask; //The parent task input Integer iThreadIdx; //Thread handling task <%iTaskIdx%> @@ -741,8 +739,8 @@ algorithm end matchcontinue; end getLockTasksByPredecessorListReverse0; -protected function getCommunicationObjBetweenMergedTasks"gets the communicationCosts between 2 merged tasks. This is the sum of all edges between the 2 nodes. -author:Waurich TUD 2014-11" +protected function getCommunicationObjBetweenMergedTasks "author: Waurich TUD 2014-11 + Gets the communicationCosts between 2 merged tasks. This is the sum of all edges between the 2 nodes." input Integer parentNode; input Integer node; input array> inComps; @@ -760,8 +758,8 @@ algorithm oCommunication := List.fold(edgesFromParents,function getCommunicationObjBetweenMergedTasks1(tasks=nodeTasks),commFold); end getCommunicationObjBetweenMergedTasks; -protected function getCommunicationObjBetweenMergedTasks1"sums up the commCosts, for the edges between parent node and the tasks. -author:Waurich TUD 2014-11" +protected function getCommunicationObjBetweenMergedTasks1 "author: Waurich TUD 2014-11 + Sums up the commCosts, for the edges between parent node and the tasks." input HpcOmTaskGraph.Communication parentCommCost; input list tasks; input HpcOmTaskGraph.Communication iCommunication; @@ -814,7 +812,7 @@ algorithm end convertVarIdxToSimVar; protected function createDepTask "author: marcusw - Create a dependeny task that indicates that variables of another task are required." + Create a dependency task that indicates that variables of another task are required." input HpcOmSimCode.Task iSourceTask; input HpcOmSimCode.Task iTargetTask; input Boolean iOutgoing; //true if lock should released, false if lock should assigned @@ -825,7 +823,7 @@ algorithm end createDepTask; protected function createDepTaskAndCommunicationInfo "author: marcusw - Create a dependeny task that indicates that variables of another task are required. + Create a dependency task that indicates that variables of another task are required. The communication info is created out of the given communication array and the simvar-mapping." input HpcOmSimCode.Task iSourceTask; input HpcOmSimCode.Task iTargetTask; @@ -864,7 +862,7 @@ algorithm end createDepTaskAndCommunicationInfo; protected function createDepTaskByTaskIdc "author: marcusw - Create a dependeny task that indicates that variables of another task are required or calculated. The + Create a dependency task that indicates that variables of another task are required or calculated. The source and target tasks are taken from the all-tasks-array." input Integer iSourceTaskIdx; input Integer iTargetTaskIdx; @@ -883,7 +881,7 @@ algorithm end createDepTaskByTaskIdc; protected function createDepTaskByTaskIdcR "author: marcusw - Create a dependeny task that indicates that variables of another task are required or calculated. The + Create a dependency task that indicates that variables of another task are required or calculated. The source and target tasks are taken from the all-tasks-array. Additionally, this is the revered edition of createOutgoingDummyDepTask, which means that the dependency is leading from target to source." @@ -899,8 +897,7 @@ algorithm oAssignTask := createDepTaskByTaskIdc(iTargetTaskIdx,iSourceTaskIdx,iAllCalcTasks,iOutgoing,iCommCosts,iCompTaskMapping,iSimVarMapping); end createDepTaskByTaskIdcR; -protected function updateRefCounterBySuccessorIdc "function updateRefCounterBySuccessorIdc - author: marcusw +protected function updateRefCounterBySuccessorIdc "author: marcusw Decrement the ref-counter off all tasks in the successor-list. If the new ref-counter is 0, the task will be appended to the second return argument." input array> iAllCalcTasks; //all tasks with ref-counter @@ -959,8 +956,7 @@ algorithm end matchcontinue; end getThreadFinishTimesMin; -protected function getTaskWithHighestFinishTime "function getTaskWithHighestFinishTime - author: marcusw +protected function getTaskWithHighestFinishTime "author: marcusw Pick the task with the highest finish time out of the given task list." input list> iTasks; //Tasks with ref-counter input Option iCurrentTask; @@ -986,8 +982,7 @@ algorithm end matchcontinue; end getTaskWithHighestFinishTime; -protected function convertTaskGraphToTasks "function convertTaskGraphToTasks - author: marcusw +protected function convertTaskGraphToTasks "author: marcusw Convert all tasks of the taskGraph-Structure to HpcOmScheduler.Tasks" input HpcOmTaskGraph.TaskGraph iTaskGraphT; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -1007,8 +1002,7 @@ algorithm oTasks := convertTaskGraphToTasks1(iTaskGraphMeta,iTaskGraphT,1,iConverterFunc,tmpTaskArray); end convertTaskGraphToTasks; -protected function convertTaskGraphToTasks1 "function convertTaskGraphToTasks1 - author: marcusw +protected function convertTaskGraphToTasks1 "author: marcusw Convert one TaskGraph-Task to a Scheduler-Task with ref-counter." input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; input HpcOmTaskGraph.TaskGraph iTaskGraphT; @@ -1042,8 +1036,7 @@ algorithm end matchcontinue; end convertTaskGraphToTasks1; -protected function convertNodeToTask "function convertNodeToTask - author: marcusw +protected function convertNodeToTask "author: marcusw Convert one TaskGraph-Node to a Scheduler-Task and set weighting = nodeMark." input Integer iNodeIdx; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -1073,8 +1066,7 @@ algorithm end match; end convertNodeToTask; -protected function convertNodeToTaskReverse "function convertNodeToTaskReverse - author: marcusw +protected function convertNodeToTaskReverse "author: marcusw Convert one TaskGraph-Node to a Scheduler-Task and set weighting = -nodeMark." input Integer iNodeIdx; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -1263,7 +1255,7 @@ algorithm end getSuccessorsByTask; protected function compareTasksByWeighting "author: marcusw - Compare the given tasks by their weighting. If task1 has a higher weighting than task 2, true is returned." + Compare the given tasks by their weighting. Return true if task1 has a higher weighting than task2." input HpcOmSimCode.Task iTask1; input HpcOmSimCode.Task iTask2; output Boolean oResult; @@ -1403,7 +1395,7 @@ algorithm end printTask; public function convertScheduleStrucToInfo "author: marcusw - Convert the given schedule-information into an node-array of informations." + Convert the given schedule-information into an node-array of information." input HpcOmSimCode.Schedule iSchedule; input Integer iTaskCount; output array> oScheduleInfo; //for threadScheduling: array which contains for each node (index) @@ -1443,7 +1435,7 @@ algorithm end convertScheduleStrucToInfo; protected function convertScheduleStrucToInfo0 "author: marcusw - Convert the given task list into an node-array of informations." + Convert the given task list into an node-array of information." input list iTaskList; input array> iScheduleInfo; output array> oScheduleInfo; @@ -1531,12 +1523,12 @@ algorithm end match; end convertScheduleStrucToInfoLevel1; + //----------------- // Balanced Level Scheduling //----------------- -public function createBalancedLevelScheduling "function createBalancedLevelScheduling - author: waurich TUD - Creates a balanced level scheduling for the given graph" +public function createBalancedLevelScheduling "author: waurich TUD + Creates a balanced level scheduling for the given graph." input HpcOmTaskGraph.TaskGraph iGraph; input HpcOmTaskGraph.TaskGraphMeta iMeta; input array> iSccSimEqMapping; //Maps each scc to a list of simEqs @@ -1596,8 +1588,8 @@ algorithm oMeta := HpcOmTaskGraph.TASKGRAPHMETA(inComps,varCompMapping,eqCompMapping,compParamMapping,compNames,compDescs,exeCosts,commCosts,nodeMark, compInformations); end createBalancedLevelScheduling; -protected function BLS_mergeSmallSections"traverses the sections in a level and merges them if they are to small -author: Waurich TUD 2014-07" +protected function BLS_mergeSmallSections "author: Waurich TUD 2014-07 + Traverses the sections in a level and merges them if they are to small." input list> sectionsIn; input HpcOmTaskGraph.TaskGraphMeta iMeta; input Real targetCosts; @@ -1621,9 +1613,9 @@ sectionsOut := match(sectionsIn,iMeta,targetCosts) end match; end BLS_mergeSmallSections; -protected function BLS_generateSchedule"generates a level schedule for the given levels. if a level contains only one section build a serial task. -all simEqSys indexes are sorted according to their idx -author: Waurich TUD 2014-07" +protected function BLS_generateSchedule "author: Waurich TUD 2014-07 + Generates a level schedule for the given levels. if a level contains only one section build a serial task. + All simEqSys indexes are sorted according to their idx." input list> level; input HpcOmTaskGraph.TaskGraphMeta iMeta; input array> iSccSimEqMapping; @@ -1641,7 +1633,7 @@ algorithm // generate a serial section compLst = List.flatten(List.map1(section,Array.getIndexFirst,inComps)); //simEqSysIdcs = List.sort(simEqSysIdcs,intGt); - task = makeCalcLevelTask(section,inComps,iSccSimEqMapping); + task = makeCalcTaskLevel(section,inComps,iSccSimEqMapping); taskLst = HpcOmSimCode.SERIALTASKLIST({task}, true); then taskLst; case(_::_,HpcOmTaskGraph.TASKGRAPHMETA(inComps=inComps),_) @@ -1653,9 +1645,10 @@ algorithm end matchcontinue; end BLS_generateSchedule; -protected function BLS_fillParallelSections"cluster the tasks from the level, beginning with the critical path node. if this node is to small, -merge only necessary nodes to compute the next level critical path node. if the node is big enough gather all level nodes and unassigned nodes in this level. -author: Waurich TUD 2014-07" +protected function BLS_fillParallelSections "author: Waurich TUD 2014-07 + Cluster the tasks from the level, beginning with the critical path node. If this node is to small, merge only necessary + nodes to compute the next level critical path node. if the node is big enough gather all level nodes and unassigned nodes + in this level." input list> levelIn; input array levelAssIn; input list critPathNodes; @@ -1774,8 +1767,9 @@ algorithm end matchcontinue; end BLS_fillParallelSections; -protected function BLS_mergeDependentLevelTask"gathers nodes in merged level according to their dependencies. successors and predecessors have to be collected in one section. -author:Waurich TUD 2014-07" +protected function BLS_mergeDependentLevelTask "author:Waurich TUD 2014-07 + Gathers nodes in merged level according to their dependencies. Successors and predecessors have to be collected + in one section." input list nodesIn; input HpcOmTaskGraph.TaskGraph iGraph; input HpcOmTaskGraph.TaskGraph iGraphT; @@ -1804,8 +1798,8 @@ algorithm end match; end BLS_mergeDependentLevelTask; -protected function BLS_getDependentGroups"gathers the dependent successors and predecessors among all referenceNodes for the given task. -author:Waurich TUD 2014-07" +protected function BLS_getDependentGroups "author: Waurich TUD 2014-07 + Gathers the dependent successors and predecessors among all referenceNodes for the given task." input list nodes; //as first input, take a single node: {node} input HpcOmTaskGraph.TaskGraph iGraph; input HpcOmTaskGraph.TaskGraph iGraphT; @@ -1841,7 +1835,8 @@ algorithm end matchcontinue; end BLS_getDependentGroups; -protected function BLS_mergeToTargetSize"collect the largest groups of nodes that are smaller than the targetSize" +protected function BLS_mergeToTargetSize " + Collect the largest groups of nodes that are smaller than the targetSize." input list nodesIn; input list costsIn; input Real targetSize; @@ -1899,16 +1894,16 @@ algorithm end matchcontinue; end BLS_mergeToTargetSize; -protected function realSum"accumulates the real values in the list. -author:Waurich TUD 2014-07" +protected function realSum "author: Waurich TUD 2014-07 + Accumulates the real values in the list." input list reals; output Real sum; algorithm sum := List.fold(reals,realAdd,0.0); end realSum; -public function deleteIntListMembers"deletes all entries of lst2 in lst1. -author: Waurich TUD 2014-07" +public function deleteIntListMembers "author: Waurich TUD 2014-07 + Deletes all entries of lst2 in lst1." input list lst1; input list lst2; output list lstOut; @@ -1916,11 +1911,11 @@ algorithm (_,lstOut,_):= List.intersection1OnTrue(lst1,lst2,intEq); end deleteIntListMembers; + //----------------- // Level Scheduling //----------------- -public function createLevelSchedule - "author: marcusw +public function createLevelSchedule "author: marcusw Creates a level scheduling for the given graph." input HpcOmTaskGraph.TaskGraph iGraph; input HpcOmTaskGraph.TaskGraphMeta iMeta; @@ -1963,7 +1958,8 @@ algorithm oLevelTaskLists := taskList :: iLevelTaskLists; end createLevelScheduleForLevel; -protected function getLevelAssignment"folding function to get a levelassignment for each node" +protected function getLevelAssignment " + Folding function to get a levelassignment for each node." input list level; input tuple> tplIn; // output tuple> tplOut; @@ -1976,10 +1972,11 @@ algorithm tplOut := (idx+1,ass); end getLevelAssignment; -protected function makeCalcLevelParTaskLst "makes a parallel list of CALCTASK_LEVEL-Tasks out of the given lists of simEqSyslst and corresponding node list" +protected function makeCalcLevelParTaskLst " + Makes a parallel list of CALCTASK_LEVEL-Tasks out of the given lists of simEqSyslst and corresponding node list." input list iNodeIdc; - input array> iSccSimEqMapping; //Maps each scc to a list of simEqs - input array> iNodeSccMapping; // maps nodeIdx to a list of SCCs + input array> iSccSimEqMapping; // Maps each scc to a list of simEqs + input array> iNodeSccMapping; // Maps nodeIdx to a list of SCCs output HpcOmSimCode.TaskList oTasks; protected list> tmpList = {}; @@ -1991,22 +1988,24 @@ algorithm oTasks := makeCalcLevelParTaskLstForMergedNodes(tmpList, iSccSimEqMapping, iNodeSccMapping); end makeCalcLevelParTaskLst; -protected function makeCalcLevelParTaskLstForMergedNodes "makes a parallel list of CALCTASK_LEVEL-Tasks out of the given lists of simEqSyslst and corresponding node list" +protected function makeCalcLevelParTaskLstForMergedNodes " + Makes a parallel list of CALCTASK_LEVEL-Tasks out of the given lists of simEqSyslst and corresponding node list." input list> iNodeIdc; - input array> iSccSimEqMapping; //Maps each scc to a list of simEqs - input array> iNodeSccMapping; // maps nodeIdx to a list of SCCs + input array> iSccSimEqMapping; // Maps each scc to a list of simEqs + input array> iNodeSccMapping; // Maps nodeIdx to a list of SCCs output HpcOmSimCode.TaskList oTasks; protected list tmpList; algorithm - tmpList := List.map(iNodeIdc, function makeCalcLevelTask(iNodeSccMapping=iNodeSccMapping, iSccSimEqMapping=iSccSimEqMapping)); + tmpList := List.map(iNodeIdc, function makeCalcTaskLevel(iNodeSccMapping=iNodeSccMapping, iSccSimEqMapping=iSccSimEqMapping)); oTasks := HpcOmSimCode.PARALLELTASKLIST(tmpList); end makeCalcLevelParTaskLstForMergedNodes; -protected function makeCalcLevelTask" makes a CALCTASK_LEVEL for the given list of SimEqSys and a nodeIdx" +protected function makeCalcTaskLevel " + Makes a CALCTASK_LEVEL for the given list of SimEqSys and a nodeIdx." input list iNodeIdc; - input array> iNodeSccMapping; // maps nodeIdx to a list of SCCs - input array> iSccSimEqMapping; //maps SCC-index to a list of sim-equations + input array> iNodeSccMapping; // Maps nodeIdx to a list of SCCs + input array> iSccSimEqMapping; // Maps SCC-index to a list of sim-equations output HpcOmSimCode.Task oTask; protected list simEqs = {}; @@ -2020,9 +2019,10 @@ algorithm end for; end for; oTask := HpcOmSimCode.CALCTASK_LEVEL(simEqs,iNodeIdc,NONE()); -end makeCalcLevelTask; +end makeCalcTaskLevel; -public function makeCalcTask" makes a CALCTASK for the given list of SimEqSys and a nodeIdx" +public function makeCalcTask " + Makes a CALCTASK for the given list of SimEqSys and a nodeIdx." input list simEqs; input Integer node; input Integer threadIdx; @@ -2031,8 +2031,8 @@ algorithm taskOut := HpcOmSimCode.CALCTASK(0,node,1.0,1.0,threadIdx,simEqs); end makeCalcTask; -protected function arrayIntIsNegative"outputs true if the indexed value in the array is lower than 0 -author:Waurich TUD 2014-07" +protected function arrayIntIsNegative "author: Waurich TUD 2014-07 + Outputs true if the indexed value in the array is lower than 0." input Integer node; input array ass; output Boolean isAss; @@ -2040,8 +2040,7 @@ algorithm isAss := intLt(arrayGet(ass,node),0); end arrayIntIsNegative; -protected function dumpLevelSchedule "function printLevelSchedule - author: marcusw +protected function dumpLevelSchedule "author: marcusw Helper function to print one level." input HpcOmSimCode.TaskList iLevelInfo; input Integer iLevel; @@ -2069,11 +2068,11 @@ algorithm end match; end dumpLevelSchedule; + //----------------------- // Fixed level Scheduling //----------------------- -public function createFixedLevelSchedule - "author: marcusw +public function createFixedLevelSchedule "author: marcusw Creates a level scheduling for the given graph, but assign the tasks to the threads." input HpcOmTaskGraph.TaskGraph iGraph; input HpcOmTaskGraph.TaskGraphMeta iMeta; @@ -2107,8 +2106,7 @@ algorithm oMeta := iMeta; end createFixedLevelSchedule; -protected function createFixedLevelScheduleForLevel - "author: marcusw +protected function createFixedLevelScheduleForLevel "author: marcusw Handles all tasks of one level. The advice-list is updated during calculation." input list iTasksOfLevel; input array> iAdviceList; @@ -2211,8 +2209,7 @@ algorithm oThreadTasks := arrayUpdate(iThreadTasks, threadIdx, threadTasks); end createFixedLevelScheduleForTask; -protected function createFixedLevelScheduleForTask0 - "author: marcusw +protected function createFixedLevelScheduleForTask0 "author: marcusw Update the given advice list, by adding the iThreadAdvice to the successor-task-entry." input Integer iSuccessor; input Integer iThreadAdvice; @@ -2226,8 +2223,7 @@ algorithm oAdviceList := arrayUpdate(iAdviceList, iSuccessor, adviceElem); end createFixedLevelScheduleForTask0; -protected function flattenAdviceList - "author: marcusw +protected function flattenAdviceList "author: marcusw Flatten the given advice list and order the entries regarding their occurrence count. For example: {2,3,1,1,2,2} -> {2,1,3}" input list iAdviceList; @@ -2297,8 +2293,7 @@ algorithm oRes := intGt(val1, val2); end intTpl22Gt; -protected function getBestFittingThread - "author: marcusw +protected function getBestFittingThread "author: marcusw Get the optimal thread for the task, regarding the given advice list." input list iAdviceList; //advice list of the task - the list is traversed from front to back, until a suitable thread is found input Real iLevelExecCosts; //sum of all execosts @@ -2358,11 +2353,11 @@ algorithm end match; end getFirstReadyThread0; + //--------------------------- -// Task dependency Scheduling +// Task Dependency Scheduling //--------------------------- -public function createTaskDepSchedule "function createTaskDepSchedule - author: marcusw +public function createTaskDepSchedule "author: marcusw Creates a dynamic scheduling for OpenMP 4.0 task dependencies or Intel TBB graphs." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -2449,11 +2444,11 @@ algorithm oElem := ((task,childTasks)); end filterNodeLevelMapping; + //----------------- // Metis Scheduling //----------------- -public function createMetisSchedule - "author: marcusw +public function createMetisSchedule "author: marcusw Creates a scheduling by passing the arguments to metis." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -2550,8 +2545,8 @@ algorithm Array.updateElementListAppend(thread,{idx},procAss); end getProcAss; -protected function createMetisSchedule2"sorts the tasks in 2 causal lists. one prioritylist and another one that is appended to this one. -author: Waurich TUD 03-2015" +protected function createMetisSchedule2 "author: Waurich TUD 03-2015 + Sorts the tasks in 2 causal lists. one prioritylist and another one that is appended to this one." input list> levelNodes; input array priorityArr; input list prioLstIn; @@ -2578,8 +2573,7 @@ algorithm end matchcontinue; end createMetisSchedule2; -protected function isPrioNode" -author: Waurich TUD 03-2015" +protected function isPrioNode "author: Waurich TUD 03-2015" input Integer idx; input array prioArr; output Boolean isPrio; @@ -2587,8 +2581,8 @@ algorithm isPrio := intEq(1,arrayGet(prioArr,idx)); end isPrioNode; -protected function createMetisSchedule1"builds a priority array to mark tasks that have to be solved as early as possible -author: Waurich TUD 03-2015" +protected function createMetisSchedule1 "author: Waurich TUD 03-2015 + Builds a priority array to mark tasks that have to be solved as early as possible." input list taskIdcs; input array threadIds; // the assigned thread for each task input array> taskGraph; @@ -2630,8 +2624,7 @@ algorithm end matchcontinue; end createMetisSchedule1; -protected function arrayIntIsNotOne" -author: Waurich TUD 03-2015" +protected function arrayIntIsNotOne "author: Waurich TUD 03-2015" input Integer idx; input array arr; output Boolean isOne; @@ -2639,8 +2632,7 @@ algorithm isOne := intNe(1,arrayGet(arr,idx)); end arrayIntIsNotOne; -public function createHMetisSchedule "function createHMetisSchedule - author: marcusw +public function createHMetisSchedule "author: marcusw Creates a scheduling by passing the arguments to hmetis." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -2784,8 +2776,7 @@ algorithm _:=arrayUpdate(vwgt,node,realInt(rv)); end setVwgt; -protected function prepareMetis "function prepareMetis - author: mkloeppel +protected function prepareMetis "author: mkloeppel Create all arrays that are necessary to perform a clustering with metis." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -2887,11 +2878,11 @@ algorithm hewgts := listArray(l_hewgts); end preparehMetis; + //-------------------- // External Scheduling //TODO: Rename to Yed Scheduling //-------------------- -public function createExtSchedule "function createExtSchedule - author: marcusw +public function createExtSchedule "author: marcusw Creates a scheduling by reading the required informations from a graphml-file." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -3058,18 +3049,16 @@ algorithm end matchcontinue; end createExtSchedule1; + //--------------------------------- // Task Duplication-based Scheduler //--------------------------------- - -public function TDS_schedule"task duplication schedule by Samantha Ranaweera and Dharma P. Agrawal, -see: -'A Task Duplication Based Scheduling Algorithm for Heterogeneous Systems' -or -'A Scalable Task Duplication Based Scheduling Algorithm for Heterogeneous Systems' -including slight adaptations from my side, since in reality, nothing is exactly the same like the smart guys thought of. -notation: est:earliest starting time, ect: earliest completion time, last:latest allowable starting time, lact: latest allowable completion time, fpred:favourite predecessor -author: Waurich TUD 2015-05" +public function TDS_schedule "author: Waurich TUD 2015-05 + task duplication schedule by Samantha Ranaweera and Dharma P. Agrawal, + see: 'A Task Duplication Based Scheduling Algorithm for Heterogeneous Systems' + or 'A Scalable Task Duplication Based Scheduling Algorithm for Heterogeneous Systems' + including slight adaptations from my side, since in reality, nothing is exactly the same like the smart guys thought of. + notation: est:earliest starting time, ect: earliest completion time, last:latest allowable starting time, lact: latest allowable completion time, fpred:favourite predecessor" input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; input Integer numProc; @@ -3197,8 +3186,8 @@ algorithm end match; end insertLocksInSchedule1; -protected function TDS_schedule1"takes the initial Cluster and compactes or duplicates them to the given number of threads. -author:Waurich TUD 2014-05" +protected function TDS_schedule1 "author: Waurich TUD 2014-05 + Takes the initial Cluster and compactes or duplicates them to the given number of threads." input list> clustersIn; input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraph iTaskGraphT; @@ -3350,8 +3339,8 @@ algorithm end matchcontinue; end TDS_schedule1; -protected function TDS_replaceSimEqSysIdxsInSchedule"replaces the simEqSys indexes with the assigned ones in a schedule -author:Waurich TUD 2014-07" +protected function TDS_replaceSimEqSysIdxsInSchedule "author: Waurich TUD 2014-07 + Replaces the simEqSys indexes with the assigned ones in a schedule." input HpcOmSimCode.Schedule scheduleIn; input array assIn; output HpcOmSimCode.Schedule scheduleOut; @@ -3370,8 +3359,8 @@ algorithm end match; end TDS_replaceSimEqSysIdxsInSchedule; -protected function TDS_replaceSimEqSysIdxsInTask"replaces the simEqSys indexes with the assigned ones in a tasks -author:Waurich TUD 2014-07" +protected function TDS_replaceSimEqSysIdxsInTask "author: Waurich TUD 2014-07 + Replaces the simEqSys indexes with the assigned ones in a tasks." input HpcOmSimCode.Task taskIn; input array assIn; output HpcOmSimCode.Task taskOut; @@ -3389,8 +3378,8 @@ algorithm end matchcontinue; end TDS_replaceSimEqSysIdxsInTask; -protected function TDS_replaceSimEqSysIdxsInTaskLst"replaces the simEqSys indexes with the assigned ones in a list of tasks -author:Waurich TUD 2014-07" +protected function TDS_replaceSimEqSysIdxsInTaskLst "author: Waurich TUD 2014-07 + Replaces the simEqSys indexes with the assigned ones in a list of tasks." input list taskLstIn; input array assIn; output list taskLstOut; @@ -3398,8 +3387,8 @@ algorithm taskLstOut := List.map1(taskLstIn,TDS_replaceSimEqSysIdxsInTask,assIn); end TDS_replaceSimEqSysIdxsInTaskLst; -protected function TDS_assignNewSimEqSysIdxs"replaces the simEqSys indexes with new ones and built an assignemnt in the simCode -author:Waurich TUD 2014-07" +protected function TDS_assignNewSimEqSysIdxs "author: Waurich TUD 2014-07 + Replaces the simEqSys indexes with new ones and built an assignemnt in the simCode." input SimCode.SimCode simCodeIn; input array idxAssIn; output SimCode.SimCode simCodeOut = simCodeIn; @@ -3448,8 +3437,8 @@ algorithm idxAssOut := ass; end TDS_assignNewSimEqSysIdxs; -protected function TDS_replaceSimEqSysIndex"replaces the index with the assigned index in a simEqSystem -author:Waurich TUD 2014-07" +protected function TDS_replaceSimEqSysIndex "author: Waurich TUD 2014-07 + Replaces the index with the assigned index in a simEqSystem." input SimCode.SimEqSystem simEqIn; input array assIn; output SimCode.SimEqSystem simEqOut; @@ -3494,8 +3483,8 @@ algorithm end matchcontinue; end TDS_replaceSimEqSysIndex; -protected function TDS_replaceSimEqSysIndexWithUpdate"replaces the index with the new index and updates the assignment in a simEqSystem -author:Waurich TUD 2014-07" +protected function TDS_replaceSimEqSysIndexWithUpdate "author: Waurich TUD 2014-07 + Replaces the index with the new index and updates the assignment in a simEqSystem." input SimCode.SimEqSystem simEqIn; input tuple> tplIn; output SimCode.SimEqSystem simEqOut; @@ -3546,8 +3535,8 @@ algorithm end matchcontinue; end TDS_replaceSimEqSysIndexWithUpdate; -protected function TDS_replaceSimEqSysIdxInJacobianMatrixWithUpdate"replaces the index with the new index and updates the assignment one in a jacobian matrix. -author:Waurich TUD 2014-07" +protected function TDS_replaceSimEqSysIdxInJacobianMatrixWithUpdate "author: Waurich TUD 2014-07 + Replaces the index with the new index and updates the assignment one in a jacobian matrix." input Option jacIn; input tuple> tplIn; output Option jacOut; @@ -3571,8 +3560,8 @@ algorithm end matchcontinue; end TDS_replaceSimEqSysIdxInJacobianMatrixWithUpdate; -protected function TDS_replaceSimEqSysIdxInJacobianColumnWithUpdate"replaces the index with the new index and updates the assignment one in a jacobian column. -author:Waurich TUD 2014-07" +protected function TDS_replaceSimEqSysIdxInJacobianColumnWithUpdate "author: Waurich TUD 2014-07 + Replaces the index with the new index and updates the assignment one in a jacobian column." input SimCode.JacobianColumn jacIn; input tuple> tplIn; output SimCode.JacobianColumn jacOut; @@ -3593,8 +3582,8 @@ algorithm end matchcontinue; end TDS_replaceSimEqSysIdxInJacobianColumnWithUpdate; -protected function TDS_replaceSimEqSysIdxInJacobianMatrix"replaces the index with the assigned one in a jacobian matrix. -author:Waurich TUD 2014-07" +protected function TDS_replaceSimEqSysIdxInJacobianMatrix "author: Waurich TUD 2014-07 + Replaces the index with the assigned one in a jacobian matrix." input Option jacIn; input array assIn; output Option jacOut; @@ -3617,8 +3606,8 @@ algorithm end matchcontinue; end TDS_replaceSimEqSysIdxInJacobianMatrix; -protected function TDS_replaceSimEqSysIdxInJacobianColumn"replaces the index with the assigned one in a jacobian column. -author:Waurich TUD 2014-07" +protected function TDS_replaceSimEqSysIdxInJacobianColumn "author: Waurich TUD 2014-07 + Replaces the index with the assigned one in a jacobian column." input SimCode.JacobianColumn jacIn; input array assIn; output SimCode.JacobianColumn jacOut; @@ -3638,7 +3627,8 @@ algorithm end matchcontinue; end TDS_replaceSimEqSysIdxInJacobianColumn; -protected function TDS_updateModelInfo"updated information in the SimCode.ModelInfo e.g.the number of variables,numLS, numNLS," +protected function TDS_updateModelInfo " + updated information in the SimCode.ModelInfo e.g.the number of variables,numLS, numNLS," input SimCode.SimCode simCodeIn; input tuple idcs; output SimCode.SimCode simCodeOut = simCodeIn; @@ -3664,8 +3654,8 @@ algorithm simCodeOut.modelInfo := modelInfo; end TDS_updateModelInfo; -protected function TDS_duplicateTasks"traverses the clusters, duplicate the tasks that have been assigned to another thread before. -author: Waurich TUD 2014-05" +protected function TDS_duplicateTasks "author: Waurich TUD 2014-05 + Traverses the clusters, duplicate the tasks that have been assigned to another thread before." input list> clustersIn; input array taskAssIn; input array> procAssIn; @@ -3729,8 +3719,8 @@ algorithm end match; end TDS_duplicateTasks; -protected function TDS_duplicateTasks1"traverses one cluster.No locks are added. -author: Waurich TUD 2014-05" +protected function TDS_duplicateTasks1 "author: Waurich TUD 2014-05 + Traverses one cluster. No locks are added." input list clusterIn; input list> allCluster; input BackendVarTransform.VariableReplacements replIn; @@ -3836,7 +3826,8 @@ algorithm end matchcontinue; end TDS_duplicateTasks1; -protected function TDS_duplicateTasks2"sets the information about the new task in simCode,dae,sccMapping ect." +protected function TDS_duplicateTasks2 " + Sets the information about the new task in simCode, dae, sccMapping, ect." input Integer node; input list> allCluster; input BackendVarTransform.VariableReplacements replIn; @@ -4050,8 +4041,8 @@ algorithm eqSysLstOut := List.fold(eqSystsIn,replaceSimEqSystemWithSameIndex,eqSysLstIn); end replaceSimEqSystemLstWithSameIndex; -protected function replaceSimEqSystemWithSameIndex"replaces the simEqSystem with the same index in the eqSysLstIn. -author.Waurich TUD 2014-06" +protected function replaceSimEqSystemWithSameIndex "author: Waurich TUD 2014-06 + Replaces the simEqSystem with the same index in the eqSysLstIn." input SimCode.SimEqSystem eqSysIn; input list eqSysLstIn; output list eqSysLstOut; @@ -4070,8 +4061,8 @@ algorithm end matchcontinue; end replaceSimEqSystemWithSameIndex; -protected function replaceSystemIndex"replaces the index of the linear system, the index of the non-linear system or the index of the mixed systems with the given values. -author: Waurich TUD 2014-04" +protected function replaceSystemIndex "author: Waurich TUD 2014-04 + Replaces the index of the linear system, the index of the non-linear system or the index of the mixed systems with the given values." input SimCode.SimEqSystem simEqSysIn; input tuple idcsIn;// lsIdx,nlsIdx,mIdx output SimCode.SimEqSystem simEqSysOut; @@ -4110,8 +4101,8 @@ algorithm end match; end replaceSystemIndex; -protected function replaceInSimEqSystemLst"performs replacements on a list of SimCode.SimEqSystems -author:Waurich TUD 2014-06" +protected function replaceInSimEqSystemLst "author: Waurich TUD 2014-06 + Performs replacements on a list of SimCode.SimEqSystems." input list simEqSysLstIn; input BackendVarTransform.VariableReplacements replIn; output list simEqSysLstOut; @@ -4120,8 +4111,8 @@ algorithm (simEqSysLstOut,changedOut) := List.map1_2(simEqSysLstIn,replaceExpsInSimEqSystem,replIn); end replaceInSimEqSystemLst; -protected function replaceExpsInSimEqSystem"performs replacements on a simEqSystem structure -author:Waurich TUD 2014-06" +protected function replaceExpsInSimEqSystem "author: Waurich TUD 2014-06 + Performs replacements on a simEqSystem structure." input SimCode.SimEqSystem simEqSysIn; input BackendVarTransform.VariableReplacements replIn; output SimCode.SimEqSystem simEqSysOut; @@ -4242,8 +4233,8 @@ algorithm end matchcontinue; end replaceExpsInSimEqSystem; -protected function replaceCrefInSimVar"performs replacements on a simVar structure. -author: Waurich TUD 2014-06" +protected function replaceCrefInSimVar "author: Waurich TUD 2014-06 + Performs replacements on a simVar structure." input SimCodeVar.SimVar simVarIn; input BackendVarTransform.VariableReplacements replIn; output SimCodeVar.SimVar simVarOut = simVarIn; @@ -4264,8 +4255,8 @@ algorithm end try; end replaceCrefInSimVar; -protected function replaceInSimJac"replaces the row of a simJac. -author:Waurich TUD 2014-04" +protected function replaceInSimJac "author: Waurich TUD 2014-04 + Replaces the row of a simJac." input tuple simJacRowIn; input BackendVarTransform.VariableReplacements replIn; output tuple simJacRowOut; @@ -4278,8 +4269,8 @@ algorithm simJacRowOut :=(int1,int2,simEqSys); end replaceInSimJac; -protected function TDS_getTaskAssignment"sets the assigned processor for each task. -author:Waurich TUD 2014-05" +protected function TDS_getTaskAssignment "author:Waurich TUD 2014-05 + Sets the assigned processor for each task." input Integer procIdx; input array> clusterArrayIn; input array taskAssIn; @@ -4291,9 +4282,9 @@ algorithm List.map2_0(procTasks,Array.updateIndexFirst,procIdx,taskAssIn); end TDS_getTaskAssignment; -protected function TDS_CompactClusters"performs compaction to the cluster set. the least crowded (lowest exe costs) cluster is merged with the crowded cluster and so on. -it is possible that several tasks are assigned to multiple threads. thats because duplication is needed. -author:Waurich TUD 2015-05" +protected function TDS_CompactClusters "author: Waurich TUD 2015-05 + Performs compaction to the cluster set. The least crowded (lowest exe costs) cluster is merged with the crowded cluster + and so on. It is possible that several tasks are assigned to multiple threads. Thats because duplication is needed." input list> clustersIn; input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -4319,8 +4310,8 @@ algorithm //print("mergedClustersOut:\n"+stringDelimitList(List.map(clustersOut,intListString),"\n")+"\n"); end TDS_CompactClusters; -protected function TDS_SortCompactClusters"sorts the tasks in the cluster to descending order of their tds level value. -author:Waurich TUD 2014-05" +protected function TDS_SortCompactClusters "author: Waurich TUD 2014-05 + Sorts the tasks in the cluster to descending order of their tds level value." input list clusterIn; input array tdsLevelIn; output list clusterOut; @@ -4335,8 +4326,8 @@ algorithm clusterOut :=List.map1(order,List.getIndexFirst,cluster); end TDS_SortCompactClusters; -protected function TDS_computeClusterCosts"accumulates the execution costs of all tasks in one cluster. -author:Waurich TUD 2014-05" +protected function TDS_computeClusterCosts "author: Waurich TUD 2014-05 + Accumulates the execution costs of all tasks in one cluster." input list clusters; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; output Real costs; @@ -4347,8 +4338,8 @@ algorithm costs := List.fold(nodeCosts,realAdd,0.0); end TDS_computeClusterCosts; -protected function TDS_InitialCluster"creates the initial Clusters for the task duplication scheduler. -author: waurich TUD 2014-05" +protected function TDS_InitialCluster "author: waurich TUD 2014-05 + Creates the initial Clusters for the task duplication scheduler." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraph iTaskGraphT; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -4366,8 +4357,8 @@ algorithm clustersOut := TDS_InitialCluster1(iTaskGraph,iTaskGraphT,iTaskGraphMeta,lastArrayIn,lactArrayIn,fpredArrayIn,rootNodes,taskAssignments,1,queue,{{}}); end TDS_InitialCluster; -protected function TDS_InitialCluster1"implementation of function TDS_InitialCluster. -author: waurich TUD 2014-05" +protected function TDS_InitialCluster1 "author: waurich TUD 2014-05 + Implementation of function TDS_InitialCluster." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraph iTaskGraphT; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -4461,7 +4452,8 @@ algorithm end matchcontinue; end TDS_InitialCluster1; -protected function TDSpredIsCritical"calculates the criteria if the predecessor is critical" +protected function TDSpredIsCritical " + Calculates the criteria if the predecessor is critical." input Integer node; input Integer pred; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -4477,8 +4469,8 @@ algorithm isCritical := realSub(lastNode,lactPred) <= commCosts; end TDSpredIsCritical; -protected function computeFavouritePred"gets the favourite Predecessors of each task. needed for the task duplication scheduler -author:Waurich TUD 2014-05" +protected function computeFavouritePred "author: Waurich TUD 2014-05 + Gets the favourite Predecessors of each task. Needed for the task duplication scheduler." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; input array ect; @@ -4494,8 +4486,8 @@ algorithm fpredOut := List.fold3(List.intRange(size),computeFavouritePred1,taskGraphT,iTaskGraphMeta,ect,fpred); end computeFavouritePred; -protected function computeFavouritePred1"folding function for computeFavouritePred to traverse all nodes and get their favourite predecessors -author:Waurich TUD 2014-05" +protected function computeFavouritePred1 "author: Waurich TUD 2014-05 + Folding function for computeFavouritePred to traverse all nodes and get their favourite predecessors." input Integer nodeIdx; input HpcOmTaskGraph.TaskGraph graphT; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -4530,12 +4522,12 @@ algorithm end matchcontinue; end computeFavouritePred1; + //--------------------------------- // Partition Scheduler //--------------------------------- - -public function createPartSchedule"puts every independent partition into one thread with respect to the number of available processors. -author: Waurich TUD 2015-02" +public function createPartSchedule "author: Waurich TUD 2015-02 + Puts every independent partition into one thread with respect to the number of available processors." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; input Integer numProc; @@ -4628,7 +4620,9 @@ algorithm taskMapOut := taskMapIn; end distributePartitions; -protected function assignPartitions"for every root node, assign all successing nodes to one partition. If we find an already assigned task from another partitions,replace all these tasks " +protected function assignPartitions " + For every root node, assign all successing nodes to one partition. If we find an already assigned task from another + partitions,replace all these tasks." input Integer rootNode; input HpcOmTaskGraph.TaskGraph graph; input tuple,array>,Integer> tplIn; // partitions, partitions-->tasks, currPartIdx> @@ -4664,7 +4658,8 @@ algorithm tplOut := (taskAss,partAss,idx+1); end assignPartitions; -protected function isUnAssigned"checks whether the task is already assigned(==-1)" +protected function isUnAssigned " + Checks whether the task is already assigned(==-1)." input Integer task; input array ass; output Boolean isUnass; @@ -4675,7 +4670,8 @@ algorithm isUnass := intEq(idx,-1); end isUnAssigned; -protected function reassignPartitions"if the task is one of the oldAss, replace it with newAss" +protected function reassignPartitions " + If the task is one of the oldAss, replace it with newAss." input tuple,Integer>> tplIn; //value, output tuple,Integer>> tplOut; protected @@ -4689,11 +4685,12 @@ algorithm tplOut := (value,(oldAss,newAss)); end reassignPartitions; + //--------------------------------- // SingleThread Schedule //--------------------------------- - -public function createSingleThreadSchedule"creates a schedule in which all tasks are computed in thread 1" +public function createSingleThreadSchedule " + Creates a schedule in which all tasks are computed in thread 1." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; input array> iSccSimEqMapping; @@ -4728,12 +4725,11 @@ end createSingleThreadSchedule; //--------------------------------- -// Modified Critical Path scheduler +// Modified Critical Path Scheduler //--------------------------------- - -public function createMCPschedule "scheduler Modified Critical Path. -computes the ALAP i.e. latest possible start time for every task. The task with the smallest values gets the highest priority. -author: Waurich TUD 2013-10 " +public function createMCPschedule "author: Waurich TUD 2013-10 + Scheduler Modified Critical Path. + Computes the ALAP i.e. latest possible start time for every task. The task with the smallest values gets the highest priority." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; input Integer numProc; @@ -4782,8 +4778,8 @@ algorithm oSchedule := setScheduleLockIds(schedule); // set unique lock ids end createMCPschedule; -protected function MCP_getTaskAssignment "gets the assignment which nodes is computed of which processor for the MCP algorithm. -author:Waurich TUD 2013-10" +protected function MCP_getTaskAssignment "author: Waurich TUD 2013-10 + Gets the assignment which nodes is computed of which processor for the MCP algorithm." input list orderIn; input array alapIn; input Integer numProc; @@ -4848,8 +4844,8 @@ algorithm end matchcontinue; end MCP_getTaskAssignment1; -protected function updateLockIdcsInThreadschedule "executes the given function on the lockIdc in THREADSCHEDULE. -author:Waurich TUD 2013-12" +protected function updateLockIdcsInThreadschedule "author: Waurich TUD 2013-12 + Executes the given function on the lockIdc in THREADSCHEDULE." input HpcOmSimCode.Schedule scheduleIn; input FuncType inFunc; input ArgType extraArg; @@ -4881,8 +4877,8 @@ algorithm end match; end updateLockIdcsInThreadschedule; -protected function traverseAndUpdateThreadsInSchedule "traverses all Threads in a schedule. -author: Waurich TUD 2013-12" +protected function traverseAndUpdateThreadsInSchedule "author: Waurich TUD 2013-12 + Traverses all Threads in a schedule." input HpcOmSimCode.Schedule scheduleIn; input FuncType funcIn; input ArgType extraArg; @@ -4916,8 +4912,8 @@ algorithm end match; end traverseAndUpdateThreadsInSchedule; -protected function createScheduleFromAssignments"creates the ThreadSchedule from the taskAssignment i.e. which task is computed in which thread. -author:Waurich TUD 2013-12" +protected function createScheduleFromAssignments "author:Waurich TUD 2013-12 + creates the ThreadSchedule from the taskAssignment i.e. which task is computed in which thread." input array taskAss; input array> procAss; input Option> orderOpt; @@ -5000,7 +4996,8 @@ algorithm end match; end createScheduleFromAssignments; -protected function setSimEqIdcsInTask"updates the eqIdcs from scc-Indexes to simEq-Indexes in calctasks " +protected function setSimEqIdcsInTask " + updates the eqIdcs from scc-Indexes to simEq-Indexes in calctasks" input HpcOmSimCode.Task taskIn; input array> SccSimEqMappingIn; output HpcOmSimCode.Task taskOut; @@ -5019,7 +5016,8 @@ algorithm end matchcontinue; end setSimEqIdcsInTask; -protected function setThreadIdxInTask"updates threadIdxs in calctasks " +protected function setThreadIdxInTask " + updates threadIdxs in calctasks" input HpcOmSimCode.Task taskIn; input Integer threadIdx; output HpcOmSimCode.Task taskOut; @@ -5073,8 +5071,8 @@ algorithm end match; end tasksEqual; -protected function removeLocksFromLockList "removes all locks from the list of locks. -author:Waurich TUD 2013-12" +protected function removeLocksFromLockList "author:Waurich TUD 2013-12 + removes all locks from the list of locks." input list lockIdsIn; input list lockTasks; output list lockIdsOut; @@ -5082,8 +5080,8 @@ algorithm (_,lockIdsOut,_) := List.intersection1OnTrue(lockIdsIn,lockTasks,tasksEqual); end removeLocksFromLockList; -protected function removeLocksFromThread "removes all lockTasks that are given in the locksLst from the thread. -author:Waurich TUD 2013-12" +protected function removeLocksFromThread "author:Waurich TUD 2013-12 + removes all lockTasks that are given in the locksLst from the thread." input list threadIn; input list lockLst; output list threadOut; @@ -5091,8 +5089,8 @@ algorithm (_,threadOut,_) := List.intersection1OnTrue(threadIn,lockLst,tasksEqual); end removeLocksFromThread; -protected function getSuperfluousLocks "gets the locks that are unnecessary. e.g. if a task has multiple parentTasks from one thread, we just need the lock from the last executed task. -author:Waurich TUD 2013-12" +protected function getSuperfluousLocks "author:Waurich TUD 2013-12 + gets the locks that are unnecessary. e.g. if a task has multiple parentTasks from one thread, we just need the lock from the last executed task." input list otherParentsIn; input Integer nodeIn; input array taskAssIn; @@ -5163,7 +5161,8 @@ algorithm mapLstOut := List.map1(mapLstIn,List.getIndexFirst,argLst); end mapListGet; -protected function listIndecesForValues "folding function: write the index in array[i] whereas i is inLst(i) " +protected function listIndecesForValues " + folding function: write the index in array[i] whereas i is inLst(i)" input Integer idx; input list lstIn; input array> arrayIn; @@ -5183,8 +5182,8 @@ end listIndecesForValues; // quicksort with order //--------------------------- -public function quicksortWithOrder "sorts a list of Reals with the quicksort algorithm and outputs an additional list with the changed order of the original indeces. -author: Waurich TUD 2013-11" +public function quicksortWithOrder "author: Waurich TUD 2013-11 + sorts a list of Reals with the quicksort algorithm and outputs an additional list with the changed order of the original indeces." input list lstIn; output list lstOut; output list orderOut; @@ -5265,8 +5264,8 @@ algorithm end match; end quicksortWithOrder1; -protected function getNextPivot "removes the pivot from the markedLst and computes a new one. -author:Waurich TUD 2013-11" +protected function getNextPivot "author:Waurich TUD 2013-11 + removes the pivot from the markedLst and computes a new one." input list lstIn; input list markedLstIn; input Integer pivotIdx; @@ -5296,8 +5295,8 @@ algorithm end match; end getNextPivot; -protected function getMemberOnTrueWithIdx "same as getMemberOnTrue, but with index of the found element and a Boolean, if the element was found.!function does not fail! -author:Waurich TUD 2013-11" +protected function getMemberOnTrueWithIdx "author:Waurich TUD 2013-11 + same as getMemberOnTrue, but with index of the found element and a Boolean, if the element was found.!function does not fail!" input Real inValue; input list inList; input CompFunc inCompFunc; @@ -5313,8 +5312,8 @@ algorithm (outElement,outIdx,found) := getMemberOnTrueWithIdx1(1,inValue,inList,inCompFunc); end getMemberOnTrueWithIdx; -public function getMemberOnTrueWithIdx1 "implementation of getMemberOnTrueWithIdx. -author:Waurich TUD 2013-11" +public function getMemberOnTrueWithIdx1 "author:Waurich TUD 2013-11 + implementation of getMemberOnTrueWithIdx." input Integer inIdx; input Real inValue; input list inList; @@ -5351,8 +5350,8 @@ algorithm end matchcontinue; end getMemberOnTrueWithIdx1; -protected function swapEntriesInList"swaps the entries given by the indeces. -author:Waurich TUD 2013-11" +protected function swapEntriesInList "author:Waurich TUD 2013-11 + swaps the entries given by the indeces." replaceable type ElementType subtypeof Any; input Integer idx1; input Integer idx2; @@ -5368,7 +5367,8 @@ algorithm lstOut := List.replaceAt(r2, idx1, lstTmp); end swapEntriesInList; -protected function getMedian3 "gets the median of the 3 reals and the info which of the inputs is the median" +protected function getMedian3 " + gets the median of the 3 reals and the info which of the inputs is the median" input Real r1; input Real r2; input Real r3; @@ -5386,9 +5386,9 @@ end getMedian3; // traverse the task graph bottoms up (beginning at the root nodes) //---------------------------- -protected function computeGraphValuesBottomUp "the graph is traversed bottom up -computes the earliest possible start time (As Soon As Possible) and the earliest completion time for every node in the task graph. -author:Waurich TUD 2014-05" +protected function computeGraphValuesBottomUp "author:Waurich TUD 2014-05 + the graph is traversed bottom up +computes the earliest possible start time (As Soon As Possible) and the earliest completion time for every node in the task graph." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; output array asapOut; //as-soon-as-possible times, taking communication costs into accout @@ -5409,7 +5409,8 @@ algorithm (asapOut,estOut,ectOut) := computeGraphValuesBottomUp1(rootNodes,iTaskGraph,taskGraphT,iTaskGraphMeta,asap,est,ect); end computeGraphValuesBottomUp; -protected function computeGraphValuesBottomUp1 "implementation of computeGraphValuesBottomUp" +protected function computeGraphValuesBottomUp1 " + implementation of computeGraphValuesBottomUp" input list parentsIn; input HpcOmTaskGraph.TaskGraph graph; input HpcOmTaskGraph.TaskGraph graphT; @@ -5438,7 +5439,8 @@ algorithm end match; end computeGraphValuesBottomUp1; -protected function computeGraphValuesBottomUp2 "implementation of computeGraphValuesBottomUp" +protected function computeGraphValuesBottomUp2 " + implementation of computeGraphValuesBottomUp" input Integer node; input HpcOmTaskGraph.TaskGraph graph; input HpcOmTaskGraph.TaskGraph graphT; @@ -5495,9 +5497,9 @@ end computeGraphValuesBottomUp2; // traverse the task graph top down (beginning at the leaf nodes) //---------------------------- -protected function computeGraphValuesTopDown "traverse the graph top down (the transposed graph bottom up) -computes the latest allowable start time (As Late As Possible) and the latest allowable completion time for every node in the task graph. -author:Waurich TUD 2013-10" +protected function computeGraphValuesTopDown "author:Waurich TUD 2013-10 + traverse the graph top down (the transposed graph bottom up) +computes the latest allowable start time (As Late As Possible) and the latest allowable completion time for every node in the task graph." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; output array alapOut; // = as-late-as-possble times, taking communication time between every node into account, used for mcp-scheduler @@ -5531,9 +5533,9 @@ algorithm tdsLevelOut := tdsLevel; end computeGraphValuesTopDown; -protected function computeGraphValuesTopDown1 "traverses the taskGraph topdown starting with the leaf nodes of the original non-transposed graph. This function was -introduced to break the tail recursion and remove the matchcontinue. -author: marcusw TUD 2015-12" +protected function computeGraphValuesTopDown1 "author: marcusw TUD 2015-12 + traverses the taskGraph topdown starting with the leaf nodes of the original non-transposed graph. This function was +introduced to break the tail recursion and remove the matchcontinue." input list nodesIn; input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraph iTaskGraphT; @@ -5560,8 +5562,8 @@ algorithm //print("Alaps: {" + stringDelimitList(arrayList(Array.map(alap, realString)), ",") + "}\n"); end computeGraphValuesTopDown1; -protected function computeGraphValuesTopDown2 "traverses the taskGraph topdown starting with the leaf nodes of the original non-transposed graph. -author: Waurich TUD 2013-10" +protected function computeGraphValuesTopDown2 "author: Waurich TUD 2013-10 + traverses the taskGraph topdown starting with the leaf nodes of the original non-transposed graph." input list nodesIn; input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraph iTaskGraphT; @@ -5677,8 +5679,8 @@ algorithm end match; end dumpSchedule; -public function analyseScheduledTaskGraph"functions to analyse the scheduled task graph can be applied in here. -author:Waurich TUD 2013-12" +public function analyseScheduledTaskGraph "author:Waurich TUD 2013-12 + functions to analyse the scheduled task graph can be applied in here." input HpcOmSimCode.Schedule scheduleIn; input Integer numProcIn; input HpcOmTaskGraph.TaskGraph taskGraphIn; @@ -5807,8 +5809,8 @@ algorithm printPredictedExeTimeInfo(serTime,parTime,speedUp,speedUpMax,iNumProc); end analyseScheduledTaskGraphLevel; -protected function getLevelParallelTime"computes the the time for the parallel computation of a parallel section -author:Waurich TUD 2014-06" +protected function getLevelParallelTime "author:Waurich TUD 2014-06 + computes the the time for the parallel computation of a parallel section" input HpcOmSimCode.TaskList iLevelTaskList; input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -5824,8 +5826,8 @@ algorithm oLevelCost := Array.fold(workload,realMax,0.0); end getLevelParallelTime; -protected function getLevelParallelTime1"helper function for getLevelParallelTime. distributes the current section to the thread with the least workload -author:Waurich TUD 2014-06" +protected function getLevelParallelTime1 "author:Waurich TUD 2014-06 + helper function for getLevelParallelTime. distributes the current section to the thread with the least workload" input HpcOmSimCode.Task iTask; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; input array iThreadWorkLoad; @@ -5905,9 +5907,9 @@ algorithm end match; end getLevelTaskCosts; -public function predictExecutionTime "computes the theoretically execution time for the serial simulation and the parallel. a speedup ratio is determined by su=serTime/parTime. -the max speedUp is computed via the serTime/criticalPathCosts. -author:Waurich TUD 2013-11" +public function predictExecutionTime "author:Waurich TUD 2013-11 + computes the theoretically execution time for the serial simulation and the parallel. a speedup ratio is determined by su=serTime/parTime. +the max speedUp is computed via the serTime/criticalPathCosts." input HpcOmSimCode.Schedule scheduleIn; input Option cpCostsOption; input Integer numProc; @@ -5939,8 +5941,8 @@ algorithm speedUpMaxOut := speedUpMax; end predictExecutionTime; -public function printPredictedExeTimeInfo "function to print the information about the predicted execution times. -author:Waurich TUD 2013-11" +public function printPredictedExeTimeInfo "author:Waurich TUD 2013-11 + function to print the information about the predicted execution times." input Real serTime; input Real parTime; input Real speedUp; @@ -5976,8 +5978,8 @@ algorithm end matchcontinue; end printPredictedExeTimeInfo; -public function getSerialExecutionTime "computes thes serial execution time by summing up all exeCosts of all tasks. -author:Waurich TUD 2013-11" +public function getSerialExecutionTime "author:Waurich TUD 2013-11 + computes thes serial execution time by summing up all exeCosts of all tasks." input HpcOmTaskGraph.TaskGraphMeta taskGraphMetaIn; output Real serialTimeOut; protected @@ -5994,8 +5996,8 @@ algorithm serialTimeOut := List.fold(exeCostsReal,realAdd,0.0); end getSerialExecutionTime; -protected function getFinishingTimesForSchedule "computes the finishing times for the schedule. Works not for empty systems!!! -author:Waurich TUD 2013-11" +protected function getFinishingTimesForSchedule "author:Waurich TUD 2013-11 + computes the finishing times for the schedule. Works not for empty systems!!!" input HpcOmSimCode.Schedule scheduleIn; input Integer numProc; input HpcOmTaskGraph.TaskGraph taskGraphIn; @@ -6046,8 +6048,8 @@ algorithm end matchcontinue; end getFinishingTimesForSchedule; -protected function getTimeFinishedOfLastTask "get the timeFinished of the last task of a thread. if the thread is empty its -1.0. -author:Waurich TUD 2013-11" +protected function getTimeFinishedOfLastTask "author:Waurich TUD 2013-11 + get the timeFinished of the last task of a thread. if the thread is empty its -1.0." input list threadTasksIn; output Real finTimeOut; algorithm @@ -6068,8 +6070,8 @@ algorithm end matchcontinue; end getTimeFinishedOfLastTask; -protected function computeTimeFinished "traverses all threads bottoms up. -author:Waurich TUD 2013-11" +protected function computeTimeFinished "author:Waurich TUD 2013-11 + traverses all threads bottoms up." input array> threadTasksIn; //updated input array taskIdcsIn; input Integer threadIdxIn; @@ -6095,8 +6097,8 @@ algorithm end while; end computeTimeFinished; -protected function computeTimeFinished1 "traverses all threads bottoms up. -author:Waurich TUD 2013-11" +protected function computeTimeFinished1 "author:Waurich TUD 2013-11 + traverses all threads bottoms up." input array> threadTasksIn; //updated input array taskIdcsIn; //const input Integer threadIdxIn; @@ -6163,9 +6165,9 @@ algorithm end matchcontinue; end computeTimeFinished1; -protected function getNextThreadIdx "computes the index of the next thread that should be analysed. -The closed threads are not possible and if the last thread is input, the first is chosen. -author:Waurich TUD 2013-11" +protected function getNextThreadIdx "author:Waurich TUD 2013-11 + computes the index of the next thread that should be analysed. +The closed threads are not possible and if the last thread is input, the first is chosen." input Integer threadId; input list closedThreads; input Integer numThreads; @@ -6180,8 +6182,8 @@ algorithm nextThreadOut := if isClosed then getNextThreadIdx(nextThread, closedThreads, numThreads) else nextThread; end getNextThreadIdx; -protected function updateFinishingTime "updates the finishing times. -author:Waurich TUD 2013-11" +protected function updateFinishingTime "author:Waurich TUD 2013-11 + updates the finishing times." input HpcOmSimCode.Task taskIn; input Integer taskIdxIn; input Integer threadIdxIn; @@ -6222,8 +6224,8 @@ algorithm end match; end updateFinishingTime; -protected function updateFinishingTime1 "folding function that checks whether the parentNode is in the checkedNodes and looks for the task with the latest finishingTime. -author:Waurich TUD 2013-11" +protected function updateFinishingTime1 "author:Waurich TUD 2013-11 + folding function that checks whether the parentNode is in the checkedNodes and looks for the task with the latest finishingTime." input Integer parentIdx; input array checkedTaskIn; input tuple,HpcOmSimCode.Task> tplIn; @@ -6244,8 +6246,8 @@ algorithm tplOut := (parentLst,task); end updateFinishingTime1; -protected function computeFinishingTimeForOneTask "updated the timeFinished in the calcTask and adds the task to the checkedTasks. -author: Waurich TUD 2013-11" +protected function computeFinishingTimeForOneTask "author: Waurich TUD 2013-11 + updated the timeFinished in the calcTask and adds the task to the checkedTasks." input tuple>,array,Integer,Integer,HpcOmSimCode.Task,HpcOmTaskGraph.TaskGraphMeta> tplIn; output tuple>,array> tplOut; algorithm @@ -6309,8 +6311,8 @@ algorithm end matchcontinue; end computeFinishingTimeForOneTask; -protected function getPredecessorCalcTask "gets the calctask before task at position in the thread. -author:Waurich TUD 2013-11" +protected function getPredecessorCalcTask "author:Waurich TUD 2013-11 + gets the calctask before task at position in the thread." input list threadIn; input Integer indexIn; output HpcOmSimCode.Task taskOut; @@ -6337,8 +6339,8 @@ algorithm end matchcontinue; end getPredecessorCalcTask; -protected function updateTimeFinished "replaces the timeFinished in the calcTask. -author:Waurich TUD 2013-11" +protected function updateTimeFinished "author:Waurich TUD 2013-11 + replaces the timeFinished in the calcTask." input HpcOmSimCode.Task taskIn; input Real timeFinishedIn; output HpcOmSimCode.Task taskOut; @@ -6354,8 +6356,8 @@ algorithm taskOut := HpcOmSimCode.CALCTASK(weighting,index,calcTime,timeFinishedIn,threadIdx,eqIdc); end updateTimeFinished; -protected function getTimeFinished "gets the timeFinished of a calcTask, if its not a calctask its -1.0. if its an emptyTask its 0.0 -author:Waurich TUD 2013-11" +protected function getTimeFinished "author:Waurich TUD 2013-11 + gets the timeFinished of a calcTask, if its not a calctask its -1.0. if its an emptyTask its 0.0" input HpcOmSimCode.Task taskIn; output Real finishingTime; algorithm @@ -6372,8 +6374,8 @@ algorithm end match; end getTimeFinished; -protected function getThreadId "gets the threadIdx of a calcTask, if its not a calctask its -1 -author:Waurich TUD 2013-11" +protected function getThreadId "author:Waurich TUD 2013-11 + gets the threadIdx of a calcTask, if its not a calctask its -1" input HpcOmSimCode.Task taskIn; output Integer threadId; algorithm @@ -6387,8 +6389,8 @@ algorithm end match; end getThreadId; -protected function getTaskIdx "gets the idx of the calcTask.if its no calcTask, then -1. -author: Waurich TUD 2013-11" +protected function getTaskIdx "author: Waurich TUD 2013-11 + gets the idx of the calcTask.if its no calcTask, then -1." input HpcOmSimCode.Task taskIn; output Integer idx; algorithm @@ -6402,8 +6404,8 @@ algorithm end match; end getTaskIdx; -protected function getTaskTypeString "Returns the type of the given task as string. - author: marcusw" +protected function getTaskTypeString "author: marcusw + Returns the type of the given task as string." input HpcOmSimCode.Task iTask; output String oTypeString; algorithm @@ -6418,8 +6420,8 @@ algorithm end match; end getTaskTypeString; -protected function isCalcTask "checks if the given task is a calcTask. -author:Waurich TUD 2013-11" +protected function isCalcTask "author:Waurich TUD 2013-11 + checks if the given task is a calcTask." input HpcOmSimCode.Task taskIn; output Boolean isCalc; algorithm @@ -6431,8 +6433,8 @@ algorithm end match; end isCalcTask; -protected function isEmptyTask "checks if the given task is an emptyTask. -author:Waurich TUD 2013-11" +protected function isEmptyTask "author:Waurich TUD 2013-11 + checks if the given task is an emptyTask." input HpcOmSimCode.Task taskIn; output Boolean isEmpty; algorithm @@ -6599,8 +6601,8 @@ end revertTaskList; // LockIdSetter //---------------- -protected function setScheduleLockIds "Function creates unique Ids for every tuple of out and ingoing locks - author: mhartung" +protected function setScheduleLockIds "author: mhartung + Function creates unique Ids for every tuple of out and ingoing locks" input HpcOmSimCode.Schedule iSchedule; output HpcOmSimCode.Schedule oSchedule; protected @@ -6670,7 +6672,8 @@ algorithm end replaceDepTasksInListByLockIds; -protected function findTaskWithLockId "Function returns a DepTask with the id regarding lockIds or the identity of the given task" +protected function findTaskWithLockId " + Function returns a DepTask with the id regarding lockIds or the identity of the given task" input array>> lockIds; input HpcOmSimCode.Task iTask; output HpcOmSimCode.Task oTask; @@ -6768,8 +6771,8 @@ algorithm end match; end convertFixedLevelScheduleToTaskListsForTask; -protected function printRealArray"prints the information of the ALAP array -author:Waurich TUD 2013-11" +protected function printRealArray "author:Waurich TUD 2013-11 + prints the information of the ALAP array" input array inArray; input String header; algorithm @@ -6804,9 +6807,9 @@ algorithm s := stringDelimitList(List.map(lstIn,intListString)," | "); end intListListString; -public function expandSchedule "increase the size of the scheduler datastructure from - iNumUsedProc to iNumProc, by adding empty task lists to the scheduler structure. - author:marcusw" +public function expandSchedule "author:marcusw + increase the size of the scheduler datastructure from + iNumUsedProc to iNumProc, by adding empty task lists to the scheduler structure." input Integer iNumProc; input Integer iNumUsedProc; input HpcOmSimCode.Schedule iSchedule; diff --git a/Compiler/BackEnd/HpcOmTaskGraph.mo b/Compiler/BackEnd/HpcOmTaskGraph.mo index 0b8776f063b..37f74ca8efb 100644 --- a/Compiler/BackEnd/HpcOmTaskGraph.mo +++ b/Compiler/BackEnd/HpcOmTaskGraph.mo @@ -113,7 +113,7 @@ end TaskGraphMeta; // Functions to build the task graph from the BLT structure //---------------------------------------------------------- -public function createTaskGraph "author: marcusw,waurich +public function createTaskGraph "author: marcusw, waurich Creates a task graph on scc-level." input BackendDAE.BackendDAE iDAE; input Boolean iAnalyzeParameters = false; //set this to true if the parameter information of task graph meta should be filled @@ -131,7 +131,7 @@ algorithm ((oGraph,oGraphData,_)) := List.fold(systs, function createTaskGraph0(iShared=shared, iAnalyzeParameters=iAnalyzeParameters), (graph,graphData,1)); end createTaskGraph; -public function createTaskGraph0 "author: marcusw,waurich +public function createTaskGraph0 "author: marcusw, waurich Creates a task graph out of the given system." input BackendDAE.EqSystem iSyst; //The input system which should be analysed input BackendDAE.Shared iShared; @@ -272,8 +272,8 @@ algorithm oNumOfComps := iNumOfComps + listLength(comps); end getNumberOfEqSystemComponents; -public function getEmptyTaskGraph "generates an empty TaskGraph and empty TaskGraphMeta for a graph with numComps nodes. -author: Waurich TUD 2013-06" +public function getEmptyTaskGraph "author: Waurich TUD 2013-06 + generates an empty TaskGraph and empty TaskGraphMeta for a graph with numComps nodes." input Integer numComps; input Integer numVars; input Integer numEqs; @@ -305,8 +305,8 @@ algorithm graphData := TASKGRAPHMETA(inComps,varCompMapping,eqCompMapping,compParamMapping,compNames,compDescs,exeCosts,commCosts,nodeMark,compInformations); end getEmptyTaskGraph; -public function copyTaskGraphMeta "copies the metadata to avoid overwriting the arrays. -author: Waurich TUD 2013-07" +public function copyTaskGraphMeta "author: Waurich TUD 2013-07 + Copies the metadata to avoid overwriting the arrays." input TaskGraphMeta graphDataIn; output TaskGraphMeta graphDataOut; protected @@ -335,8 +335,8 @@ algorithm graphDataOut := TASKGRAPHMETA(inComps1,varCompMapping1,eqCompMapping1,compParamMapping1,compNames1,compDescs1,exeCosts1,commCosts1,nodeMark1,compInformations1); end copyTaskGraphMeta; -protected function taskGraphAppend "appends a taskGraph system to an other taskGraph system.all indices will be numbered continuously. -author:Waurich TUD 2013-06" +protected function taskGraphAppend "author:Waurich TUD 2013-06 + Appends a taskGraph system to an other taskGraph system.all indices will be numbered continuously." input TaskGraph graph1In; input TaskGraphMeta graphData1In; input TaskGraph graph2In; @@ -387,7 +387,7 @@ algorithm graphDataOut := TASKGRAPHMETA(inComps2,varCompMapping2,eqCompMapping2,compParamMapping2,compNames2,compDescs2,exeCosts2,commCosts2,nodeMark2,compInformations2); end taskGraphAppend; -protected function modifyMapping "author: marcusw,waurich +protected function modifyMapping "author: marcusw, waurich Adds the given offset to the first and last tuple-element." input tuple iMappingTuple; input Integer iOffset; @@ -399,8 +399,8 @@ algorithm oMappingTuple := (i1+iOffset,i2,iOffset); end modifyMapping; -protected function updateCommCosts "updates the CommCosts to the enumerated indeces. -author: Waurich TUD 2013-07" +protected function updateCommCosts "author: Waurich TUD 2013-07 + updates the CommCosts to the enumerated indeces." input Communications commCostsIn; input Integer idxOffset; output Communications commCostsOut; @@ -408,8 +408,8 @@ algorithm commCostsOut := List.map1(commCostsIn,updateCommCosts1,idxOffset); end updateCommCosts; -protected function updateCommCosts1 "adds the idxOffset to the child node index. -author: Waurich TUD 2013-07" +protected function updateCommCosts1 "author: Waurich TUD 2013-07 + Adds the idxOffset to the child node index." input Communication commCostsIn; input Integer idxOffset; output Communication commCostsOut; @@ -423,8 +423,8 @@ algorithm commCostsOut := COMMUNICATION(numberOfVars,integerVars,floatVars,booleanVars,stringVars,childNode,requiredTime); end updateCommCosts1; -protected function updateTaskGraphSystem "map function to add the indices in the taskGraph system to the number of nodes of the previous system. -author:Waurich TUD 2013-07" +protected function updateTaskGraphSystem "author: Waurich TUD 2013-07 + map function to add the indices in the taskGraph system to the number of nodes of the previous system." input list graphRowIn; input Integer idxOffset; output list graphRowOut; @@ -432,7 +432,7 @@ algorithm graphRowOut := List.map1(graphRowIn,intAdd,idxOffset); end updateTaskGraphSystem; -protected function createTaskGraph1 "author: marcusw,waurich +protected function createTaskGraph1 "author: marcusw, waurich Appends the task-graph information for the given StrongComponent to the given graph." input BackendDAE.StrongComponent iComponent; input tuple iSystInfo; // in very compact form @@ -542,8 +542,8 @@ algorithm oCommCosts := arrayUpdate(iCommCosts, sourceSccIdx, tmpComm::oldComms); end updateCommCostBySccRef1; -protected function fillAdjacencyList "append the child index to the rows indexed by the parent list. -author: waurich TUD 2013-06" +protected function fillAdjacencyList "author: waurich TUD 2013-06 + Append the child index to the rows indexed by the parent list." input array> adjLstIn; input Integer childNode; input Communications parentLst; //Communication-objects, with childNode = parentNodeIdx @@ -572,8 +572,8 @@ algorithm end matchcontinue; end fillAdjacencyList; -protected function getEquationStrings "gets the equation and the variable its solved for for every StrongComponent. index = component. entry = description -author:Waurich TUD 2013-06" +protected function getEquationStrings "author: Waurich TUD 2013-06 + Gets the equation and the variable its solved for for every StrongComponent. index = component. entry = description" input BackendDAE.StrongComponents iComps; input BackendDAE.EqSystem iEqSystem; output array eqDescsOut; @@ -585,8 +585,8 @@ algorithm eqDescsOut := listArray(eqDescs); end getEquationStrings; -protected function getEquationStrings2 "implementation for getEquationStrings -author:Waurich TUD 2013-06" +protected function getEquationStrings2 "author: Waurich TUD 2013-06 + Implementation for getEquationStrings" input BackendDAE.StrongComponent comp; input BackendDAE.EqSystem iEqSystem; input List iEqDesc; @@ -734,8 +734,8 @@ algorithm end matchcontinue; end getEquationStrings2; -public function getVarString "get the var string for a given variable. shortens the String. if necessary insert der operator -author:waurich TUD 2013-06" +public function getVarString "author: waurich TUD 2013-06 + Get the var string for a given variable. shortens the String. if necessary insert der operator." input BackendDAE.Var inVar; output String varString; algorithm @@ -765,8 +765,8 @@ algorithm end matchcontinue; end getVarString; -public function shortenVarString " terminates var string at : -author:Waurich TUD 2013-06" +public function shortenVarString "author: Waurich TUD 2013-06 + Terminates var string at :" input List iString; output List oString; protected @@ -776,8 +776,8 @@ algorithm (oString,_) := List.split(iString,pos); end shortenVarString; -protected function getEventNodes " gets the taskgraph nodes that are when-equations -author:Waurich TUD 2013-06" +protected function getEventNodes "author: Waurich TUD 2013-06 + Gets the taskgraph nodes that are when-equations" input BackendDAE.BackendDAE systIn; input array> eqCompMapping; output list eventNodes; @@ -791,8 +791,8 @@ algorithm eventNodes := getArrayTuple31(eqLst,eqCompMapping); end getEventNodes; -protected function getEventNodeEqs "gets the equation for the When-nodes. -author: Waurich TUD 2013-06" +protected function getEventNodeEqs "author: Waurich TUD 2013-06 + Gets the equation for the When-nodes." input BackendDAE.EqSystem systIn; input tuple,Integer> eventInfoIn; output tuple,Integer> eventInfoOut; @@ -813,8 +813,8 @@ algorithm eventInfoOut := (eventEqs,offset); end getEventNodeEqs; -protected function getEventNodeEqs1 "fold-function for getEventNodeEqs to compute the when equation in an eqSystem -author: Waurich TUD 2013-06" +protected function getEventNodeEqs1 "author: Waurich TUD 2013-06 + Fold-function for getEventNodeEqs to compute the when equation in an eqSystem." input BackendDAE.StrongComponents comps; input Integer offset; input list eventEqsIn; @@ -848,8 +848,8 @@ algorithm end matchcontinue; end getEventNodeEqs1; -protected function getArrayTuple31 "matches entries of list1 with the assigned values of assign to obtain the values -author:Waurich TUD 2013-06" +protected function getArrayTuple31 "author: Waurich TUD 2013-06 + Matches entries of list1 with the assigned values of assign to obtain the values." input list list1; input array> assign; output list list2Out; @@ -860,8 +860,8 @@ algorithm list2Out := List.map(tplLst,Util.tuple31); end getArrayTuple31; -protected function isWhenEquation "checks if the comp is of type SINGLEWHENEQUATION. -author:Waurich TUD 2013-06" +protected function isWhenEquation "author: Waurich TUD 2013-06 + checks if the comp is of type SINGLEWHENEQUATION." input BackendDAE.StrongComponent inComp; output Boolean isWhenEq; algorithm @@ -941,7 +941,7 @@ algorithm end match; end convertRefArrayToList; -protected function getUnsolvedVarsBySCC "author: marcusw,waurich +protected function getUnsolvedVarsBySCC "author: marcusw, waurich Returns all required variables which are not solved inside the given component." input BackendDAE.StrongComponent iComponent; input BackendDAE.IncidenceMatrix iIncidenceMatrix; @@ -1082,8 +1082,8 @@ algorithm end match; end getUnsolvedVarsBySCC2; -protected function removeEventVars "removes EventVars from the varList. -author:Waurich TUD 2013-06" +protected function removeEventVars "author: Waurich TUD 2013-06 + Removes EventVars from the varList." input list eventVarLst; input list> varLstIn; input Integer varIdx; @@ -1172,7 +1172,7 @@ algorithm end if; end compareTasksByExecTime; -protected function getVarsBySCC "author: marcusw,waurich +protected function getVarsBySCC "author: marcusw, waurich Returns all variables of all equations which are part of the component." input BackendDAE.StrongComponent iComponent; input BackendDAE.IncidenceMatrix iIncidenceMatrix; @@ -1275,7 +1275,8 @@ algorithm end tuple3ToString; protected function getVarsByEqns "author: marcusw - Returns all variables of the incidence matrix for the given equation and, if iAnalyzeParameters is set to true, all parameters that are used by the equations." + Returns all variables of the incidence matrix for the given equation and, if iAnalyzeParameters is set to true, + all parameters that are used by the equations." input list iEqnIdc; input BackendDAE.IncidenceMatrix iIncidenceMatrix; input BackendDAE.Variables iOrderedVars; @@ -1339,8 +1340,8 @@ algorithm end compareIntTuple2; protected function getVarEqCompMapping "author: marcusw - Create a mapping between variables / equations and strong-components. The returned array (one element for each variable) contains the - scc-index which solves the variable." + Create a mapping between variables / equations and strong-components. The returned array (one element for + each variable) contains the scc-index which solves the variable." input BackendDAE.StrongComponents components; input Integer iEqSysIdx; input Integer iVarIdxOffset; @@ -1355,7 +1356,7 @@ algorithm oeqCompMapping := ieqCompMapping; end getVarEqCompMapping; -protected function getVarEqCompMapping0 "author: marcusw,waurich +protected function getVarEqCompMapping0 "author: marcusw, waurich Updates all array elements which are solved in the given component. The array-elements will be set to iSccIdx." input BackendDAE.StrongComponent component; input array> varCompMapping; @@ -1434,7 +1435,7 @@ algorithm end getVarEqCompMapping0; public function getSccNodeMapping "author: marcusw - Create a mapping between the strong components and the graph nodes" + Create a mapping between the strong components and the graph nodes." input Integer iNumberOfSccs; input TaskGraphMeta iTaskGraphMeta; output array oMapping; //each scc (arrayIdx) is mapped to exactly one node (value) @@ -1449,7 +1450,7 @@ algorithm end getSccNodeMapping; protected function getSccNodeMapping0 "author: marcusw - Set all array entries of the given scc-list to the node-idx" + Set all array entries of the given scc-list to the node-idx." input list iCompsOfNode; input array iNodeMarks; input tuple, Integer> iArrayNodeIdx; @@ -1463,7 +1464,7 @@ algorithm end getSccNodeMapping0; protected function getSccNodeMapping1 "author: marcusw - Set all array entries of the given scc-list to the node-idx" + Set all array entries of the given scc-list to the node-idx." input Integer iCompIdx; input array iNodeMark; input tuple, Integer> iArrayNodeIdx; @@ -1486,9 +1487,9 @@ algorithm end matchcontinue; end getSccNodeMapping1; -protected function othersInTearComp " gets the remaining algebraic vars and equations from the torn block. -Remark: there can be more than 1 var per equation. -author:Waurich TUD 2013-06" +protected function othersInTearComp "author: Waurich TUD 2013-06 + Gets the remaining algebraic vars and equations from the torn block. + Remark: there can be more than 1 var per equation." input tuple> otherEqnVarTpl; input tuple,list> othersIn; output tuple,list> othersOut; @@ -1542,9 +1543,11 @@ end updateMappingTuple; // Functions to get the ODEsystem graph and adjacencyList //-------------------------------------------------------- -public function getOdeSystem "gets the graph and the adjacencyLst only for the ODEsystem. the der(states) and nodes that evaluate zerocrossings are the only branches of the task graph -attention: This function will overwrite the values of graphIn and graphDataIn with new values. If you want to hold the values of graphIn and graphDataIn, you have to duplicate them first! -author: Waurich TUD 2013-06" +public function getOdeSystem "author: Waurich TUD 2013-06 + Gets the graph and the adjacencyLst only for the ODEsystem. The der(states) and nodes that evaluate zerocrossings are + the only branches of the task graph. + Attention: This function will overwrite the values of graphIn and graphDataIn with new values. If you want to hold the + values of graphIn and graphDataIn, you have to duplicate them first!" input TaskGraph graphIn; input TaskGraphMeta graphDataIn; input BackendDAE.BackendDAE systIn; @@ -1569,8 +1572,8 @@ algorithm graphDataOdeOut := cutSystemData(graphDataIn,listAppend(cutNodes,{}),cutNodeChildren); end getOdeSystem; -protected function getAllStateNodes "folding function for getOdeSystem to traverse the equationsystems in the BackendDAE. -author: Waurich TUD 2013-07" +protected function getAllStateNodes "author: Waurich TUD 2013-07 + Folding function for getOdeSystem to traverse the equationsystems in the BackendDAE." input BackendDAE.EqSystem systIn; input array> varCompMapping; input array> inComps; @@ -1618,8 +1621,8 @@ algorithm end matchcontinue; end getAllStateNodes; -protected function getStates "gets the stateVars from the list of vars. -author:Waurich TUD 2013-06" +protected function getStates "author: Waurich TUD 2013-06 + Gets the stateVars from the list of vars." input list inVarLst; input list stateVarsIn; input Integer Idx; @@ -1645,8 +1648,8 @@ algorithm end matchcontinue; end getStates; -protected function cutTaskGraph "cuts every branch of the taskGraph that leads not to exceptNode. -author:Waurich TUD 2013-06" +protected function cutTaskGraph "author: Waurich TUD 2013-06 + Cuts every branch of the taskGraph that leads not to exceptNode." input TaskGraph graphIn; input list exceptNodes;// dont cut them and their predecessors input list whenNodes;// these can be removed even if they are predecessors of the exceptNodes @@ -1686,9 +1689,9 @@ algorithm end matchcontinue; end cutTaskGraph; -protected function cutTaskGraph2"uses a mapping between daeIdx and odeIdx (or for DAE-eqs -1) and builds up a new ode graph. -the ode nodes are mapped to new indeces and the dae eqs are skipped. -author:Waurich TUD 2013-04" +protected function cutTaskGraph2 "author: Waurich TUD 2013-04 + Uses a mapping between daeIdx and odeIdx (or for DAE-eqs -1) and builds up a new ode graph. + The ode nodes are mapped to new indeces and the dae eqs are skipped." input list daeNodes; input TaskGraph graphODE; input list cutNodesIn; @@ -1723,8 +1726,8 @@ algorithm end matchcontinue; end cutTaskGraph2; -protected function cutSystemData "updates the taskGraphMetaData regarding the removed nodes. -author:Waurich TUD 2013-07" +protected function cutSystemData "author: Waurich TUD 2013-07 + Updates the taskGraphMetaData regarding the removed nodes." input TaskGraphMeta graphDataIn; input list cutNodes; input list cutNodeChildren; @@ -1749,8 +1752,8 @@ algorithm graphDataOut :=TASKGRAPHMETA(inComps,varCompMapping,eqCompMapping,compParamMapping,compNames,compDescs,exeCosts,commCosts,nodeMark,compInformations); end cutSystemData; -protected function markRemovedNodes " folding function to set the entries in nodeMark to -1 for a removed component -author:Waurich TUD 2013-07" +protected function markRemovedNodes "author: Waurich TUD 2013-07 + Folding function to set the entries in nodeMark to -1 for a removed component." input Integer nodeMarkIdx; input list removedNodes; input array nodeMarkIn; @@ -1777,8 +1780,9 @@ algorithm end matchcontinue; end markRemovedNodes; -public function getCompInComps "finds the node in the current task graph which contains that component(index from the original task graph). nodeMark is needed to check for deleted components -author: Waurich TUD 2013-07" +public function getCompInComps "author: Waurich TUD 2013-07 + Finds the node in the current task graph which contains that component(index from the original task graph). + nodeMark is needed to check for deleted components." input Integer compIn; input Integer compIdx; // start idx for iteration input array> inComps; @@ -1821,8 +1825,8 @@ algorithm end matchcontinue; end getCompInComps; -public function getAllSuccessors"gets all successors including all childNodes of the childNodes... -author:Waurich TUD 2014-09" +public function getAllSuccessors "author: Waurich TUD 2014-09 + Gets all successors including all childNodes of the childNodes..." input list nodes; input TaskGraph graph; output list successors; @@ -1848,8 +1852,8 @@ algorithm end matchcontinue; end getAllSuccessors; -protected function getAllSuccessors2"gets all successors for the given nodes and repeats it for the successors until the end of the graph. -author: Waurich TUD 2014-09" +protected function getAllSuccessors2 "author: Waurich TUD 2014-09 + Gets all successors for the given nodes and repeats it for the successors until the end of the graph." input list nodes; input TaskGraph graph; input array alreadyVisited; @@ -1874,8 +1878,8 @@ algorithm end match; end getAllSuccessors2; -public function getChildNodes "gets the successor nodes for a list of parent nodes. -author: waurich TUD 2013-06" +public function getChildNodes "author: waurich TUD 2013-06 + Gets the successor nodes for a list of parent nodes." input array> adjacencyLstIn; input list parents; input list childLstTmp; @@ -1900,12 +1904,13 @@ algorithm end matchcontinue; end getChildNodes; -public function updateContinuousEntriesInList" updates the entries in a list -the entries in the list belong to a continuous series. -the deleteEntries have been previously removed from the array and the indices are adapted so that the new array consists again of continuous series of numbers.therefore the indices have to be smallen -e.g. updateContinuousEntriesInList({4,2,1,7,9},{3,6}) = {3,2,1,5,7}; -!! only for positive entries. -author: Waurich TUD 2013-07" +public function updateContinuousEntriesInList "author: Waurich TUD 2013-07 + Updates the entries in a list. + The entries in the list belong to a continuous series. + The deleteEntries have been previously removed from the array and the indices are adapted so that the new array consists + again of continuous series of numbers. Therefore the indices have to be smallen + e.g. updateContinuousEntriesInList({4,2,1,7,9},{3,6}) = {3,2,1,5,7}; + !! only for positive entries." input list lstIn; input list deleteEntriesIn; output list lstOut; @@ -1944,8 +1949,8 @@ algorithm end match; end setDeleteArr; -protected function removeContinuousEntries1" map function for removeContinuousEntries to update the indices. -author:Waurich TUD 2013-07." +protected function removeContinuousEntries1 "author: Waurich TUD 2013-07 + Map function for removeContinuousEntries to update the indices." input Integer entryIn; input array deleteEntriesIn; output Integer entryOut; @@ -1966,8 +1971,8 @@ algorithm end matchcontinue; end removeContinuousEntries1; -protected function deleteRowInAdjLst "deletes rows indexed by the rowDel from the adjacencyLst. -author:waurich TUD 2013 - 06" +protected function deleteRowInAdjLst "author: waurich TUD 2013-06 + Deletes rows indexed by the rowDel from the adjacencyLst." input array> adjacencyLstIn; input list rowsDel; output array> adjacencyLstOut; @@ -1987,7 +1992,8 @@ algorithm odeMapping := copiedRows; end deleteRowInAdjLst; -protected function arrayCopyRows "copies entries given by copiedRows from inArray to newArray" +protected function arrayCopyRows " + Copies entries given by copiedRows from inArray to newArray" input array> inArray; input array> newArray; input list copiedRows; @@ -2017,8 +2023,7 @@ algorithm end matchcontinue; end arrayCopyRows; -public function getRootNodes "function getRootNodes - author: marcusw,waurich +public function getRootNodes "author: marcusw, waurich Get all root nodes of the graph." input TaskGraph iTaskGraph; //the original graph output list rootsOut; @@ -2192,8 +2197,9 @@ end getNodesWithRefCountZero0; // Functions to get the event-graph //---------------------------------- -public function getZeroFuncsSystem "gets the graph containing all zero funcs. This graph is important for event handling. This function does not support nodes with more than one inComp! -author: marcusw" +public function getZeroFuncsSystem "author: marcusw + Gets the graph containing all zero funcs. This graph is important for event handling. This function does not + support nodes with more than one inComp!" input TaskGraph iTaskGraph; input TaskGraphMeta iTaskGraphMeta; input BackendDAE.BackendDAE iBackendDAE; @@ -2334,8 +2340,8 @@ algorithm (oTaskGraph,oTaskGraphMeta) := reverseTaskGraphIndices(zeroFuncTaskGraph,zeroFuncTaskGraphMeta); end getZeroFuncsSystem; -protected function reverseTaskGraphIndices"reverse the task ids in the task grah and accordingly in the inComps -author Waurich TUD 07-2015" +protected function reverseTaskGraphIndices "author Waurich TUD 07-2015 + Reverse the task ids in the task grah and accordingly in the inComps." input TaskGraph iTaskGraph; input TaskGraphMeta iTaskGraphMeta; output TaskGraph oTaskGraph; @@ -2369,8 +2375,8 @@ algorithm oTaskGraphMeta := TASKGRAPHMETA(inComps, varCompMapping, eqCompMapping, compParamMapping, compNames, compDescs, exeCosts, commCosts, nodeMark, compInformations); end reverseTaskGraphIndices; -protected function mapIntegers" Array.mapNoCopy_1 - function to replace integers with their mapping integer -author Waurich TUD 07-2015" +protected function mapIntegers "author Waurich TUD 07-2015 + Array.mapNoCopy_1 - function to replace integers with their mapping integer." input tuple,array> iTpl; output tuple,array> oTpl; protected @@ -2385,9 +2391,9 @@ algorithm oTpl := (oLst,map); end mapIntegers; -public function getEventSystem "gets the graph and the adjacencyLst only for the EventSystem. This means that all branches which leads to a node solving -a whencondition or another boolean condition will remain. -author: marcusw" +public function getEventSystem "author: marcusw + Gets the graph and the adjacencyLst only for the EventSystem. This means that all branches which leads to a node solving + a whencondition or another boolean condition will remain." input TaskGraph iTaskGraph; input TaskGraphMeta iTaskGraphMeta; input BackendDAE.BackendDAE iSyst; @@ -2424,8 +2430,8 @@ algorithm oTaskGraph := graphTmp; end getEventSystem; -protected function getComponentsOfZeroCrossing "get the scc-idc that use the given zero crossing. -author: marcusw" +protected function getComponentsOfZeroCrossing "author: marcusw + Get the scc-idc that use the given zero crossing." input BackendDAE.ZeroCrossing iZeroCrossing; input array iSimCodeEqCompMapping; output list oCompIdc; @@ -2445,8 +2451,8 @@ algorithm end matchcontinue; end getComponentsOfZeroCrossing; -protected function getComponentsIncludingTime "get the scc-idc that have an equation containing 'time' as variable -author: marcusw" +protected function getComponentsIncludingTime "author: marcusw + Get the scc-idc that have an equation containing 'time' as variable." input BackendDAE.EqSystem iSystem; input array> iEqCompMapping; input tuple> iOffsetResList; // @@ -2462,8 +2468,8 @@ algorithm oOffsetResList := (offset, resultList); end getComponentsIncludingTime; -protected function getComponentsIncludingTime0 "get the scc-idc that have an equation containing 'time' as variable -author: marcusw" +protected function getComponentsIncludingTime0 "author: marcusw + Get the scc-idc that have an equation containing 'time' as variable." input BackendDAE.Equation inEq; input tuple, array>, Integer> iOffsetResList; //> output BackendDAE.Equation outEq; @@ -2520,8 +2526,8 @@ algorithm end match; end getComponentsIncludingTime2; -protected function getDiscreteNodes " get the taskgraph nodes that solves discrete values -author: marcusw" +protected function getDiscreteNodes "author: marcusw + Get the taskgraph nodes that solves discrete values." input BackendDAE.BackendDAE systIn; input array> eqCompMapping; output list eventNodes; @@ -2992,12 +2998,13 @@ algorithm oMembership := (isPartOfODESystem, isPartOfZeroFuncSystem, isRemovedComponent); end getNodeMembershipByComponents; + //----------------- // Print functions //----------------- -public function printTaskGraph " prints the adjacencylist of the TaskGraph. -author:Waurich TUD 2013-07" +public function printTaskGraph "author: Waurich TUD 2013-07 + Prints the adjacencylist of the TaskGraph." input TaskGraph graphIn; protected list> graphLst; @@ -3011,8 +3018,8 @@ algorithm print("\n"); end printTaskGraph; -public function dumpAdjacencyLst " prints the adjacencyLst. -author:Waurich TUD 2013-07" +public function dumpAdjacencyLst "author: Waurich TUD 2013-07 + Prints the adjacencyLst." input list> inIntegerLstLst; input Integer rowIndex; algorithm @@ -3031,8 +3038,7 @@ algorithm end match; end dumpAdjacencyLst; -public function dumpAdjacencyRow -"author: PA +public function dumpAdjacencyRow "author: PA Helper function to dumpIncidenceMatrix2." input list inIntegerLst; algorithm @@ -3057,8 +3063,8 @@ algorithm end match; end dumpAdjacencyRow; -public function printTaskGraphMeta " prints all data from TaskGraphMeta. -author: Waurich TUD 2013-06" +public function printTaskGraphMeta "author: Waurich TUD 2013-06 + Prints all data from TaskGraphMeta." input TaskGraphMeta metaDataIn; protected array> inComps; @@ -3100,8 +3106,8 @@ algorithm print("\n"); end printTaskGraphMeta; -public function printInComps " prints the information about the assigned components to a taskgraph node. -author:Waurich TUD 2013-06" +public function printInComps "author:Waurich TUD 2013-06 + Prints the information about the assigned components to a taskgraph node." input array> iInComps; protected Integer nodeIdx; @@ -3114,34 +3120,36 @@ algorithm print("--------------------------------\n"); end printInComps; -public function printVarCompMapping " prints the information about how the vars are assigned to the graph nodes -author: Waurich TUD 2013-07 / marcusw" +public function printVarCompMapping "author: Waurich TUD 2013-07 / marcusw + Prints the information about how the vars are assigned to the graph nodes." input array> iVarCompMapping; protected Integer varIdx, comp, eqSysIdx, varOffset; algorithm for varIdx in 1:arrayLength(iVarCompMapping) loop ((comp,eqSysIdx,varOffset)) := arrayGet(iVarCompMapping,varIdx); - print("variable " + intString(varIdx-varOffset) + " (offset: " + intString(varOffset) + ") of equation system " + intString(eqSysIdx) + " is solved in component: " + intString(comp) + "\n"); + print("variable " + intString(varIdx-varOffset) + " (offset: " + intString(varOffset) + ") of equation system " + + intString(eqSysIdx) + " is solved in component: " + intString(comp) + "\n"); end for; print("--------------------------------\n"); end printVarCompMapping; -public function printEqCompMapping " prints the information about which equations are assigned to the graph nodes -author: Waurich TUD 2013-07 / marcusw" +public function printEqCompMapping "author: Waurich TUD 2013-07 / marcusw + Prints the information about which equations are assigned to the graph nodes." input array> iEqCompMapping; protected Integer eqIdx, comp, eqSysIdx, eqOffset; algorithm for eqIdx in 1:arrayLength(iEqCompMapping) loop ((comp,eqSysIdx,eqOffset)) := arrayGet(iEqCompMapping,eqIdx); - print("equation " + intString(eqIdx) + " (offset: " + intString(eqOffset) + ") of equation system " + intString(eqSysIdx) + " is computed in component: " + intString(comp) + "\n"); + print("equation " + intString(eqIdx) + " (offset: " + intString(eqOffset) + ") of equation system " + + intString(eqSysIdx) + " is computed in component: " + intString(comp) + "\n"); end for; print("--------------------------------\n"); end printEqCompMapping; -public function printCompParamMapping "prints the information which components contains which parameters -author: marcusw" +public function printCompParamMapping "author: marcusw + Prints the information which components contains which parameters." input array> iCompParamMapping; protected Integer compIdx; @@ -3154,8 +3162,8 @@ algorithm print("--------------------------------\n"); end printCompParamMapping; -protected function printComponentNames "prints the component names of the taskgraph components -author: Waurich TUD 2013-07 / marcusw" +protected function printComponentNames "author: Waurich TUD 2013-07 / marcusw + Prints the component names of the taskgraph components." input array iCompNames; protected Integer compIdx; @@ -3168,8 +3176,8 @@ algorithm print("--------------------------------\n"); end printComponentNames; -protected function printCompDescs "prints the information about the description of the taskgraph nodes for the .graphml file. -author: Waurich TUD 2013-07 / marcusw" +protected function printCompDescs "author: Waurich TUD 2013-07 / marcusw + Prints the information about the description of the taskgraph nodes for the .graphml file." input array iCompDescs; protected Integer compIdx; @@ -3182,8 +3190,8 @@ algorithm print("--------------------------------\n"); end printCompDescs; -protected function printExeCosts " prints the information about the execution costs of every component in task graph meta -author: Waurich TUD 2013-07 / marcusw" +protected function printExeCosts "author: Waurich TUD 2013-07 / marcusw + Prints the information about the execution costs of every component in task graph meta." input array> iExeCosts; protected Integer compIdx; @@ -3197,8 +3205,8 @@ algorithm print("--------------------------------\n"); end printExeCosts; -protected function printCommCosts " prints the information about the the communication costs of every edge. -author:Waurich TUD 2013-06 / marcusw" +protected function printCommCosts "author: Waurich TUD 2013-06 / marcusw + Prints the information about the the communication costs of every edge." input array iCommCosts; protected Integer nodeIdx; @@ -3211,8 +3219,8 @@ algorithm print("--------------------------------\n"); end printCommCosts; -public function printCommCost "author:marcusw -Prints the information about the the communication costs of one edge." +public function printCommCost "author: marcusw + Prints the information about the the communication costs of one edge." input Communication iComm; output String oCommString; protected @@ -3227,8 +3235,8 @@ algorithm oCommString := "(target node: " + intString(childNode) + " ints: " + intString(numberOfIntegers) + " floats: " + intString(numberOfFloats) + " booleans: " + intString(numberOfBooleans) + " [requiredTime: " + realString(requiredTime) + " for " + intString(numberOfVars) + " variables)"; end printCommCost; -public function printNodeMarks " prints the information about additional NodeMark -author: Waurich TUD 2013-07 / marcusw" +public function printNodeMarks "author: Waurich TUD 2013-07 / marcusw + Prints the information about additional NodeMark." input array iNodeMarks; protected Integer compIdx, mark; @@ -3240,8 +3248,8 @@ algorithm print("--------------------------------\n"); end printNodeMarks; -public function printComponentInformations "function to print the component informations of task graph meta - author:marcusw" +public function printComponentInformations "author: marcusw + Function to print the component information of task graph meta." input array iComponentInformations; protected Integer compIdx; @@ -3259,8 +3267,8 @@ algorithm print("--------------------------------\n"); end printComponentInformations; -public function intLstString "function to print a list -author:Waurich TUD 2013-07" +public function intLstString "author: Waurich TUD 2013-07 + Converts a list into a string which than can be used for printing." input list lstIn; output String strOut; protected @@ -3270,8 +3278,8 @@ algorithm strOut := if listEmpty(lstIn) then "---" else str; end intLstString; -public function dumpCriticalPathInfo "author:marcusw - dump the criticalPath and the costs to a string." +public function dumpCriticalPathInfo "author: marcusw + Dump the criticalPath and the costs to a string." input tuple>,Real> iCriticalPaths; //<%criticalPath, criticalPathOpCost%> input tuple>,Real> iCriticalPathsWoC; //<%criticalPath, criticalPathOpCost%> output String oString; @@ -3296,7 +3304,7 @@ algorithm end matchcontinue; end dumpCriticalPathInfo; -protected function dumpCriticalPathInfo1 "author:marcusw +protected function dumpCriticalPathInfo1 "author: marcusw Helper function of dumpCriticalPathInfo. Dump one critical path." input list> criticalPathsIn; input Integer cpIdx; @@ -3305,8 +3313,8 @@ algorithm oString := intLstString(listGet(criticalPathsIn,cpIdx))+""; end dumpCriticalPathInfo1; -public function printCriticalPathInfo "prints the criticalPath and the costs. -author:Waurich TUD 2013-07" +public function printCriticalPathInfo "author: Waurich TUD 2013-07 + Prints the criticalPath and the costs." input list> criticalPathsIn; input Real cpCosts; algorithm @@ -3327,19 +3335,21 @@ algorithm end matchcontinue; end printCriticalPathInfo; -protected function printCriticalPathInfo1"prints one criticalPath. -author: Waurich TUD 2013-07" +protected function printCriticalPathInfo1 "author: Waurich TUD 2013-07 + Prints one criticalPath." input list> criticalPathsIn; input Integer cpIdx; algorithm print(intString(cpIdx)+". path: "+intLstString(listGet(criticalPathsIn,cpIdx))+"\n"); end printCriticalPathInfo1; + //-------------------------- // Functions to merge nodes //-------------------------- -public function mergeSingleNodes"merges all single nodes. the max number of remaining single ndoes is numProc." +public function mergeSingleNodes " + Merges all single nodes. The max number of remaining single nodes is numProc." input TaskGraph iTaskGraph; input TaskGraphMeta iTaskGraphMeta; input list doNotMergeIn; @@ -3383,9 +3393,10 @@ algorithm end matchcontinue; end mergeSingleNodes; -public function distributeToClusters"takes a list of items and corresponding values and clusters the items. The cluster are supposed to have an most equal distribution of accumulated values. -if the items list is shorter than the numProc, a cluster list containing empty lists is output -author:Waurich TUD 2014-06" +public function distributeToClusters "author: Waurich TUD 2014-06 + Takes a list of items and corresponding values and clusters the items. The clusters are supposed to have an + most equal distribution of accumulated values. If the items list is shorter than the numProc, a cluster list + containing empty lists will be returned." input list items; input list values; input Integer numClusters; @@ -3484,8 +3495,8 @@ algorithm end matchcontinue; end distributeToClusters1; -protected function nextGreaterPowerOf2"finds the next greater power of 2. -author :Waurich TUD 2014-06" +protected function nextGreaterPowerOf2 "author: Waurich TUD 2014-06 + Finds the next greater power of 2." input Real n; output Integer powOf2; algorithm @@ -3512,8 +3523,8 @@ algorithm end matchcontinue; end nextGreaterPowerOf2_impl; -public function mergeSimpleNodes " merges all nodes in the graph that have only one predecessor and one successor. -author: Waurich TUD 2013-07" +public function mergeSimpleNodes "author: Waurich TUD 2013-07 + Merges all nodes in the graph that have only one predecessor and one successor." input TaskGraph graphIn; input TaskGraph graphTIn; input TaskGraphMeta graphDataIn; @@ -3540,7 +3551,7 @@ algorithm //print("contractedTasksOut "+stringDelimitList(List.map(arrayList(contractedTasksOut),intString),"\n")+"\n"); end mergeSimpleNodes; -public function mergeParentNodes "author: marcusw,waurich +public function mergeParentNodes "author: marcusw, waurich Merges parent nodes into child if this produces a shorter execution time." input TaskGraph graphIn; input TaskGraph graphTIn; @@ -3623,7 +3634,7 @@ algorithm end mergeParentNodes0; public function markSystemComponents "author: marcusw - Mark all components that are part of the given Task Graph in the target task graph meta with (ComponentInfo OR iComponentInfo)" + Mark all components that are part of the given Task Graph in the target task graph meta with (ComponentInfo OR iComponentInfo)." input TaskGraph iTaskGraph; input TaskGraphMeta iTaskGraphMeta; input tuple iComponentMarks; // @@ -3633,7 +3644,6 @@ protected array> odeInComps; list nodeComps; Integer nodeIdx, compIdx; - array> inComps; array> varCompMapping; array> eqCompMapping; @@ -3688,8 +3698,8 @@ algorithm oExeCost := ((op1+op2,realAdd(ex1,ex2))); end addUpExeCosts; -public function getExeCostReqCycles"author: waurich - gets the execution cost of the node in cycles." +public function getExeCostReqCycles "author: waurich + Gets the execution cost of the node in cycles." input Integer iNodeIdx; input TaskGraphMeta iGraphData; output Real oExeCost; @@ -3698,7 +3708,7 @@ algorithm end getExeCostReqCycles; public function getExeCost "author: marcusw - gets the execution cost of the node." + Gets the execution cost of the node." input Integer iNodeIdx; input TaskGraphMeta iGraphData; output tuple oExeCost; @@ -3721,8 +3731,7 @@ algorithm oExeCost := ((opCount,exeCost)); end getExeCost; -protected function getHighestExecCost "function getHighestExecCost - author: marcusw +protected function getHighestExecCost "author: marcusw Get the communication with highest costs out of the given list." input list> iExecCosts; input tuple iHighestTuple; @@ -3745,8 +3754,8 @@ algorithm end matchcontinue; end getHighestExecCost; -public function contractNodesInGraph "contract the nodes given in the list to one node. Take care that the lists are disjoint. -author: marcusw" +public function contractNodesInGraph "author: marcusw + Contract the nodes given in the list to one node. Take care that the lists are disjoint." input list> iContractNodes; //a list containing a list with nodes you want to merge input TaskGraph iTaskGraph; input TaskGraph iTaskGraphT; @@ -3759,7 +3768,6 @@ author: marcusw" protected //TaskGraph Meta array> inComps; - TaskGraph tmpTaskGraph = iTaskGraph; TaskGraph tmpTaskGraphT = iTaskGraphT; array tmpContractedTasks = iContractedTasks; @@ -3919,8 +3927,8 @@ algorithm oContractedTasks := iContractedTasks; end contractNodesInGraph; -protected function checkIfNodeBelongsToCluster "returns true if the node mark of the given iNodeIdx is equal to the reference value. -author: marcusw" +protected function checkIfNodeBelongsToCluster "author: marcusw + Returns true if the node mark of the given iNodeIdx is equal to the reference value." input Integer iNegativeRefValue; //the negative reference-value to check input Integer iNodeIdx; input array iContractedTasks; @@ -3930,8 +3938,8 @@ algorithm oIsNodePartOfCluster := intEq(iNegativeRefValue, arrayGet(iContractedTasks, iNodeIdx)); end checkIfNodeBelongsToCluster; -protected function getContractedNodeChildren "get the child-nodes of the given parent task. If a children has a negativ contracted mark, the real node is searched. -author: marcusw" +protected function getContractedNodeChildren "author: marcusw + Get the child-nodes of the given parent task. If a children has a negativ contracted mark, the real node is searched." input Integer iParentTask; input Integer iRefValue; input TaskGraph iTaskGraph; @@ -3960,8 +3968,8 @@ algorithm oChildTasks := resultTasks; end getContractedNodeChildren; -protected function getRealTaskIdxOfTask "get the real task-index of the given task. If the task has a negativ contracted mark, the real node is searched. -author: marcusw" +protected function getRealTaskIdxOfTask "author: marcusw + Get the real task-index of the given task. If the task has a negativ contracted mark, the real node is searched." input Integer iTaskIdx; input array iContractedTasks; output Integer oTaskIdx; @@ -3977,8 +3985,8 @@ algorithm end if; end getRealTaskIdxOfTask; -public function setInCompsInMeta"replaces the inComps in the taskGraphMeta. -author:Waurich TUD 2014-11" +public function setInCompsInMeta "author: Waurich TUD 2014-11 + Replaces the inComps in the taskGraphMeta." input array> inComps; input TaskGraphMeta metaIn; output TaskGraphMeta metaOut; @@ -3997,8 +4005,8 @@ algorithm metaOut := TASKGRAPHMETA(inComps,varCompMapping,eqCompMapping,compParamMapping,compNames,compDescs,exeCosts,commCosts,nodeMark,compInformations); end setInCompsInMeta; -protected function updateInCompsInfo"updates the inComps for the contracted nodes. -author:Waurich TUD 2014-11" +protected function updateInCompsInfo "author: Waurich TUD 2014-11 + Updates the inComps for the contracted nodes." input Integer contrNode; input list removedNodes; input array> inComps; @@ -4013,8 +4021,8 @@ algorithm arrayUpdate(inComps,contrNode,comps); end updateInCompsInfo; -public function filterContractedNodes"selects only Nodes that are not already contracted. -author:Waurich TUD 2014-11" +public function filterContractedNodes "author: Waurich TUD 2014-11 + Selects only Nodes that are not already contracted." input list nodesIn; input array contrNodes; output list nodesOut; @@ -4022,8 +4030,8 @@ algorithm nodesOut := List.filterOnFalse(nodesIn,function isNodeContracted(iContrNodes=contrNodes)); end filterContractedNodes; -public function filterNonContractedNodes"selects only Nodes that are already contracted. -author:Waurich TUD 2014-11" +public function filterNonContractedNodes "author: Waurich TUD 2014-11 + Selects only Nodes that are already contracted." input list nodesIn; input array contrNodes; output list nodesOut; @@ -4031,7 +4039,8 @@ algorithm nodesOut := List.filterOnTrue(nodesIn,function isNodeContracted(iContrNodes=contrNodes)); end filterNonContractedNodes; -public function isNodeContracted "ouputs true if the given node is already contracted" +public function isNodeContracted " + Ouputs true if the given node is already contracted" input Integer iNode; input array iContrNodes; output Boolean oIsContracted; @@ -4042,8 +4051,8 @@ algorithm end if; end isNodeContracted; -protected function contractNodesInGraph1 " function to contract the nodes given in the list to one node, without deleting the rows in the adjacencyLst. -author: Waurich TUD 2013-07" +protected function contractNodesInGraph1 "author: Waurich TUD 2013-07 + Function to contract the nodes given in the list to one node, without deleting the rows in the adjacencyLst." input list contractNodes; input TaskGraph graphIn; output TaskGraph graphOut; @@ -4101,8 +4110,8 @@ algorithm oGraph := arrayUpdate(iGraph, iParentNode, adjLstEntry); end contractNodesInGraph2; -protected function compareListLengthOnTrue " is true if given list has a length of inValue, otherwise false. -author: Waurich TUD 2013-07" +protected function compareListLengthOnTrue "author: Waurich TUD 2013-07 + Is true if given list has a length of inValue, otherwise false." input Integer inValue; input list inLst; output Boolean equalLength; @@ -4117,8 +4126,8 @@ algorithm end matchcontinue; end compareListLengthOnTrue; -protected function getMergedSystemData " udpates the taskgraphmetadata for the merged system. -author:Waurich TUD 2013-07" +protected function getMergedSystemData "author: Waurich TUD 2013-07 + Updates the taskgraphmetadata for the merged system." input TaskGraphMeta graphDataIn; input list> contractNodes; output TaskGraphMeta graphDataOut; @@ -4141,8 +4150,8 @@ algorithm graphDataOut := TASKGRAPHMETA(inComps,varCompMapping,eqCompMapping,compParamMapping,compNames,compDescs,exeCosts,commCosts,nodeMark,compInformations); end getMergedSystemData; -public function updateCompNamesForMerging " updates the compNames with the merging information. -author:Waurich TUD 2013-07" +public function updateCompNamesForMerging "author: Waurich TUD 2013-07 + Updates the compNames with the merging information." input Integer compIdx; input array> inComps; input array nodeMark; @@ -4189,8 +4198,8 @@ algorithm end matchcontinue; end updateCompNamesForMerging; -protected function updateInCompsForMerging " updates the inComps with the merging information. -author:waurich TUD 2013-07" +protected function updateInCompsForMerging "author: waurich TUD 2013-07 + Updates the inComps with the merging information." input array> inCompsIn; input list> mergedPaths; //nodes to contract output array> inCompsOut; @@ -4212,8 +4221,8 @@ algorithm inCompsOut := listArray(inCompsLst); end updateInCompsForMerging; -protected function updateInComps1 " folding function for updateInComps. -author:waurich TUD 2013-07" +protected function updateInComps1 "author: waurich TUD 2013-07 + Folding function for updateInComps." input Integer nodeIdx; input tuple,list,list>> mergeInfo; //<%startNodes,deleteNodes,mergedPaths%> input array> primInComps; @@ -4256,7 +4265,8 @@ algorithm end matchcontinue; end updateInComps1; -protected function updateInComps2 "Replaces the entry <%iNodeIdx - 1%> in inCompListIn with an empty set" +protected function updateInComps2 " + Replaces the entry <%iNodeIdx - 1%> in inCompListIn with an empty set." input Integer iNodeIdx; input list> inCompLstIn; output list> inCompLstOut; @@ -4264,8 +4274,8 @@ algorithm inCompLstOut := List.replaceAt({}, iNodeIdx, inCompLstIn); end updateInComps2; -protected function equalLists " compares two lists and sets true if they are equal. -author:Waurich TUD 2013-07" +protected function equalLists "author: Waurich TUD 2013-07 + compares two lists and sets true if they are equal." input list inList1; input list inList2; output Boolean outIsEqual; @@ -4287,9 +4297,9 @@ algorithm end matchcontinue; end equalLists; -protected function findOneChildParents " fold function to find nodes or paths in the taskGraph with just one successor per node. -extended: adds endnodes without successor as well -author: Waurich TUD 2013-07" +protected function findOneChildParents "author: Waurich TUD 2013-07 + Fold function to find nodes or paths in the taskGraph with just one successor per node. + Extended: adds endnodes without successor as well." input list allNodes; input TaskGraph graphIn; input list doNotMerge; // these nodes cannot be chosen @@ -4419,8 +4429,8 @@ algorithm end matchcontinue; end findOneChildParents; -protected function getParentNodes " function to get the parent nodes of a node. -author:Waurich TUD 2013-07" +protected function getParentNodes "author: Waurich TUD 2013-07 + Function to get the parent nodes of a node." input Integer nodeIdx; input TaskGraph graphIn; output list parentNodes; @@ -4431,8 +4441,9 @@ algorithm parentNodes := arrayGet(graphInT, nodeIdx); end getParentNodes; -protected function checkParentNode "fold function to check the first element in the child path for the number of parent nodes.if the number is 1 the parent will be added. -author:Waurich TUD 2013-06" +protected function checkParentNode "author: Waurich TUD 2013-06 + Fold function to check the first element in the child path for the number of parent nodes. If the number + is 1 the parent will be added." input Integer lstIdx; input TaskGraph graphIn; input list> lstIn; @@ -4475,7 +4486,7 @@ end checkParentNode; //----------------------------- public function createCosts "author: marcusw - Updates the given TaskGraphMeta-Structure with the calculated exec und communication costs." + Updates the given TaskGraphMeta-Structure with the calculated execution und communication costs." input BackendDAE.BackendDAE iDae; input String iBenchFilePrefix; //The prefix of the xml or json profiling-file input array iSimEqCompMapping; //Map each simEq to the scc @@ -4521,8 +4532,8 @@ algorithm end matchcontinue; end createCosts; -public function estimateCosts "estimates the communication and execution costs very roughly so hpcom can work with something when there is no prof_xml -author: Waurich TUD 09-2013" +public function estimateCosts "author: Waurich TUD 09-2013 + Estimates the communication and execution costs very roughly so hpcom can work with something when there is no prof_xml file." input BackendDAE.BackendDAE daeIn; input TaskGraphMeta taskGraphMetaIn; output TaskGraphMeta taskGraphMetaOut; @@ -4563,8 +4574,8 @@ algorithm taskGraphMetaOut := TASKGRAPHMETA(inComps,varCompMapping,eqCompMapping,compParamMapping,compNames,compDescs,exeCosts,commCosts,nodeMark,compInformations); end estimateCosts; -protected function estimateCosts0 "estimates the exeCosts for StrongComponents -author: Waurich TUD 2013-09" +protected function estimateCosts0 "author: Waurich TUD 2013-09 + Estimates the execution costs for StrongComponents." input Integer systIdx; input list compsLstIn; input BackendDAE.EqSystems eqSystemsIn; @@ -4581,8 +4592,8 @@ algorithm exeCostsOut := List.map(compsInfos,calculateCosts); end estimateCosts0; -public function calculateCosts "calculates the estimated costs for a compInfo. this has been benchmarked using the Cpp runtime -author: Waurich TUD 2014-12" +public function calculateCosts "author: Waurich TUD 2014-12 + Calculates the estimated costs for a compInfo. This has been benchmarked using the Cpp runtime." input BackendDAE.CompInfo compInfo; output tuple exeCost; algorithm @@ -4656,8 +4667,8 @@ algorithm oTaskGraphData := iTargetTaskGraphData; end copyCosts; -protected function getCommCostsOnly "function to compute the communicationCosts -author: Waurich TUD 2013-09" +protected function getCommCostsOnly "author: Waurich TUD 2013-09 + Function to compute the communication costs." input array commCostsIn; output array commCostsOut; protected @@ -4667,8 +4678,8 @@ algorithm commCostsOut := createCommCosts(commCostsIn,1,reqTimeCom); end getCommCostsOnly; -protected function checkForExecutionCosts - "checks if every entry in exeCosts is > 0.0" +protected function checkForExecutionCosts " + Checks if every entry in the array exeCosts is > 0.0" input TaskGraphMeta dataIn; output Boolean isFine; protected @@ -4682,8 +4693,8 @@ algorithm end if; end checkForExecutionCosts; -protected function checkForExecutionCosts1 "checks if the comp for the given node has an executionCost > 0.0 -author: Waurich TUD 2013-09" +protected function checkForExecutionCosts1 "author: Waurich TUD 2013-09 + Checks if for the given comps the relation 'executionCost > 0.0' is true." input array> exeCosts; input array> inComps; input Integer nodeIdx; @@ -4716,8 +4727,8 @@ algorithm end matchcontinue; end checkForExecutionCosts1; -protected function checkTpl2ForZero "folding function for checkForExecutionCosts1 -author:Waurich TUD 2013-09" +protected function checkTpl2ForZero "author: Waurich TUD 2013-09 + Folding function for checkForExecutionCosts1." input Integer comp; input array> exeCosts; input Boolean bIn; @@ -4734,7 +4745,7 @@ algorithm end checkTpl2ForZero; public function convertNodeListToEdgeTuples "author: marcusw - Convert a list of nodes to a list of edged. E.g. {1,2,5} -> {(1,2),(2,5)}" + Convert a list of nodes to a list of edge tuples. E.g. {1,2,5} -> {(1,2),(2,5)}" input list iNodeList; output list> oEdgeList; algorithm @@ -4742,7 +4753,7 @@ algorithm end convertNodeListToEdgeTuples; protected function convertNodeListToEdgeTuples0 "author: marcusw - Helper function of convertNodeListToEdgeTuples" + Helper function of convertNodeListToEdgeTuples." input list iNodeList; input Integer iNodeIdx; input list> iEdgeList; @@ -4827,7 +4838,7 @@ algorithm end convertSimEqToSccCosts2; protected function createCosts0 "author: marcusw - Updates the given TaskGraphMeta-Structure with the calculated exec und communication costs." + Updates the given TaskGraphMeta-Structure with the calculated execution und communication costs." input list iNode; //Node to sccs mapping input tuple iComps_shared; input array iCompMapping; @@ -4966,6 +4977,7 @@ algorithm oComm := COMMUNICATION(numberOfVars,integerVars,floatVars,booleanVars,stringVars,childNode,requiredTime); end createCommCosts0; + //--------------------------------- // Functions to validate the graph //--------------------------------- @@ -5058,7 +5070,8 @@ algorithm if componentsEqual(tpl1, tpl2) then isEqual:= true; else isEqual := false; - print("comp " + intString(i1) + BackendDump.printComponent(comp1) + " is not equal to " + "comp" + intString(i2) + BackendDump.printComponent(comp2) + "\n"); + print("comp " + intString(i1) + BackendDump.printComponent(comp1) + " is not equal to " + "comp" + + intString(i2) + BackendDump.printComponent(comp2) + "\n"); end if; end while; then true; @@ -5097,7 +5110,8 @@ algorithm case((currentComp,idxCurrent),(_,SOME(lastComp_idx as (lastComp, idxLast)))) equation true = componentsEqual(currentComp_idx,lastComp_idx); - print("Component duplicate detected: current: " + BackendDump.printComponent(currentComp) + " (eqSystem " + intString(idxCurrent) + ") last " + BackendDump.printComponent(lastComp) + " (eqSystem " + intString(idxLast) + ").\n"); + print("Component duplicate detected: current: " + BackendDump.printComponent(currentComp) + " (eqSystem " + + intString(idxCurrent) + ") last " + BackendDump.printComponent(lastComp) + " (eqSystem " + intString(idxLast) + ").\n"); then ((false,SOME(currentComp_idx))); else ((true, SOME(currentComp_idx))); end matchcontinue; @@ -5218,7 +5232,7 @@ algorithm end componentsEqual; protected function compareComponents "author: marcusw - Compares the given components and returns true if the name of the first component is lower are equal." + Compares the given components and returns true if the name of the first component is lower." input tuple iComp1; input tuple iComp2; // output Boolean res; @@ -5244,12 +5258,13 @@ algorithm end if; end compareComponents; + //------------------------------------ // Evaluation and analysing functions //------------------------------------ -public function getCriticalPaths " function to assign levels to the nodes of a graph and compute the criticalPath. -author: Waurich TUD 2013-07" +public function getCriticalPaths "author: Waurich TUD 2013-07 + Function to assign levels to the nodes of a graph and compute the criticalPath." input TaskGraph graphIn; input TaskGraphMeta graphDataIn; output tuple>,Real> criticalPathOut; //criticalPath with communication costs <%paths, opCost%> @@ -5285,8 +5300,7 @@ algorithm end matchcontinue; end getCriticalPaths; -protected function getCriticalPath "function getCriticalPath - author: marcusw +protected function getCriticalPath "author: marcusw Get the critical path of the graph." input TaskGraph iGraph; input TaskGraphMeta iGraphData; @@ -5308,8 +5322,7 @@ algorithm oCriticalPathsOut := {criticalPath}; end getCriticalPath; -protected function getCriticalPath1 "function getCriticalPath1 - author: marcusw +protected function getCriticalPath1 "author: marcusw Get the critical path of the given node (iNode). If the node was already visited, the result will be read from the iNodeCriticalPaths. If the node is visited the first time, then the critical path is calculated and stored into the iNodeCriticalPaths-array." input Integer iNode; @@ -5368,8 +5381,7 @@ algorithm end matchcontinue; end getCriticalPath1; -protected function getCriticalPath2 "function getCriticalPath2 - author: marcusw +protected function getCriticalPath2 "author: marcusw Find the list-index of the longest path. The paths which should be compared have to be stored in the iCriticalPaths-list." input list>> iCriticalPaths; input Integer iListIdx; @@ -5392,8 +5404,7 @@ algorithm end matchcontinue; end getCriticalPath2; -protected function addUpExeCostsForNode "function addUpExeCostsForNode - author: marcusw +protected function addUpExeCostsForNode "author: marcusw This function adds up all execution costs of the given component list (iNodeComps)." input list iNodeComps; input array> iExeCosts; @@ -5415,8 +5426,8 @@ algorithm end match; end addUpExeCostsForNode; -protected function gatherParallelSets " gathers all nodes of the same level in a list -author: Waurich TUD 2013-07" +protected function gatherParallelSets "author: Waurich TUD 2013-07 + Gathers all nodes of the same level in a list." input array> nodeInfo; output list> parallelSetsOut; protected @@ -5426,8 +5437,8 @@ algorithm parallelSetsOut := List.fold1(List.intRange(arrayLength(nodeInfo)),gatherParallelSets1,nodeInfo,List.fill({},numLevels)); end gatherParallelSets; -protected function numberOfLevels " gets the number of values -author: Waurich TUD 2013-07" +protected function numberOfLevels "author: Waurich TUD 2013-07 + Gets the number of values." input tuple nodeInfoEntry; input Integer numLevelsIn; output Integer numLevelsOut; @@ -5438,8 +5449,8 @@ algorithm numLevelsOut := intMax(levelIn,numLevelsIn); end numberOfLevels; -protected function gatherParallelSets1 " folding function for gatherParallelSets -author: Waurich TUD 2013-07" +protected function gatherParallelSets1 "author: Waurich TUD 2013-07 + Folding function for gatherParallelSets." input Integer idx; input array> nodeInfo; input list> parallelSetIn; @@ -5454,9 +5465,9 @@ algorithm parallelSetOut := List.replaceAt(pSet, level, parallelSetIn); end gatherParallelSets1; -protected function getCostsForNode " function to compute the costs for the next node (including the execution costs and the communication costs). -the given nodeIndeces are from the current graph and will be transformed to original indeces via inComps by this function -author:Waurich TUD 2013-07" +protected function getCostsForNode "author: Waurich TUD 2013-07 + Function to compute the costs for the next node (including the execution costs and the communication costs). + The given nodeIndeces are from the current graph and will be transformed to original indeces via inComps by this function." input Integer parentNode; input Integer childNode; input array> inComps; @@ -5521,8 +5532,8 @@ algorithm end matchcontinue; end getCostsForNode; -public function getCostsForContractedNodes "sums up alle execution costs for a contracted node. -authro:Waurich TUD 2013-10" +public function getCostsForContractedNodes "author: Waurich TUD 2013-10 + Sums up alle execution costs for a contracted node." input list nodeList; input array> exeCosts; output Real costsOut; @@ -5530,8 +5541,8 @@ algorithm costsOut := List.fold1(nodeList,getCostsForContractedNodes1,exeCosts,0.0); end getCostsForContractedNodes; -protected function getCostsForContractedNodes1 "gets exeCosts for one node and add it to the foldType. -author:Waurich TUD 2013-10" +protected function getCostsForContractedNodes1 "author:Waurich TUD 2013-10 + Gets exeCosts for one node and add it to the foldType." input Integer node; input array> exeCosts; input Real costsIn; @@ -5543,8 +5554,8 @@ algorithm costsOut := realAdd(costsIn,exeCost); end getCostsForContractedNodes1; -protected function getNodeCoords " computes the location of the nodes in the .graphml with regard to the parallel sets -author:Waurich TUD 2013-07" +protected function getNodeCoords "author: Waurich TUD 2013-07 + Computes the location of the nodes in the .graphml with regard to the parallel sets." input list> parallelSets; input TaskGraph graphIn; output array> nodeCoordsOut; @@ -5559,7 +5570,8 @@ algorithm //print("nodeCoords"+stringDelimitList(List.map(arrayList(nodeCoords),tupleToString),",")+"\n"); end getNodeCoords; -protected function getYCoordForNode "fold function to compute the y-coordinate for the graph.author: Waurich TUD 2013-07" +protected function getYCoordForNode "author: Waurich TUD 2013-07 + Fold function to compute the y-coordinate for the graph." input Integer compIdx; input list> parallelSets; input array> nodeCoordsIn; @@ -5579,8 +5591,8 @@ algorithm nodeCoordsOut := arrayUpdate(nodeCoordsIn,compIdx,coords); end getYCoordForNode; -protected function getParallelSetForComp " find the parallelSet the inComp belongs to. -author: Waurich TUD 2013-07" +protected function getParallelSetForComp "author: Waurich TUD 2013-07 + Find the parallelSet the inComp belongs to." input Integer compIn; input Integer setIdx; input list> parallelSets; @@ -5617,8 +5629,8 @@ algorithm end matchcontinue; end getParallelSetForComp; -protected function setLevelInNodeMark " sets the parallelSetIndex as a nodeMark. -author:wauricht TUD 2013-07" +protected function setLevelInNodeMark "author: wauricht TUD 2013-07 + Sets the parallelSetIndex as a nodeMark." input Integer nodeIdx; input array> inComps; input array> nodeCoords; @@ -5721,9 +5733,9 @@ algorithm end transposeCommCosts1; //TODO: Can this be merged with getCommCostBetweenNodes? -public function getCommunicationCost " gets the communication cost for an edge from parent node to child node. - REMARK: use the primal indeces!!!!!! - author: waurich TUD 2013-06." +public function getCommunicationCost "author: waurich TUD 2013-06. + Gets the communication cost for an edge from parent node to child node. + REMARK: use the primal indeces!!!!!!" input Integer childIdx; input Integer parentIdx; input array commCosts; @@ -5739,8 +5751,8 @@ algorithm oComm := commEntry; end getCommunicationCost; -protected function getCommunicationByChildIdx "author:marcusw - Gets the communication with the given child idx out of the communications-list." +protected function getCommunicationByChildIdx "author: marcusw + Gets the communication with the given child idx out of the communications list." input Communications iComms; input Integer iChildIdx; output Communication oComm; @@ -5767,7 +5779,7 @@ algorithm end matchcontinue; end getCommunicationByChildIdx; -public function getCommCostTimeBetweenNodes"author: waurich TUD 2014-05 +public function getCommCostTimeBetweenNodes "author: waurich TUD 2014-05 Get the required time of the highest communication costs between the given nodes." input Integer iParentNodeIdx; input Integer iChildNodeIdx; @@ -5823,7 +5835,7 @@ algorithm end getCommCostBetweenNodes0; protected function getCommCostBetweenNodes1 "author: marcusw - Checks if the communication-component is part of the child component list. " + Checks if the communication component is part of the child component list." input Communication iCommCost; input list iChildComps; output Boolean oResult; @@ -5834,9 +5846,8 @@ algorithm oResult := List.exist1(iChildComps, intEq, compIdx); end getCommCostBetweenNodes1; -protected function getHighestCommCost - "Get the communication with highest costs out of the given list. - author: marcusw" +protected function getHighestCommCost "author: marcusw + Get the communication with highest costs out of the given list." input Communications iCommCosts; input Communication iHighestTuple; output Communication oHighestTuple; @@ -5856,8 +5867,8 @@ algorithm end matchcontinue; end getHighestCommCost; -public function sumUpExeCosts"accumulates the execution costs of all tasks in the graph. -author:Waurich TUD 2014-07" +public function sumUpExeCosts "author: Waurich TUD 2014-07 + Accumulates the execution costs of all tasks in the graph." input TaskGraph iGraph; input TaskGraphMeta iMeta; output tuple execCosts; @@ -5882,9 +5893,8 @@ algorithm end match; end sumUpExeCosts; -public function getAllSCCsOfGraph - "Get all SCC-indices that are part of the graph. - author: marcusw" +public function getAllSCCsOfGraph "author: marcusw + Get all SCC-indices that are part of the graph." input TaskGraphMeta iTaskGraphMeta; output list oSccs; protected @@ -5910,8 +5920,8 @@ algorithm end getAllSCCsOfGraph; //TODO: Remove -public function roundReal "rounds a real to the nth decimal -author: Waurich TUD 2014-01" +public function roundReal "author: Waurich TUD 2014-01 + Rounds a real to the nth decimal." input Real inReal; input Integer nIn; output Real outReal; @@ -5924,12 +5934,13 @@ algorithm outReal := real / (10.0 ^ nIn); end roundReal; + //-------------------------------------------------------- // Get annotations from backendDAE and display in graphML //-------------------------------------------------------- -protected function setAnnotationsForTasks"sets annotations of variables and equations for every task in the array (index: task idx) -author:Waurich TUD 2014-05 " +protected function setAnnotationsForTasks "author: Waurich TUD 2014-05 + Sets annotations of variables and equations for every task in the array (index: task idx)." input TaskGraphMeta taskGraphInfo; input BackendDAE.BackendDAE backendDAE; input array annotInfoIn; @@ -5941,8 +5952,8 @@ algorithm ((_,annotInfoOut)) := List.fold1(systs,setAnnotationsForTasks1,taskGraphInfo,(0,annotInfoIn)); end setAnnotationsForTasks; -protected function setAnnotationsForTasks1"sets annotations for a task of vars and equations of an equationsystem -author: Waurich TUD 2014-05" +protected function setAnnotationsForTasks1 "author: Waurich TUD 2014-05 + Sets annotations for a task of vars and equations of an equationsystem." input BackendDAE.EqSystem syst; input TaskGraphMeta taskGraphInfo; input tuple> infoIn; @@ -5960,7 +5971,8 @@ algorithm infoOut := (BackendVariable.varsSize(vars)+idx,annots); end setAnnotationsForTasks1; -protected function setAnnotationsForVar"sets the annotations of a variable in the annotArray" +protected function setAnnotationsForVar " + Sets the annotations of a variable in the annotArray." input Integer backendVarIdx; input BackendDAE.Variables vars; input TaskGraphMeta taskGraphInfo; @@ -6002,8 +6014,8 @@ end setAnnotationsForVar; // Append removed equations like asserts to the DAE graph //-------------------------------------------------------- -public function appendRemovedEquations"appends to the graph (DAE-onlySCCs) all removed equations i.e. asserts... -author:Waurich TUD 2014-07" +public function appendRemovedEquations "author: Waurich TUD 2014-07 + Appends to the graph (DAE-onlySCCs) all removed equations i.e. asserts..." input BackendDAE.BackendDAE dae; input TaskGraph graphIn; input TaskGraphMeta graphDataIn; @@ -6073,8 +6085,8 @@ algorithm end matchcontinue; end appendRemovedEquations; -protected function estimateEquationCosts"estimates costs for equations. -author: Waurich TUD 2015-04" +protected function estimateEquationCosts "author: Waurich TUD 2015-04 + Estimates costs for equations." input BackendDAE.Equation eqIn; input BackendDAE.Shared sharedIn; output tuple tplOut; // @@ -6101,8 +6113,8 @@ algorithm s := "("+intString(Util.tuple21(node))+","+intString(Util.tuple22(node))+")"; end printNodeVars1; -protected function setCommCostsToParent"sets/updated the communication costs for the list of parents to the child node. -author:Waurich TUD 2014-07" +protected function setCommCostsToParent "author: Waurich TUD 2014-07 + Sets/updated the communication costs for the list of parents to the child node." input list> parents; // input Integer child; input Real reqCycles; @@ -6112,8 +6124,8 @@ algorithm commCostsOut := List.fold2(parents,setCommCosts,child,reqCycles,commCostsIn); end setCommCostsToParent; -protected function setCommCosts"sets/updated the communication costs for the edge from parent to child node. -author:Waurich TUD 2014-07" +protected function setCommCosts "author: Waurich TUD 2014-07 + Sets/updated the communication costs for the edge from parent to child node." input tuple parent; // input Integer child; input Real reqCycles; @@ -6130,7 +6142,7 @@ algorithm commCostsOut := arrayUpdate(commCostsIn,parentNodeIdx,row); end setCommCosts; -protected function isCommunicationChildEqualToIdx "author:marcusw +protected function isCommunicationChildEqualToIdx "author: marcusw Returns true if the child, stored in the iComm-object, is equals to the iIdx." input Communication iComm; input Integer iIdx; @@ -6142,8 +6154,8 @@ algorithm isEq := intNe(childNode,iIdx); end isCommunicationChildEqualToIdx; -protected function addEdgesToGraph"adds several edges from the list of parent to child to the taskgraph -author:Waurich TUD 2014-07" +protected function addEdgesToGraph "author: Waurich TUD 2014-07 + Adds several edges from the list of parent to child to the task graph." input list> parents; // input Integer child; input TaskGraph graphIn; @@ -6152,8 +6164,8 @@ algorithm graphOut := List.fold1(List.map(parents,Util.tuple21),addEdgeToGraph,child,graphIn); end addEdgesToGraph; -protected function addEdgeToGraph"adds an edge from parent to child to the taskgraph -author:Waurich TUD 2014-07" +protected function addEdgeToGraph "author: Waurich TUD 2014-07 + Adds an edge from parent to child to the task graph." input Integer parent; input Integer child; input TaskGraph graphIn; @@ -6166,8 +6178,8 @@ algorithm graphOut := arrayUpdate(graphIn,parent,row); end addEdgeToGraph; -protected function getNodeForCrefLst"gets the node in which the var for the given cref is solved. -author:Waurich TUD 2014-07" +protected function getNodeForCrefLst "author: Waurich TUD 2014-07 + Gets the node in which the var for the given cref is solved." input list iCrefs; input BackendDAE.BackendDAE iDae; input array> iVarCompMap; @@ -6180,9 +6192,8 @@ algorithm //print("tmpNodeVarLst1 "+printNodeVars(tmpNodeVarLst)+"\n"); end getNodeForCrefLst; -protected function nodeIsDependent - "if this node has no parent, it is independent - author: waurich" +protected function nodeIsDependent "author: waurich + If this node has no parent, it is independent." input tuple node; output Boolean dep; protected @@ -6192,8 +6203,8 @@ algorithm dep := intNe(tpl1,-1); end nodeIsDependent; -protected function getNodeForCref "get the node- and var-idx for the given cref -author:Waurich TUD 2014-07" +protected function getNodeForCref "author: Waurich TUD 2014-07 + Get the node- and var-idx for the given cref." input DAE.ComponentRef iCref; input BackendDAE.BackendDAE iDae; input array> iVarCompMapping; @@ -6278,12 +6289,13 @@ algorithm end matchcontinue; end getNodeForVarIdx; + //---------------------------- // MAPPING FUNCTIONS //---------------------------- -public function setUpHpcOmMapping"creates mappings between simcode and backendDAE for the hpcom module -author: waurich 12-2015" +public function setUpHpcOmMapping "author: waurich 12-2015 + Creates mappings between simcode and backendDAE for the hpcom module." input BackendDAE.BackendDAE daeIn; input SimCode.SimCode simCodeIn; input Integer lastEqMappingIdx; @@ -6313,8 +6325,7 @@ algorithm //dumpSccSimEqMapping(sccSimEqMapping); end setUpHpcOmMapping; -protected function findHighestSccIdxInMapping "function findHighestSccIdxInMapping - author: marcusw +protected function findHighestSccIdxInMapping "author: marcusw Find the highest scc-index in the mapping list." input list> iEquationSccMapping; // input Integer iHighestIndex; @@ -6334,8 +6345,7 @@ algorithm end matchcontinue; end findHighestSccIdxInMapping; -protected function removeDummyStateFromMapping "function removeDummyStateFromMapping - author: marcusw +protected function removeDummyStateFromMapping "author: marcusw Removes all mappings with sccIdx=1 from the list and decrements all other scc-indices by 1." input list> iEquationSccMapping; output list> oEquationSccMapping; @@ -6343,9 +6353,8 @@ algorithm oEquationSccMapping := List.fold(iEquationSccMapping, removeDummyStateFromMapping1, {}); end removeDummyStateFromMapping; -protected function removeDummyStateFromMapping1 "function removeDummyStateFromMapping1 - author: marcusw - Helper function of removeDummyStateFromMapping. Handles one list-element." +protected function removeDummyStateFromMapping1 "author: marcusw + Helper function of removeDummyStateFromMapping. Handles one list element." input tuple iTuple; // input list> iNewList; output list> oNewList; @@ -6369,9 +6378,7 @@ algorithm end matchcontinue; end removeDummyStateFromMapping1; - -protected function convertToSccSimEqMapping "function convertToSccSimEqMapping - author: marcusw +protected function convertToSccSimEqMapping "author: marcusw Converts the given mapping (simEqIndex -> sccIndex) to the inverse mapping (sccIndex->simEqIndex)." input list> iMapping; //the mapping (simEqIndex -> sccIndex) input Integer numOfSccs; //important for arrayCreate @@ -6385,8 +6392,7 @@ algorithm oMapping := tmpMapping; end convertToSccSimEqMapping; -protected function convertToSccSimEqMapping1 "function convertToSccSimEqMapping1 - author: marcusw +protected function convertToSccSimEqMapping1 "author: marcusw Helper function for convertToSccSimEqMapping. It will update the arrayIndex of the given mapping value." input tuple iMapping; // input array> iSccMapping; @@ -6402,9 +6408,7 @@ algorithm oSccMapping := arrayUpdate(iSccMapping,i2,tmpList); end convertToSccSimEqMapping1; - -protected function convertToSimeqCompMapping "function convertToSimeqCompMapping - author: marcusw +protected function convertToSimeqCompMapping "author: marcusw Converts the given mapping (simEqIndex -> sccIndex) bases on tuples to an array mapping." input list> iMapping; // input Integer numOfSimEqs; @@ -6416,9 +6420,7 @@ algorithm oMapping := List.fold(iMapping, convertToSimeqCompMapping1, tmpMapping); end convertToSimeqCompMapping; - -protected function convertToSimeqCompMapping1 "function convertToSimeqCompMapping1 - author: marcusw +protected function convertToSimeqCompMapping1 "author: marcusw Helper function for convertToSimeqCompMapping. It will update the array at the given index." input tuple iSimEqTuple; // input array iMapping; @@ -6431,7 +6433,6 @@ algorithm oMapping := arrayUpdate(iMapping,simEqIdx,sccIdx); end convertToSimeqCompMapping1; - protected function getSimEqIdxSimEqMapping "author: marcusw Get a mapping from simEqIdx -> option(simEq)." input list iAllEquations; @@ -6444,7 +6445,6 @@ algorithm oMapping := List.fold(iAllEquations, getSimEqIdxSimEqMapping1, tmpMapping); end getSimEqIdxSimEqMapping; - protected function getSimEqIdxSimEqMapping1 "author: marcusw Helper function that adds the index of the given equation to the mapping." input SimCode.SimEqSystem iEquation; @@ -6468,7 +6468,6 @@ algorithm end matchcontinue; end getSimEqIdxSimEqMapping1; - public function getSimCodeEqByIndexAndMapping "author: marcusw Returns the SimEqSystem which has the given Index." input array> iSimEqIdxSimEqMapping; //All SimEqSystems @@ -6481,7 +6480,6 @@ algorithm oSimEqSystem := getSimCodeEqByIndexAndMapping1(tmpSimEqSystem, iIdx); end getSimCodeEqByIndexAndMapping; - protected function getSimCodeEqByIndexAndMapping1 "author: marcusw Returns the SimEqSystem if it's not NONE()." input Option iSimEqSystem; @@ -6501,9 +6499,7 @@ algorithm end match; end getSimCodeEqByIndexAndMapping1; - -public function getSimCodeEqByIndex "function getSimCodeEqByIndex - author: marcusw +public function getSimCodeEqByIndex "author: marcusw Returns the SimEqSystem which has the given Index. This method is called from susan." input list iEqs; //All SimEqSystems input Integer iIdx; //The index of the required system @@ -6529,9 +6525,7 @@ algorithm end matchcontinue; end getSimCodeEqByIndex; - -protected function getIndexBySimCodeEq "function getIndexBySimCodeEq - author: marcusw +protected function getIndexBySimCodeEq "author: marcusw Just a small helper function to get the index of a SimEqSystem." input SimCode.SimEqSystem iEq; output Integer oIdx; @@ -6557,7 +6551,6 @@ algorithm end match; end getIndexBySimCodeEq; - protected function getSimCodeEqsByTaskList "author: marcusw Get the simCode.SimEqSystem - objects references by the given tasks." input list iTaskList; @@ -6592,7 +6585,6 @@ algorithm end match; end getSimCodeEqsByTaskList0; - public function dumpSimEqSCCMapping "author: marcusw Prints the given mapping out to the console." input array iSccMapping; @@ -6604,7 +6596,6 @@ algorithm print(text + "\n"); end dumpSimEqSCCMapping; - protected function dumpSimEqSCCMapping1 "author: marcusw Helper function of dumpSimEqSCCMapping to print one mapping entry." input Integer iMapping; @@ -6620,9 +6611,7 @@ algorithm oIndexText := (iIndex+1,text); end dumpSimEqSCCMapping1; - -public function dumpSccSimEqMapping "function dumpSccSimEqMapping - author: marcusw +public function dumpSccSimEqMapping "author: marcusw Prints the given mapping out to the console." input array> iSccMapping; protected @@ -6633,9 +6622,7 @@ algorithm print(text + "\n"); end dumpSccSimEqMapping; - -protected function dumpSccSimEqMapping1 "function dumpSccSimEqMapping1 - author: marcusw +protected function dumpSccSimEqMapping1 "author: marcusw Helper function of dumpSccSimEqMapping to print one mapping list." input list iMapping; input tuple iIndexText; @@ -6650,9 +6637,7 @@ algorithm oIndexText := (iIndex+1,text); end dumpSccSimEqMapping1; - -protected function dumpSccSimEqMapping2 "function dumpSccSimEqMapping2 - author: marcusw +protected function dumpSccSimEqMapping2 "author: marcusw Helper function of dumpSccSimEqMapping1 to print one mapping element." input Integer iIndex; input String iText; @@ -6661,5 +6646,6 @@ algorithm oText := iText + intString(iIndex) + " "; end dumpSccSimEqMapping2; + annotation(__OpenModelica_Interface="backend"); end HpcOmTaskGraph; diff --git a/Compiler/SimCode/HpcOmSimCodeMain.mo b/Compiler/SimCode/HpcOmSimCodeMain.mo index 5e3109dd9ff..5d0a4183f5d 100644 --- a/Compiler/SimCode/HpcOmSimCodeMain.mo +++ b/Compiler/SimCode/HpcOmSimCodeMain.mo @@ -64,8 +64,8 @@ protected import SimCodeFunctionUtil; protected import System; protected import Util; -public function createSimCode "function createSimCode - entry point to create SimCode from BackendDAE." +public function createSimCode " + Entry point to create SimCode from BackendDAE." input BackendDAE.BackendDAE inBackendDAE; input BackendDAE.BackendDAE inInitDAE; input Boolean inUseHomotopy "true if homotopy(...) is used during initialization"; @@ -342,9 +342,9 @@ algorithm end match; end createAndExportInitialSystemTaskGraph; -protected function setNumProc "sets the number of processors. its upper limit is the number of processsors provided by the system. -if no n-flag is set, a ideal number is suggested but the simulation fails. -author: Waurich TUD 2013-11" +protected function setNumProc "author: Waurich TUD 2013-11 + Sets the number of processors. its upper limit is the number of processsors provided by the system. + If no n-flag is set, a ideal number is suggested but the simulation fails." input Integer numProcFlag; input Real cpCosts; input HpcOmTaskGraph.TaskGraphMeta taskGraphMetaIn; @@ -389,8 +389,9 @@ algorithm end setNumProc; -public function applyGRS"applies several task graph rewriting rules to merge tasks. builds a new incidence matrix for the task graph after finishing their merging -author:Waurich 2014-11" +public function applyGRS "author: Waurich 2014-11 + Applies several task graph rewriting rules to merge tasks. builds a new incidence matrix for the + task graph after finishing their merging." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; output HpcOmTaskGraph.TaskGraph oTaskGraph; @@ -427,8 +428,8 @@ protected end applyGRS; -public function applyGRS1"applies several task graph rewriting rules to merge tasks. -author:Waurich 2014-11" +public function applyGRS1 "author: Waurich 2014-11 + Applies several task graph rewriting rules to merge tasks." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraph iTaskGraphT; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -456,8 +457,8 @@ algorithm end match; end applyGRS1; -public function applyGRSForScheduler "applies graph rewriting rules that are specific for the scheduler. -author:mwalther 2014-12" +public function applyGRSForScheduler "author:mwalther 2014-12 + applies graph rewriting rules that are specific for the scheduler." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraph iTaskGraphT; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; @@ -485,8 +486,8 @@ algorithm end matchcontinue; end applyGRSForScheduler; -public function applyGRSForLevelFixScheduler "merges all tasks of one and the same level together, if the execution costs are below 2000 cycles -author:mwalther 2014-12" +public function applyGRSForLevelFixScheduler "author:mwalther 2014-12 + merges all tasks of one and the same level together, if the execution costs are below 2000 cycles" input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; input array iContractedTasks; //previously contracted nodes input list> iLevelNodes; //all nodes of all levels @@ -523,8 +524,8 @@ algorithm end match; end applyGRSForLevelFixScheduler; -public function applyGRSForLevelFixSchedulerLevel "merges small and big nodes of the same level into one, until they reach a critical size -author:mwalther 2014-12" +public function applyGRSForLevelFixSchedulerLevel "author:mwalther 2014-12 + merges small and big nodes of the same level into one, until they reach a critical size" input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; input array iContractedTasks; input Integer iCriticalSize; @@ -659,8 +660,8 @@ algorithm end GRS_newGraph2; -protected function createSchedule "create a schedule for the given task graph and the given number of processors. -author: mwalther, Waurich TUD" +protected function createSchedule "author: mwalther, Waurich TUD + create a schedule for the given task graph and the given number of processors." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; input array> iSccSimEqMapping; @@ -695,8 +696,8 @@ algorithm oSchedule := HpcOmScheduler.expandSchedule(iNumProc, numProcToUse, tmpSchedule); end createSchedule; -protected function createSchedule1 "check if the given scheduler is known and create it, otherwise fail -author: mwalther, Waurich TUD" +protected function createSchedule1 "author: mwalther, Waurich TUD + check if the given scheduler is known and create it, otherwise fail" input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; input array> iSccSimEqMapping; @@ -814,9 +815,9 @@ end createSchedule1; //------------------------------------------ //------------------------------------------ -protected function checkOdeSystemSize "Compares the number of components in the graph with the number of ode-equations in the simCode-structure. -Remark: this can occur when asserts are added to the ode-system. -author:marcusw" +protected function checkOdeSystemSize "author:marcusw + Compares the number of components in the graph with the number of ode-equations in the simCode-structure. +Remark: this can occur when asserts are added to the ode-system." input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; input list> iOdeEqs; input array> iSccSimEqMapping; @@ -849,8 +850,8 @@ algorithm end if; end checkOdeSystemSize; -protected function checkTaskGraphMetaConsistency "Check if the number of nodes in task graph meta is equal to the number of nodes in the task graph. -author:marcusw" +protected function checkTaskGraphMetaConsistency "author:marcusw + Check if the number of nodes in task graph meta is equal to the number of nodes in the task graph." input HpcOmTaskGraph.TaskGraph iTaskGraph; input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; input String iSystemName; @@ -869,8 +870,8 @@ algorithm end if; end checkTaskGraphMetaConsistency; -protected function checkEquationCount "Check if the number of equations in the nodes of the task graph is equal to the given expected number. -author:marcusw" +protected function checkEquationCount "author:marcusw + Check if the number of equations in the nodes of the task graph is equal to the given expected number." input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta; input String iSystemName; input Integer iExpectedNumberOfEqs; @@ -901,9 +902,9 @@ algorithm end checkEquationCount; /* -protected function repeatScheduleWithOtherNumProc"checks if the scheduling with the given numProc is fine. - if n=auto, more cores are available and more speedup could be achieved repeat schedule with increased num of procs. - author:Waurich TUD 2013-011" +protected function repeatScheduleWithOtherNumProc "author:Waurich TUD 2013-011 + checks if the scheduling with the given numProc is fine. + if n=auto, more cores are available and more speedup could be achieved repeat schedule with increased num of procs." input HpcOmTaskGraph.TaskGraph taskGraphIn; input HpcOmTaskGraph.TaskGraphMeta taskGraphMetaIn; input array> sccSimEqMappingIn; @@ -925,9 +926,9 @@ algorithm end repeatScheduleWithOtherNumProc; -protected function repeatScheduleWithOtherNumProc1"checks if the scheduling with the given numProc is fine. - if n=auto, more cores are available and more speedup could be achieved repeat schedule with increased num of procs. - author:Waurich TUD 2013-011" +protected function repeatScheduleWithOtherNumProc1 "author:Waurich TUD 2013-011 + checks if the scheduling with the given numProc is fine. + if n=auto, more cores are available and more speedup could be achieved repeat schedule with increased num of procs." input HpcOmTaskGraph.TaskGraph taskGraphIn; input HpcOmTaskGraph.TaskGraphMeta taskGraphMetaIn; input BackendDAE.BackendDAE inDAE; @@ -988,8 +989,8 @@ end repeatScheduleWithOtherNumProc1; // output data about operations in equations and composition of systems of equations //---------------------------- -public function outputTimeBenchmark"outputs infos about all equations and equationsystems of the strongComponents. -author:Waurich TUD " +public function outputTimeBenchmark "author:Waurich TUD + outputs infos about all equations and equationsystems of the strongComponents." input HpcOmTaskGraph.TaskGraphMeta graphData; input BackendDAE.BackendDAE dae; protected @@ -1006,8 +1007,8 @@ algorithm print("finish cost benchmark\n"); end outputTimeBenchmark; -protected function outputTimeBenchmark2"traverses all comps and compares measured and estimated execosts. -author:Waurich TUD 2014-12" +protected function outputTimeBenchmark2 "author:Waurich TUD 2014-12 + traverses all comps and compares measured and estimated execosts." input list compsIn; input list numCycles; input list eqSystemsIn;