Skip to content

Commit 3c9ddcb

Browse files
author
Willi Braun
committed
- added config flag to deactivate tearing: +noTearing
- added debug flag to deactivate tearing of mixed system: +d=noMixedTearing git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13602 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 01bffef commit 3c9ddcb

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

Compiler/BackEnd/BackendDAEOptimize.mo

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9226,6 +9226,7 @@ public function tearingSystemNew "function tearingSystem
92269226
input BackendDAE.BackendDAE inDAE;
92279227
output BackendDAE.BackendDAE outDAE;
92289228
algorithm
9229+
false := Flags.getConfigBool(Flags.NO_TEARING);
92299230
(outDAE,_) := BackendDAEUtil.mapEqSystemAndFold(inDAE,tearingSystemNew0,false);
92309231
end tearingSystemNew;
92319232

@@ -9285,11 +9286,15 @@ algorithm
92859286
(acc,b1);
92869287
case (_,_,(comp as BackendDAE.MIXEDEQUATIONSYSTEM(condSystem=comp1,disc_eqns=eindex,disc_vars=vindx))::comps,_,_)
92879288
equation
9288-
// only mixed part
9289-
//(_,_) = tearingSystemNew1_1(isyst,ishared,eindex,vindx,NONE(),BackendDAE.JAC_NO_ANALYTIC());
9289+
true = Flags.isSet(Flags.NO_MIXED_TEARING);
92909290
// only continues part
9291-
//(comp1::{},true) = tearingSystemNew1(isyst,ishared,{comp1},false,{});
9292-
//(acc,b1) = tearingSystemNew1(isyst,ishared,comps,true,BackendDAE.MIXEDEQUATIONSYSTEM(comp1,eindex,vindx)::iAcc);
9291+
(comp1::{},true) = tearingSystemNew1(isyst,ishared,{comp1},false,{});
9292+
(acc,b1) = tearingSystemNew1(isyst,ishared,comps,true,BackendDAE.MIXEDEQUATIONSYSTEM(comp1,eindex,vindx)::iAcc);
9293+
then
9294+
(acc,b1);
9295+
case (_,_,(comp as BackendDAE.MIXEDEQUATIONSYSTEM(condSystem=comp1,disc_eqns=eindex,disc_vars=vindx))::comps,_,_)
9296+
equation
9297+
false = Flags.isSet(Flags.NO_MIXED_TEARING);
92939298
// mixed and continues part
92949299
(eindex,vindx) = BackendDAETransform.getEquationAndSolvedVarIndxes(comp);
92959300
(comp1,true) = tearingSystemNew1_1(isyst,ishared,eindex,vindx,NONE(),BackendDAE.JAC_NO_ANALYTIC());

Compiler/Util/Flags.mo

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,10 @@ constant DebugFlag UNCERTAINTIES = DEBUG_FLAG(99, "uncertainties",
364364
constant DebugFlag DUMP_DAE= DEBUG_FLAG(100, "daeunparser",
365365
Util.gettext("Enables dumping of the DAE"));
366366
constant DebugFlag SHOW_START_ORIGIN = DEBUG_FLAG(101, "showStartOrigin",
367-
Util.gettext("Enables dumping of the DAE startOrigin attribute of the variables"));
368-
367+
Util.gettext("Enables dumping of the DAE startOrigin attribute of the variables"));
368+
// The flags mixedTearing are only needed as long tearing of mixed system in not default.
369+
constant DebugFlag NO_MIXED_TEARING = DEBUG_FLAG(102, "noMixedTearing",
370+
Util.gettext("Disables tearing of mixed system."));
369371

370372
// This is a list of all debug flags, to keep track of which flags are used. A
371373
// flag can not be used unless it's in this list, and the list is checked at
@@ -472,7 +474,8 @@ constant list<DebugFlag> allDebugFlags = {
472474
SEMILINEAR,
473475
UNCERTAINTIES,
474476
DUMP_DAE,
475-
SHOW_START_ORIGIN
477+
SHOW_START_ORIGIN,
478+
NO_MIXED_TEARING
476479
};
477480

478481
// CONFIGURATION FLAGS
@@ -591,7 +594,7 @@ constant ConfigFlag POST_OPT_MODULES = CONFIG_FLAG(16, "postOptModules",
591594
"removeUnusedFunctions",
592595
"simplifyTimeIndepFuncCalls",
593596
"inputDerivativesUsed",
594-
// "detectJacobianSparsePattern",
597+
// "detectJacobianSparsePattern",
595598
"optimizeInitialSystem"
596599
}),
597600
SOME(STRING_DESC_OPTION({
@@ -699,6 +702,11 @@ constant ConfigFlag LOCALE_FLAG = CONFIG_FLAG(41, "locale",
699702
constant ConfigFlag DEFAULT_OPENCL_DEVICE = CONFIG_FLAG(42, "defaultOCLDevice",
700703
SOME("o"), EXTERNAL(), INT_FLAG(0), NONE(),
701704
Util.gettext("Sets the default OpenCL device to be used for parallel execution."));
705+
// The flag noTearing is just for easy activation and deactivation
706+
// of the tearing optimazation module.
707+
constant ConfigFlag NO_TEARING = CONFIG_FLAG(43, "noTearing",
708+
NONE(), EXTERNAL(), BOOL_FLAG(false),NONE(),
709+
Util.gettext("Disables tearing at all."));
702710

703711
// This is a list of all configuration flags. A flag can not be used unless it's
704712
// in this list, and the list is checked at initialization so that all flags are
@@ -745,7 +753,8 @@ constant list<ConfigFlag> allConfigFlags = {
745753
REDUCTION_METHOD,
746754
PLOT_SILENT,
747755
LOCALE_FLAG,
748-
DEFAULT_OPENCL_DEVICE
756+
DEFAULT_OPENCL_DEVICE,
757+
NO_TEARING
749758
};
750759

751760
public function new

0 commit comments

Comments
 (0)