Skip to content

Commit

Permalink
- added zeroFunc-Schedule to HPCOM
Browse files Browse the repository at this point in the history
- fixed windows msvc build for cpp-runtime
  • Loading branch information
Marcus Walther committed Jul 2, 2015
1 parent 509f225 commit aea876d
Show file tree
Hide file tree
Showing 39 changed files with 1,149 additions and 729 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -141,6 +141,7 @@ Compiler/boot/LoadCompilerInterface.mos
Compiler/boot/Makefile
Compiler/boot/Makefile.depends
Compiler/boot/Makefile.sources
Compiler/boot/patches/*.patch
Compiler/runtime/Makefile
Compiler/runtime/config.unix.h
Compiler/runtime/omc_communication.cc
Expand Down
146 changes: 71 additions & 75 deletions Compiler/BackEnd/HpcOmScheduler.mo

Large diffs are not rendered by default.

263 changes: 206 additions & 57 deletions Compiler/BackEnd/HpcOmTaskGraph.mo

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Compiler/SimCode/HpcOmSimCode.mo
Expand Up @@ -38,7 +38,7 @@ encapsulated package HpcOmSimCode

public uniontype HpcOmData
record HPCOMDATA
Option<tuple<HpcOmSimCode.Schedule, HpcOmSimCode.Schedule>> schedules; //<ode schedule, dae schedule>
Option<tuple<HpcOmSimCode.Schedule, HpcOmSimCode.Schedule, HpcOmSimCode.Schedule>> schedules; //<ode schedule, dae schedule, zeroFunc schedule>
Option<HpcOmSimCode.MemoryMap> hpcOmMemory;
end HPCOMDATA;
end HpcOmData;
Expand Down
329 changes: 178 additions & 151 deletions Compiler/SimCode/HpcOmSimCodeMain.mo

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions Compiler/Template/CodegenC.tpl
Expand Up @@ -2596,7 +2596,7 @@ end functionWhenReinitStatementThen;
// Begin: Modified functions for HpcOm
//------------------------------------

template functionXXX_systems_HPCOM(list<list<SimEqSystem>> eqs, String name, Text &loop, Text &varDecls, Option<tuple<Schedule,Schedule>> hpcOmSchedulesOpt, String modelNamePrefixStr)
template functionXXX_systems_HPCOM(list<list<SimEqSystem>> eqs, String name, Text &loop, Text &varDecls, Option<tuple<Schedule,Schedule,Schedule>> hpcOmSchedulesOpt, String modelNamePrefixStr)
::=
let funcs = (eqs |> eq hasindex i0 fromindex 0 => functionXXX_system_HPCOM(eq,name,i0,hpcOmSchedulesOpt, modelNamePrefixStr) ; separator="\n")
match listLength(eqs)
Expand Down Expand Up @@ -2643,19 +2643,19 @@ template functionXXX_systems_HPCOM(list<list<SimEqSystem>> eqs, String name, Tex
>>
end functionXXX_systems_HPCOM;

template functionXXX_system_HPCOM(list<SimEqSystem> derivativEquations, String name, Integer n, Option<tuple<Schedule,Schedule>> hpcOmSchedulesOpt, String modelNamePrefixStr)
template functionXXX_system_HPCOM(list<SimEqSystem> derivativEquations, String name, Integer n, Option<tuple<Schedule,Schedule,Schedule>> hpcOmSchedulesOpt, String modelNamePrefixStr)
::=
let type = getConfigString(HPCOM_CODE)
match hpcOmSchedulesOpt
case SOME((hpcOmSchedule as EMPTYSCHEDULE(__),_)) then
case SOME((hpcOmSchedule as EMPTYSCHEDULE(__),_,_)) then
<<
void terminateHpcOmThreads()
{
}

<%functionXXX_system(derivativEquations,name,n,modelNamePrefixStr)%>
>>
case SOME((hpcOmSchedule as TASKDEPSCHEDULE(__),_)) then
case SOME((hpcOmSchedule as TASKDEPSCHEDULE(__),_,_)) then
let taskEqs = functionXXX_system0_HPCOM_TaskDep(hpcOmSchedule.tasks, derivativEquations, type, name, modelNamePrefixStr); separator="\n"
<<
void terminateHpcOmThreads()
Expand All @@ -2668,7 +2668,7 @@ template functionXXX_system_HPCOM(list<SimEqSystem> derivativEquations, String n
<%taskEqs%>
}
>>
case SOME((hpcOmSchedule as LEVELSCHEDULE(__),_)) then
case SOME((hpcOmSchedule as LEVELSCHEDULE(__),_,_)) then
let odeEqs = hpcOmSchedule.tasksOfLevels |> tasks => functionXXX_system0_HPCOM_Level(derivativEquations,name,tasks,type,modelNamePrefixStr); separator="\n"
<<
void terminateHpcOmThreads()
Expand All @@ -2685,7 +2685,7 @@ template functionXXX_system_HPCOM(list<SimEqSystem> derivativEquations, String n
}
}
>>
case SOME((hpcOmSchedule as THREADSCHEDULE(__),_)) then
case SOME((hpcOmSchedule as THREADSCHEDULE(__),_,_)) then
let locks = hpcOmSchedule.outgoingDepTasks |> task => function_HPCOM_createLockByDepTask(task, "lock", type); separator="\n"
let initlocks = hpcOmSchedule.outgoingDepTasks |> task => function_HPCOM_initializeLockByDepTask(task, "lock", type); separator="\n"
let assignLocks = hpcOmSchedule.outgoingDepTasks |> task => function_HPCOM_assignLockByDepTask(task, "lock", type); separator="\n"
Expand Down Expand Up @@ -3294,7 +3294,7 @@ match eqlstlst
error(sourceInfo(), 'TODO more than ODE list in <%name%> systems')
end functionXXX_systems_arrayFormat;

template functionODE(list<list<SimEqSystem>> derivativEquations, Text method, Option<tuple<Schedule,Schedule>> hpcOmSchedules, String modelNamePrefix)
template functionODE(list<list<SimEqSystem>> derivativEquations, Text method, Option<tuple<Schedule,Schedule,Schedule>> hpcOmSchedules, String modelNamePrefix)
"Generates function in simulation file."
::=
let () = System.tmpTickReset(0)
Expand Down
13 changes: 9 additions & 4 deletions Compiler/Template/CodegenCpp.tpl
Expand Up @@ -1552,6 +1552,7 @@ let modelname = identOfPath(modelInfo.name)
#include <Core/DataExchange/SimDouble.h>
#include <Core/DataExchange/SimBoolean.h>
#include <Core/SimController/ISimController.h>
#include <Core/System/FactoryExport.h>

#include <wvLib.h>
#define PATH string
Expand Down Expand Up @@ -1859,6 +1860,7 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
#include <Core/ModelicaDefine.h>
#include <Core/Modelica.h>
#include <Core/SimController/ISimController.h>
#include <Core/System/FactoryExport.h>
#include <Core/Utils/extension/logger.hpp>

<%
Expand Down Expand Up @@ -1960,6 +1962,8 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
%>
try
{
Logger::initialize();
Logger::setEnabled(false);
<%if boolNot(stringEq(getConfigString(PROFILING_LEVEL),"none")) then
<<
std::vector<MeasureTimeData> measureTimeArraySimulation = std::vector<MeasureTimeData>(2); //0 all, 1 setup
Expand Down Expand Up @@ -3128,14 +3132,15 @@ match simCode

#ifdef MEASURETIME_MODELFUNCTIONS
MeasureTime::addResultContentBlock("<%dotPath(modelInfo.name)%>","functions",&measureTimeFunctionsArray);
measureTimeFunctionsArray = std::vector<MeasureTimeData>(4); //1 evaluateODE ; 2 evaluateAll; 3 writeOutput; 4 handleTimeEvents
measureTimeFunctionsArray = std::vector<MeasureTimeData>(5); //1 evaluateODE ; 2 evaluateAll; 3 writeOutput; 4 handleTimeEvents; 5 evaluateZeroFuncs
measuredFunctionStartValues = MeasureTime::getZeroValues();
measuredFunctionEndValues = MeasureTime::getZeroValues();

measureTimeFunctionsArray[0] = MeasureTimeData("evaluateODE");
measureTimeFunctionsArray[1] = MeasureTimeData("evaluateAll");
measureTimeFunctionsArray[2] = MeasureTimeData("writeOutput");
measureTimeFunctionsArray[3] = MeasureTimeData("handleTimeEvents");
measureTimeFunctionsArray[4] = MeasureTimeData("evaluateZeroFuncs");
#endif //MEASURETIME_MODELFUNCTIONS
>>
%>
Expand Down Expand Up @@ -14078,7 +14083,7 @@ template createEvaluateAll( list<SimEqSystem> allEquationsPlusWhen,list<SimWhenC
bool state_var_reinitialized = false;

<%varDecls%>
/* Evaluate Equations*/
// Evaluate Equations
<%equation_all_func_calls%>
// Reinits
<%reinit%>
Expand Down Expand Up @@ -14125,7 +14130,7 @@ template createEvaluate(list<list<SimEqSystem>> odeEquations,list<SimWhenClause>
{
<%if createMeasureTime then generateMeasureTimeStartCode("measuredFunctionStartValues", "evaluateODE", "MEASURETIME_MODELFUNCTIONS") else ""%>
<%varDecls%>
/* Evaluate Equations*/
// Evaluate Equations
<%equation_ode_func_calls%>
<%if createMeasureTime then generateMeasureTimeEndCode("measuredFunctionStartValues", "measuredFunctionEndValues", "measureTimeFunctionsArray[0]", "evaluateODE", "MEASURETIME_MODELFUNCTIONS") else ""%>
}
Expand All @@ -14146,7 +14151,7 @@ template createEvaluateZeroFuncs( list<SimEqSystem> equationsForZeroCrossings, S
void <%className%>::evaluateZeroFuncs(const UPDATETYPE command)
{
<%varDecls%>
/* Evaluate Equations*/
// Evaluate Equations
<%equation_zero_func_calls%>
}
>>
Expand Down

0 comments on commit aea876d

Please sign in to comment.