Skip to content

Commit

Permalink
- strings are now handled in arrays as well
Browse files Browse the repository at this point in the history
- initial values are taken from xml file
- number of HPCOM threads can now be variied for different systems (ode, all, zeroFuncs)
- changed Logger::write to LOGGER_WRITE
- changed flag "nls_continue" to "nls-continue"
  • Loading branch information
Marcus Walther committed Sep 9, 2015
1 parent 631897c commit f23c496
Show file tree
Hide file tree
Showing 41 changed files with 1,016 additions and 543 deletions.
103 changes: 64 additions & 39 deletions Compiler/BackEnd/HpcOmMemory.mo

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions Compiler/BackEnd/HpcOmScheduler.mo
Expand Up @@ -6758,6 +6758,32 @@ 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"
input Integer iNumProc;
input Integer iNumUsedProc;
input HpcOmSimCode.Schedule iSchedule;
output HpcOmSimCode.Schedule oSchedule;
protected
array<list<HpcOmSimCode.Task>> threadTasks;
list<HpcOmSimCode.Task> outgoingDepTasks;
list<HpcOmSimCode.Task> scheduledTasks;
array<tuple<HpcOmSimCode.Task, Integer>> allCalcTasks;
algorithm
oSchedule := match(iNumProc, iNumUsedProc, iSchedule)
case(_,_,HpcOmSimCode.LEVELSCHEDULE())
then iSchedule;
case(_,_,HpcOmSimCode.THREADSCHEDULE(threadTasks=threadTasks,outgoingDepTasks=outgoingDepTasks,scheduledTasks=scheduledTasks,allCalcTasks=allCalcTasks))
equation
threadTasks = Array.expandToSize(iNumProc, threadTasks, {});
then HpcOmSimCode.THREADSCHEDULE(threadTasks,outgoingDepTasks,scheduledTasks,allCalcTasks);
case(_,_,HpcOmSimCode.TASKDEPSCHEDULE())
then iSchedule;
case(_,_,HpcOmSimCode.EMPTYSCHEDULE())
then iSchedule;
end match;
end expandSchedule;

annotation(__OpenModelica_Interface="backend");
end HpcOmScheduler;
1 change: 1 addition & 0 deletions Compiler/SimCode/HpcOmSimCode.mo
Expand Up @@ -47,6 +47,7 @@ uniontype MemoryMap //stores information to organize the memory for the parallel
Integer floatArraySize; //array size including state, state der and other float variables that are necessary for code generation
Integer intArraySize;
Integer boolArraySize;
Integer stringArraySize;
end MEMORYMAP_ARRAY;
record MEMORYMAP_UNIFORM
end MEMORYMAP_UNIFORM;
Expand Down
18 changes: 13 additions & 5 deletions Compiler/SimCode/HpcOmSimCodeMain.mo
Expand Up @@ -333,17 +333,17 @@ algorithm
numProc = Flags.getConfigInt(Flags.NUM_PROC);
(numProc,_) = setNumProc(numProc,cpCostsWoC,taskGraphDataOde);//in case n-flag is not set

(scheduleDae,simCode,taskGraphDaeScheduled,taskGraphDataDaeScheduled,sccSimEqMapping) = createSchedule(taskGraphDaeSimplified,taskGraphDataDaeSimplified,daeSccSimEqMapping,simVarMapping,filenamePrefix,numProc,simCode,scheduledTasksDae,"DAE system",Flags.getConfigString(Flags.HPCOM_SCHEDULER));
(scheduleDae,simCode,taskGraphDaeScheduled,taskGraphDataDaeScheduled,sccSimEqMapping) = createSchedule(taskGraphDaeSimplified,taskGraphDataDaeSimplified,daeSccSimEqMapping,simVarMapping,filenamePrefix,numProc,numProc,simCode,scheduledTasksDae,"DAE system",Flags.getConfigString(Flags.HPCOM_SCHEDULER));
//HpcOmScheduler.printSchedule(scheduleDae);
//schedulerInfo = HpcOmScheduler.convertScheduleStrucToInfo(scheduleDae,arrayLength(taskGraphDaeScheduled));
//HpcOmTaskGraph.dumpAsGraphMLSccLevel(taskGraphDaeScheduled, taskGraphDataDaeScheduled, "taskGraph"+filenamePrefix+"DAE_scheduled.graphml", "", HpcOmTaskGraph.convertNodeListToEdgeTuples(listHead(criticalPaths)), HpcOmTaskGraph.convertNodeListToEdgeTuples(listHead(criticalPathsWoC)), sccSimEqMapping, schedulerInfo, HpcOmTaskGraph.GRAPHDUMPOPTIONS(false,false,false,false));

(scheduleOde,simCode,taskGraphOdeScheduled,taskGraphDataOdeScheduled,sccSimEqMapping) = createSchedule(taskGraphOdeSimplified,taskGraphDataOdeSimplified,sccSimEqMapping,simVarMapping,filenamePrefix,numProc,simCode,scheduledTasksOde,"ODE system",Flags.getConfigString(Flags.HPCOM_SCHEDULER));
(scheduleOde,simCode,taskGraphOdeScheduled,taskGraphDataOdeScheduled,sccSimEqMapping) = createSchedule(taskGraphOdeSimplified,taskGraphDataOdeSimplified,sccSimEqMapping,simVarMapping,filenamePrefix,numProc,numProc,simCode,scheduledTasksOde,"ODE system",Flags.getConfigString(Flags.HPCOM_SCHEDULER));
//HpcOmScheduler.printSchedule(scheduleOde);
//schedulerInfo = HpcOmScheduler.convertScheduleStrucToInfo(scheduleOde,arrayLength(taskGraphOdeScheduled));
//HpcOmTaskGraph.dumpAsGraphMLSccLevel(taskGraphOdeScheduled, taskGraphDataOdeScheduled, "taskGraph"+filenamePrefix+"ODE_scheduled.graphml", "", HpcOmTaskGraph.convertNodeListToEdgeTuples(listHead(criticalPaths)), HpcOmTaskGraph.convertNodeListToEdgeTuples(listHead(criticalPathsWoC)), sccSimEqMapping, schedulerInfo, HpcOmTaskGraph.GRAPHDUMPOPTIONS(false,false,false,false));

(scheduleZeroFunc,simCode,taskGraphZeroFuncScheduled,taskGraphDataZeroFuncScheduled,sccSimEqMapping) = createSchedule(taskGraphZeroFuncSimplified,taskGraphDataZeroFuncSimplified,daeSccSimEqMapping,simVarMapping,filenamePrefix,numProc,simCode,scheduledTasksZeroFunc,"ZeroFunc system",Flags.getConfigString(Flags.HPCOM_SCHEDULER));
(scheduleZeroFunc,simCode,taskGraphZeroFuncScheduled,taskGraphDataZeroFuncScheduled,sccSimEqMapping) = createSchedule(taskGraphZeroFuncSimplified,taskGraphDataZeroFuncSimplified,daeSccSimEqMapping,simVarMapping,filenamePrefix,numProc,numProc,simCode,scheduledTasksZeroFunc,"ZeroFunc system",Flags.getConfigString(Flags.HPCOM_SCHEDULER));
//HpcOmScheduler.printSchedule(scheduleZeroFunc);
//schedulerInfo = HpcOmScheduler.convertScheduleStrucToInfo(scheduleZeroFunc,arrayLength(taskGraphZeroFuncScheduled));
//HpcOmTaskGraph.dumpAsGraphMLSccLevel(taskGraphZeroFuncScheduled, taskGraphDataZeroFuncScheduled, "taskGraph"+filenamePrefix+"ZF_scheduled.graphml", "", HpcOmTaskGraph.convertNodeListToEdgeTuples(listHead(criticalPaths)), HpcOmTaskGraph.convertNodeListToEdgeTuples(listHead(criticalPathsWoC)), sccSimEqMapping, schedulerInfo, HpcOmTaskGraph.GRAPHDUMPOPTIONS(false,false,false,false));
Expand Down Expand Up @@ -743,7 +743,8 @@ author: mwalther, Waurich TUD"
input array<list<Integer>> iSccSimEqMapping;
input array<list<SimCodeVar.SimVar>> iSimVarMapping;
input String iFilenamePrefix;
input Integer iNumProc;
input Integer iNumProc; //the max. number of processors
input Integer iNumProcToUse; //the number of processors that should be used to calculate the given task graph (iNumProcToUse <= iNumProc)
input SimCode.SimCode iSimCode;
input list<HpcOmSimCode.Task> iScheduledTasks;
input String iSystemName; //e.g. "ODE system" or "DAE system"
Expand All @@ -756,12 +757,19 @@ author: mwalther, Waurich TUD"
protected
list<String> knownScheduler = {"none","level","levelfix","ext","metis","hmet","listr","rand","list","mcp","part","taskdep","tds","bls","sbs","sts"};
String schedulerName = iSchedulerName;
HpcOmSimCode.Schedule tmpSchedule;
Integer numProcToUse = iNumProcToUse;
algorithm
if(boolNot(List.exist1(knownScheduler,stringEq,schedulerName))) then
print("HpcOmScheduler.createSchedule warning: The scheduler '" + iSchedulerName + "' is unknown. The list-scheduling algorithm is used instead for the " + iSystemName + ".\n");
schedulerName := "list";
end if;
(oSchedule,oSimCode,oTaskGraph,oTaskGraphMeta,oSccSimEqMapping) := createSchedule1(iTaskGraph, iTaskGraphMeta, iSccSimEqMapping, iSimVarMapping, iFilenamePrefix, iNumProc, iSimCode, iScheduledTasks, iSystemName, schedulerName);
if(intGt(iNumProcToUse, iNumProc)) then
print("HpcOmScheduler.createSchedule warning: Cannot schedule the the task graph to " + intString(iNumProcToUse) + " processors, because the number is larger than the available processors (" + intString(iNumProc) + ").\n");
numProcToUse := iNumProc;
end if;
(tmpSchedule,oSimCode,oTaskGraph,oTaskGraphMeta,oSccSimEqMapping) := createSchedule1(iTaskGraph, iTaskGraphMeta, iSccSimEqMapping, iSimVarMapping, iFilenamePrefix, numProcToUse, iSimCode, iScheduledTasks, iSystemName, schedulerName);
oSchedule := HpcOmScheduler.expandSchedule(iNumProc, numProcToUse, tmpSchedule);
end createSchedule;

protected function createSchedule1 "check if the given scheduler is known and create it, otherwise fail
Expand Down

0 comments on commit f23c496

Please sign in to comment.