Opened 10 years ago
Closed 7 years ago
#3266 closed defect (fixed)
Differentiation of recursive function fails
Reported by: | Rüdiger Franke | Owned by: | Willi Braun |
---|---|---|---|
Priority: | high | Milestone: | 1.13.0 |
Component: | Backend | Version: | trunk |
Keywords: | Cc: | Adeel Asghar |
Description
This is the smallest example I'm aware of that causes most trouble in OpenModelica.
model SortTest2 input Real u; // prevent evaluation by frontend Real[:, :] M = [3, 4; 1 + u, 2]; output Real[size(M, 1), size(M, 2)] N; equation N = Modelica.Math.Matrices.sort(M); annotation(uses(Modelica(version="3.2.1"))); end SortTest2;
It not only knocks out the Cpp code generation (#3263), while it's reduced version crashes OMEdit (#3262). Also FMI export fails to generate the model structure -- translateModelFMU(SortTest2, version="2.0")
:
Error: Internal error BackendDAEOptimize.generateSymbolicJacobian failed Error: Internal error BackendDAEOptimize.createJacobian failed
Change History (28)
comment:1 by , 10 years ago
Component: | FMI → FMI-CPP |
---|---|
Owner: | changed from | to
comment:2 by , 10 years ago
Cc: | added |
---|---|
Component: | FMI-CPP → FMI |
Owner: | changed from | to
Status: | new → assigned |
comment:3 by , 10 years ago
Well the C runtime works fine with the attached example. I checked it before changing it to FMI-CPP. So i don't understand why you set the component to FMI.
comment:4 by , 10 years ago
Also when using the C runtime, translateModelFMU(SortTest2, version="2.0")
gives the same error message:
Error: Internal error BackendDAEOptimize.generateSymbolicJacobian failed Error: Internal error BackendDAEOptimize.createJacobian failed
The modelDescription.xml
contains an empty ModelStructure
section. Can it be that you checked using OMEdit -- it ignores this error message recently (did not ignore it back in December/January)?
comment:5 by , 10 years ago
I might be wrong with my files from January/February -- I was mostly generating FMUs from the command line.
Can you please also check #3262 -- there are still issues with error handling OMEdit.
comment:7 by , 10 years ago
comment:8 by , 10 years ago
See my comment in #3262 for OMEdit crash.
About Jacovian error, you are right. I wasn't checking for the errors when translateModelFMU
returns true. I fixed it now in r25442.
comment:9 by , 10 years ago
Btw. I just did
$ svn update $ make omc
The update says "At revision 25447". getVersion() still reports "1.9.3+dev (r25402)". I like the treatment of dependencies a lot when building omc, saving a lot of time when only recompiling things that have changed.
But where does the result from getVersion() come from?
comment:10 by , 10 years ago
It comes from Compiler/runtime/omc_config.h and is updated only if you runt configure I think.
comment:11 by , 10 years ago
Right, configure updates the version -- and the compilation still treats dependencies. Thanks!
comment:12 by , 10 years ago
Status: | assigned → accepted |
---|
comment:13 by , 10 years ago
One reason could be that there are no states in the model. ModelVariables start with <!-- Index of variable = "3" -->
.
comment:18 by , 8 years ago
Milestone: | 1.11.0 → 1.12.0 |
---|
Milestone moved to 1.12.0 due to 1.11.0 already being released.
comment:19 by , 7 years ago
Milestone: | 1.12.0 → Future |
---|
The milestone of this ticket has been reassigned to "Future".
If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.
If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".
In both cases, a short informative comment would be welcome.
comment:20 by , 7 years ago
Component: | FMI → Backend |
---|---|
Summary: | FMU export fails to generate model structure for MSL matrix function → Differentiation of recursive function fails |
comment:21 by , 7 years ago
Milestone: | Future → 1.13.0 |
---|
The situation has improved meanwhile. The example simulates in OMEdit now.
Remaining issues are:
- FMI export fails:
[C:/dev/OpenModelica32bit/OMCompiler/Compiler/Util/Graph.mo: 990:5-990:101]: Interner Fehler Graph.addForbiddenColors failed.
-- FMI export works with the debug flag-disableColoring
- OMEdit crashes during FMI export with the flag
-disableDirectionalDerivatives
These remaining FMI issues can hopefully be solved as well.
comment:23 by , 7 years ago
The crash is gone. Instead the following error message is raised:
[6] 18:37:22 Symbolic Error [OpenModelica/OMCompiler/Compiler/BackEnd/Differentiate.mo: 395:3-395:155]: Derivative of expression "(N, _) = Modelica.Math.Matrices.sort({{3.0, 4.0}, {M[2,1], 2.0}}, true, true)" w.r.t. "dummyVarFMIDER" is non-existent.
comment:25 by , 7 years ago
Since PR2206 the FMU can be generated when using default OMC flags.
Do you think the ticket can be closed, i.e. the error message in comment:23 with the flag -disableDirectionalDerivatives
is valid?
comment:26 by , 7 years ago
Actually, the differentiation of the function sort still fails and I'm try to fix this in PR2203. I think I'm almost done, currently only one issue with tuples return functions in algorithm section is failing in code generation phase.
comment:28 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
PR2203 is pushed, so I close it now.
It's not related to Cpp. We had similar issues with failed Jacobians in January.
Willi, could you have a look?