Skip to content

Commit 47d0937

Browse files
author
Marcus Walther
committed
- ModelicaUtilities library added to hpcomAnalyzationMode
- fixed hpcom-list-scheduling of cpp-runtime git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20549 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 0912dbf commit 47d0937

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

Compiler/Template/CodegenCppHpcom.tpl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ template getAddHpcomFunctionHeaders(Option<Schedule> hpcOmScheduleOpt)
180180
<<
181181
>>
182182
else
183-
let headers = hpcOmSchedule.threadTasks |> tt hasindex i0 fromindex 0 => generateThreadFunctionHeaderDecl(i0); separator="\n"
183+
let headers = arrayList(hpcOmSchedule.threadTasks) |> tt hasindex i0 fromindex 0 => generateThreadFunctionHeaderDecl(i0); separator="\n"
184184
<<
185185
<%headers%>
186186
>>
@@ -228,16 +228,16 @@ template getAddHpcomVarHeaders(Option<Schedule> hpcOmScheduleOpt)
228228
else ''
229229
case SOME(hpcOmSchedule as THREADSCHEDULE(__)) then
230230
let locks = hpcOmSchedule.lockIdc |> idx => function_HPCOM_createLock(idx, "lock", type); separator="\n"
231-
let threadDecl = hpcOmSchedule.threadTasks |> tt hasindex i0 fromindex 0 => generateThreadHeaderDecl(i0, type); separator="\n"
231+
let threadDecl = arrayList(hpcOmSchedule.threadTasks) |> tt hasindex i0 fromindex 0 => generateThreadHeaderDecl(i0, type); separator="\n"
232232
match type
233233
case ("openmp") then
234234
<<
235235
<%locks%>
236236
<%threadDecl%>
237237
>>
238238
else
239-
let thLocks = hpcOmSchedule.threadTasks |> tt hasindex i0 fromindex 0 => function_HPCOM_createLock(i0, "th_lock", type); separator="\n"
240-
let thLocks1 = hpcOmSchedule.threadTasks |> tt hasindex i0 fromindex 0 => function_HPCOM_createLock(i0, "th_lock1", type); separator="\n"
239+
let thLocks = arrayList(hpcOmSchedule.threadTasks) |> tt hasindex i0 fromindex 0 => function_HPCOM_createLock(i0, "th_lock", type); separator="\n"
240+
let thLocks1 = arrayList(hpcOmSchedule.threadTasks) |> tt hasindex i0 fromindex 0 => function_HPCOM_createLock(i0, "th_lock1", type); separator="\n"
241241
<<
242242
bool terminateThreads;
243243
UPDATETYPE command;
@@ -548,7 +548,7 @@ template getHpcomConstructorExtension(Option<Schedule> hpcOmScheduleOpt, String
548548
case SOME(hpcOmSchedule as THREADSCHEDULE(__)) then
549549
let initlocks = hpcOmSchedule.lockIdc |> idx => function_HPCOM_initializeLock(idx, "lock", type); separator="\n"
550550
let assignLocks = hpcOmSchedule.lockIdc |> idx => function_HPCOM_assignLock(idx, "lock", type); separator="\n"
551-
let threadFuncs = hpcOmSchedule.threadTasks |> tt hasindex i0 fromindex 0 => generateThread(i0, type, modelNamePrefixStr,"evaluateThreadFunc"); separator="\n"
551+
let threadFuncs = arrayList(hpcOmSchedule.threadTasks) |> tt hasindex i0 fromindex 0 => generateThread(i0, type, modelNamePrefixStr,"evaluateThreadFunc"); separator="\n"
552552
match type
553553
case ("openmp") then
554554
<<
@@ -557,10 +557,10 @@ template getHpcomConstructorExtension(Option<Schedule> hpcOmScheduleOpt, String
557557
<%assignLocks%>
558558
>>
559559
else
560-
let threadLocksInit = hpcOmSchedule.threadTasks |> tt hasindex i0 fromindex 0 => function_HPCOM_initializeLock(i0, "th_lock", type); separator="\n"
561-
let threadLocksInit1 = hpcOmSchedule.threadTasks |> tt hasindex i0 fromindex 0 => function_HPCOM_initializeLock(i0, "th_lock1", type); separator="\n"
562-
let threadAssignLocks = hpcOmSchedule.threadTasks |> tt hasindex i0 fromindex 0 => function_HPCOM_assignLock(i0, "th_lock", type); separator="\n"
563-
let threadAssignLocks1 = hpcOmSchedule.threadTasks |> tt hasindex i0 fromindex 0 => function_HPCOM_assignLock(i0, "th_lock1", type); separator="\n"
560+
let threadLocksInit = arrayList(hpcOmSchedule.threadTasks) |> tt hasindex i0 fromindex 0 => function_HPCOM_initializeLock(i0, "th_lock", type); separator="\n"
561+
let threadLocksInit1 = arrayList(hpcOmSchedule.threadTasks) |> tt hasindex i0 fromindex 0 => function_HPCOM_initializeLock(i0, "th_lock1", type); separator="\n"
562+
let threadAssignLocks = arrayList(hpcOmSchedule.threadTasks) |> tt hasindex i0 fromindex 0 => function_HPCOM_assignLock(i0, "th_lock", type); separator="\n"
563+
let threadAssignLocks1 = arrayList(hpcOmSchedule.threadTasks) |> tt hasindex i0 fromindex 0 => function_HPCOM_assignLock(i0, "th_lock1", type); separator="\n"
564564
<<
565565
terminateThreads = false;
566566
command = IContinuous::UNDEF_UPDATE;
@@ -748,9 +748,9 @@ template update2(list<SimEqSystem> allEquationsPlusWhen, Absyn.Path name, list<S
748748
}
749749
>>
750750
else
751-
let threadFuncs = hpcOmSchedule.threadTasks |> tt hasindex i0 fromindex 0 => generateThreadFunc(allEquationsPlusWhen, hpcOmSchedule.threadTasks, type, i0, modelNamePrefixStr, &varDecls, simCode); separator="\n"
752-
let threadAssignLocks1 = hpcOmSchedule.threadTasks |> tt hasindex i0 fromindex 0 => function_HPCOM_assignLock(i0, "th_lock1", type); separator="\n"
753-
let threadReleaseLocks = hpcOmSchedule.threadTasks |> tt hasindex i0 fromindex 0 => function_HPCOM_releaseLock(i0, "th_lock", type); separator="\n"
751+
let threadFuncs = arrayList(hpcOmSchedule.threadTasks) |> tt hasindex i0 fromindex 0 => generateThreadFunc(allEquationsPlusWhen, hpcOmSchedule.threadTasks, type, i0, modelNamePrefixStr, &varDecls, simCode); separator="\n"
752+
let threadAssignLocks1 = arrayList(hpcOmSchedule.threadTasks) |> tt hasindex i0 fromindex 0 => function_HPCOM_assignLock(i0, "th_lock1", type); separator="\n"
753+
let threadReleaseLocks = arrayList(hpcOmSchedule.threadTasks) |> tt hasindex i0 fromindex 0 => function_HPCOM_releaseLock(i0, "th_lock", type); separator="\n"
754754
<<
755755
756756
<%threadFuncs%>
@@ -937,7 +937,7 @@ end function_HPCOM_Thread;
937937
template generateThreadFunc(list<SimEqSystem> allEquationsPlusWhen, array<list<Task>> threadTasks, String iType, Integer idx, String modelNamePrefixStr, Text &varDecls, SimCode simCode)
938938
::=
939939
let &varDeclsLoc = buffer "" /*BUFD*/
940-
let taskEqs = function_HPCOM_Thread0(allEquationsPlusWhen, arrayGet(threadTasks,idx), iType, &varDeclsLoc, simCode); separator="\n"
940+
let taskEqs = function_HPCOM_Thread0(allEquationsPlusWhen, arrayGet(threadTasks,intAdd(idx,1)), iType, &varDeclsLoc, simCode); separator="\n"
941941
let assLock = function_HPCOM_assignLock(idx, "th_lock", iType); separator="\n"
942942
let relLock = function_HPCOM_releaseLock(idx, "th_lock1", iType); separator="\n"
943943
<<
@@ -1321,7 +1321,7 @@ let _extraCflags = match sopt case SOME(s as SIMULATION_SETTINGS(__)) then
13211321
case "inline-rungekutta" then "-D_OMC_INLINE_RK"%>'
13221322
let extraCflags = '<%_extraCflags%><% if Flags.isSet(Flags.GEN_DEBUG_SYMBOLS) then " -g"%>'
13231323
1324-
let analyzationLibs = if Flags.isSet(Flags.HPCOM_ANALYZATION_MODE) then '$(LIBOMCPPOMCFACTORY) $(LIBOMCPPSIMCONTROLLER) $(LIBOMCPPSIMULATIONSETTINGS) $(LIBOMCPPSYSTEM) $(LIBOMCPPDATAEXCHANGE) $(LIBOMCPPNEWTON) $(LIBOMCPPKINSOL) $(LIBOMCPPCVODE) $(LIBOMCPPSOLVER) $(LIBOMCPPMATH) $(SUNDIALS_LIBS) $(LAPACK_LIBS)' else '-lOMCppOMCFactory'
1324+
let analyzationLibs = if Flags.isSet(Flags.HPCOM_ANALYZATION_MODE) then '$(LIBOMCPPOMCFACTORY) $(LIBOMCPPSIMCONTROLLER) $(LIBOMCPPSIMULATIONSETTINGS) $(LIBOMCPPSYSTEM) $(LIBOMCPPDATAEXCHANGE) $(LIBOMCPPNEWTON) $(LIBOMCPPKINSOL) $(LIBOMCPPCVODE) $(LIBOMCPPSOLVER) $(LIBOMCPPMATH) $(LIBOMCPPMODELICAUTILITIES) $(SUNDIALS_LIBS) $(LAPACK_LIBS)' else '-lOMCppOMCFactory'
13251325
let _extraCflags = if Flags.isSet(Flags.HPCOM_ANALYZATION_MODE) then '<%extraCflags%> -D ANALYZATION_MODE -I"$(SUNDIALS_INCLUDE)" -I"$(SUNDIALS_INCLUDE)/kinsol" -I"$(SUNDIALS_INCLUDE)/nvector"' else '<%extraCflags%>'
13261326
<<
13271327
# Makefile generated by OpenModelica

SimulationRuntime/cpp/Core/Modelica/ModelicaLibraryConfig.inc.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ LIBOMCPPNEWTON = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@NewtonName@.a"
77
LIBOMCPPKINSOL = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@KinsolName@.a"
88
LIBOMCPPCVODE = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@CVodeName@.a"
99
LIBOMCPPSOLVER = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@SolverName@.a"
10-
LIBOMCPPMATH = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@MathName@.a"
10+
LIBOMCPPMATH = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@MathName@.a"
11+
LIBOMCPPMODELICAUTILITIES = "$(OMHOME)/lib/omc/@LIBINSTALLEXT@/lib@ModelicaUtilitiesName@.a"

0 commit comments

Comments
 (0)