Skip to content

Commit

Permalink
- Skeleton for external hpcom-Scheduler added
Browse files Browse the repository at this point in the history
- critical path' will now be displayed with gray edges in the task graphs
- PN-Converter for task graphs added to the hpcom-testsuite
- made some hpcom profiling updates

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17465 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Marcus Walther committed Oct 1, 2013
1 parent de38cd3 commit c473808
Show file tree
Hide file tree
Showing 10 changed files with 1,112 additions and 756 deletions.
32 changes: 32 additions & 0 deletions Compiler/BackEnd/HpcOmScheduler.mo
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ encapsulated package HpcOmScheduler

public import HpcOmTaskGraph;

protected import HpcOmSchedulerExt;
protected import List;
protected import Util;

Expand Down Expand Up @@ -1217,6 +1218,37 @@ algorithm
oLevel := iLevel + 1;
end printLevelSchedule1;

//--------------------
// External Scheduling
//--------------------
public function createExtSchedule "function createExtSchedule
author: marcusw
Creates a scheduling by reading the required informations from a graphml-file."
input HpcOmTaskGraph.TaskGraphMeta iMeta;
input array<list<Integer>> iSccSimEqMapping; //Maps each scc to a list of simEqs
input String iGraphMLFile; //the file containing schedule-informations
output Schedule oSchedule;
protected
list<Integer> extInfo;
array<Integer> extInfoArr;

algorithm
oSchedule := match(iMeta,iSccSimEqMapping,iGraphMLFile)
case(_,_,_)
equation
extInfo = HpcOmSchedulerExt.readScheduleFromGraphMl(iGraphMLFile);
extInfoArr = listArray(extInfo);
true = intEq(arrayLength(iSccSimEqMapping),arrayLength(extInfoArr));
print("External scheduling info: " +& stringDelimitList(List.map(extInfo, intString), ",") +& "\n");
print("HpcOmScheduler.createExtSchedule not implemented\n");
then fail();
else
equation
print("HpcOmScheduler.createExtSchedule not every node has a schduler-info.\n");
then fail();
end match;
end createExtSchedule;

//-----
// Util
//-----
Expand Down
47 changes: 47 additions & 0 deletions Compiler/BackEnd/HpcOmSchedulerExt.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-CurrentYear, Linköping University,
* Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3
* AND THIS OSMC PUBLIC LICENSE (OSMC-PL).
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S
* ACCEPTANCE OF THE OSMC PUBLIC LICENSE.
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Linköping University, either from the above address,
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or
* http://www.openmodelica.org, and in the OpenModelica distribution.
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
*
* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS
* OF OSMC-PL.
*
* See the full OSMC Public License conditions for more details.
*
*/

encapsulated package HpcOmSchedulerExt
" file: HpcOmSchedulerExt.mo
package: HpcOmSchedulerExt
description: Reads schedule-informations from external files.
RCS: $Id: HpcOmSchedulerExt.mo 2013-09-27 marcusw $
"

public function readScheduleFromGraphMl
input String filename;
output list<Integer> res;
external "C" res=HpcOmSchedulerExt_readScheduleFromGraphMl(filename) annotation(Library = "omcruntime");
end readScheduleFromGraphMl;

end HpcOmSchedulerExt;
37 changes: 22 additions & 15 deletions Compiler/BackEnd/HpcOmSimCode.mo
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ algorithm
String fileName, fileNamePrefix;
HpcOmTaskGraph.TaskGraphMeta taskGraphData1;
list<list<Integer>> parallelSets;
list<list<Integer>> criticalPaths;
Real cpCosts;
list<list<Integer>> criticalPaths, criticalPathsWoC;
Real cpCosts, cpCostsWoC;

//Additional informations to append SimCode
list<DAE.Exp> simCodeLiterals;
Expand Down Expand Up @@ -186,7 +186,7 @@ algorithm

fileName = ("taskGraph"+&filenamePrefix+&".graphml");
schedulerInfo = arrayCreate(arrayLength(taskGraph), (-1,-1));
HpcOmTaskGraph.dumpAsGraphMLSccLevel(taskGraph, taskGraphData, fileName, "", {}, sccSimEqMapping ,schedulerInfo);
HpcOmTaskGraph.dumpAsGraphMLSccLevel(taskGraph, taskGraphData, fileName, "", {}, {}, sccSimEqMapping ,schedulerInfo);

//Create Costs
//------------
Expand All @@ -207,11 +207,11 @@ algorithm

//Assign levels and get critcal path
//----------------------------------
(criticalPaths,cpCosts,parallelSets) = HpcOmTaskGraph.longestPathMethod(taskGraphOde,taskGraphDataOde);
criticalPathInfo = HpcOmTaskGraph.dumpCriticalPathInfo(criticalPaths,cpCosts);
((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC),parallelSets) = HpcOmTaskGraph.longestPathMethod(taskGraphOde,taskGraphDataOde);
criticalPathInfo = HpcOmTaskGraph.dumpCriticalPathInfo((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC));
fileName = ("taskGraph"+&filenamePrefix+&"ODE.graphml");
schedulerInfo = arrayCreate(arrayLength(taskGraphOde), (-1,-1));
HpcOmTaskGraph.dumpAsGraphMLSccLevel(taskGraphOde, taskGraphDataOde, fileName, criticalPathInfo, HpcOmTaskGraph.convertNodeListToEdgeTuples(List.first(criticalPaths)), sccSimEqMapping, schedulerInfo);
HpcOmTaskGraph.dumpAsGraphMLSccLevel(taskGraphOde, taskGraphDataOde, fileName, criticalPathInfo, HpcOmTaskGraph.convertNodeListToEdgeTuples(List.first(criticalPaths)), HpcOmTaskGraph.convertNodeListToEdgeTuples(List.first(criticalPathsWoC)), sccSimEqMapping, schedulerInfo);

//Apply filters
//-------------
Expand All @@ -221,17 +221,18 @@ algorithm

//Create schedule
//---------------
schedule = createSchedule(taskGraph1,taskGraphData1,sccSimEqMapping);
schedule = createSchedule(taskGraph1,taskGraphData1,sccSimEqMapping,filenamePrefix);
taskScheduleSimCode = HpcOmScheduler.convertScheduleToSimCodeSchedule(schedule);

fileName = ("taskGraph"+&filenamePrefix+&"ODE_schedule.graphml");
schedulerInfo = HpcOmScheduler.convertScheduleStrucToInfo(schedule,arrayLength(taskGraph));
// That's failing
//(criticalPaths,cpCosts,parallelSets) = HpcOmTaskGraph.longestPathMethod(taskGraph1,taskGraphData1);
//criticalPathInfo = HpcOmTaskGraph.dumpCriticalPathInfo(criticalPaths,cpCosts);
//((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC),parallelSets) = HpcOmTaskGraph.longestPathMethod(taskGraph1,taskGraphData1);
//criticalPathInfo = HpcOmTaskGraph.dumpCriticalPathInfo((criticalPaths,cpCosts),(criticalPathsWoC,cpCostsWoC));
criticalPathInfo = "";
criticalPaths = {{}};
HpcOmTaskGraph.dumpAsGraphMLSccLevel(taskGraph1, taskGraphData1, fileName, criticalPathInfo, HpcOmTaskGraph.convertNodeListToEdgeTuples(List.first(criticalPaths)), sccSimEqMapping, schedulerInfo);
criticalPathsWoC = {{}};
HpcOmTaskGraph.dumpAsGraphMLSccLevel(taskGraph1, taskGraphData1, fileName, criticalPathInfo, HpcOmTaskGraph.convertNodeListToEdgeTuples(List.first(criticalPaths)), HpcOmTaskGraph.convertNodeListToEdgeTuples(List.first(criticalPathsWoC)), sccSimEqMapping, schedulerInfo);
//HpcOmScheduler.printSchedule(taskSchedule);

//print("Parallel informations:\n");
Expand Down Expand Up @@ -291,27 +292,33 @@ protected function createSchedule
input HpcOmTaskGraph.TaskGraph iTaskGraph;
input HpcOmTaskGraph.TaskGraphMeta iTaskGraphMeta;
input array<list<Integer>> iSccSimEqMapping;
input String iFilenamePrefix;
output HpcOmScheduler.Schedule oSchedule;
protected
String flagValue;
Integer numProc;
HpcOmTaskGraph.TaskGraph taskGraph1;
HpcOmTaskGraph.TaskGraphMeta taskGraphMeta1;
algorithm
oSchedule := matchcontinue(iTaskGraph,iTaskGraphMeta,iSccSimEqMapping)
case(_,_,_)
oSchedule := matchcontinue(iTaskGraph,iTaskGraphMeta,iSccSimEqMapping,iFilenamePrefix)
case(_,_,_,_)
equation
flagValue = Flags.getConfigString(Flags.HPCOM_SCHEDULER);
true = stringEq(flagValue, "level");
then HpcOmScheduler.createLevelSchedule(iTaskGraphMeta,iSccSimEqMapping);
case(_,_,_)
case(_,_,_,_)
equation
flagValue = Flags.getConfigString(Flags.HPCOM_SCHEDULER);
true = stringEq(flagValue, "ext");
numProc = Flags.getConfigInt(Flags.NUM_PROC);
then HpcOmScheduler.createExtSchedule(iTaskGraphMeta, iSccSimEqMapping, "taskGraph" +& iFilenamePrefix +& "_ext.graphml");
case(_,_,_,_)
equation
flagValue = Flags.getConfigString(Flags.HPCOM_SCHEDULER);
true = stringEq(flagValue, "listr");
numProc = Flags.getConfigInt(Flags.NUM_PROC);
print("Using list scheduling reverse\n");
then HpcOmScheduler.createListScheduleReverse(iTaskGraph,iTaskGraphMeta,numProc,iSccSimEqMapping);
case(_,_,_)
case(_,_,_,_)
equation
numProc = Flags.getConfigInt(Flags.NUM_PROC);
then HpcOmScheduler.createListSchedule(iTaskGraph,iTaskGraphMeta,numProc,iSccSimEqMapping);
Expand Down

0 comments on commit c473808

Please sign in to comment.