Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
added debug flag to disable coloring
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Braun authored and OpenModelica-Hudson committed Dec 12, 2016
1 parent 0f5d188 commit b6789ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
21 changes: 12 additions & 9 deletions Compiler/BackEnd/SymbolicJacobian.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1188,9 +1188,9 @@ algorithm
sparseArrayT = arrayCreate(sizeN,{});
sparseArrayT = transposeSparsePattern(sparsepattern, sparseArrayT, 1);
sparsepatternT = arrayList(sparseArrayT);
if debug then execStat("generateSparsePattern -> postProcess2 "); end if;

nonZeroElements = List.lengthListElements(sparsepattern);
if debug then execStat("generateSparsePattern -> transpose done "); end if;

if Flags.isSet(Flags.DUMP_SPARSE_VERBOSE) then
// dump statistics
dumpSparsePatternStatistics(nonZeroElements,sparsepatternT);
Expand All @@ -1199,20 +1199,23 @@ algorithm
//execStat("generateSparsePattern -> nonZeroElements: " + intString(nonZeroElements) + " " ,ClockIndexes.RT_CLOCK_EXECSTAT_BACKEND_MODULES);
end if;


// translated to DAE.ComRefs
translated = list(list(arrayGet(inDepCompRefs, i) for i in lst) for lst in sparsepattern);
sparsetuple = list((cr,t) threaded for cr in depCompRefs, t in translated);
translated = list(list(arrayGet(depCompRefs, i) for i in lst) for lst in sparsepatternT);
sparsetupleT = list((cr,t) threaded for cr in inDepCompRefs, t in translated);

// get coloring based on sparse pattern
coloredArray = createColoring(sparseArray, sparseArrayT, sizeN, adjSize);

coloring = list(list(arrayGet(inDepCompRefs, i) for i in lst) for lst in coloredArray);
if debug then execStat("generateSparsePattern -> coloring start "); end if;
if not Flags.isSet(Flags.DISABLE_COLORING) then
// get coloring based on sparse pattern
coloredArray = createColoring(sparseArray, sparseArrayT, sizeN, adjSize);
coloring = list(list(arrayGet(inDepCompRefs, i) for i in lst) for lst in coloredArray);
else
//without coloring
coloring = list({arrayGet(inDepCompRefs, i)} for i in 1:sizeN);
end if;
if debug then execStat("generateSparsePattern -> coloring done "); end if;

//without coloring
//coloring = List.transposeList({inDepCompRefs});
if Flags.isSet(Flags.DUMP_SPARSE_VERBOSE) then
print("analytical Jacobians[SPARSE] -> ready! " + realString(clock()) + "\n");
end if;
Expand Down
5 changes: 4 additions & 1 deletion Compiler/Util/Flags.mo
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ constant DebugFlag EVAL_PARAM_DUMP = DEBUG_FLAG(168, "evalParameterDump", false,
Util.gettext("Dumps information for evaluating parameters."));
constant DebugFlag NF_UNITCHECK = DEBUG_FLAG(169, "frontEndUnitCheck", false,
Util.gettext("Checks the consistency of units in equation."));
constant DebugFlag DISABLE_COLORING = DEBUG_FLAG(170, "disableColoring", false,
Util.gettext("Disables coloring algorithm while spasity detection."));


// This is a list of all debug flags, to keep track of which flags are used. A
Expand Down Expand Up @@ -687,7 +689,8 @@ constant list<DebugFlag> allDebugFlags = {
LIST_REVERSE_WRONG_ORDER,
PARTITION_INITIALIZATION,
EVAL_PARAM_DUMP,
NF_UNITCHECK
NF_UNITCHECK,
DISABLE_COLORING
};

public
Expand Down

0 comments on commit b6789ac

Please sign in to comment.