Memory requirements ERK vs IRK

Hi !

I’m trying to run ACADOS on a big problem (135 states, 29 controls). One of the issues I came across is the amount of RAM (15 go) necessary to create the graph with an ERK integrator (the compilation line just before the optimization starts). As I am also working with CASADI and IPOPT, I identified that this comes from the fact that the graph is built in SX, whereas it takes way less memory in MX (1/2 go, exactly same problem with CASADI and IPOPT).
I tried to change the integrator because my ODEs are stiff. When I switched to IRK, the amount of RAM used by ACADOS dropped by about 10 times ! So my question is, by pure curiosity, why is that ?!
Thank you,
François

Hi François,

As you noted, the memory requirements come from the CasADi function generation.
It is indeed interesting that this is so much higher for ERK!

Probably this huge memory requirements comes from setting up the vde* expressions in this file: https://github.com/acados/acados/blob/master/interfaces/acados_template/acados_template/generate_c_code_explicit_ode.py

I think the flaw here, is that the matrix multiplications should not be symbolicly using CasADi, but instead within acados, using BLASFEO.

Also, the term “VDE”, suggested to me that a Differentiate-then-Discretize approach is used, as opposed to the Discretize-then-differentiate approach, that is used in IRK.
For reference, I am using the terminology from Section 2.3. of Rien Quirynen PhD Thesis.
However, on a second look, I think this is not the case.

I suggest to change this in ERK, multiplying the matrices in BLASFEO instead of CasADi and not use the VDE term.

Best,
Jonathan