Memory alignment error building model on a MicroLabBox DS1202

Hi :wave:

First of all, thank you for developing and supporting such a useful tool as acados.

I’m working with the latest version of acados using the Matlab interface, and have created an NMPC model that runs fine in Simulink using an acados S-function. Now, I want to test it on an embedded platform.

I’m using a DS1202 MicroLabBox and building the models with the dSPACE RTI for Matlab 2022a. I followed all the steps in Embedded Workflow — acados documentation, so I was able to build acados for the DS1202 without any issues.

However, when I build the model in Simulink after all the steps, I get the following error:

Error occurred in real-time application 'dSPACE_LCL.ppc' (process ID 741383):
In function ocp_qp_xcond_solver_opts_assign -- C:/acados/acados/ocp_qp/ocp_qp_xcond_solver.c:222 (size_t) c_ptr % 8 == 0 && "double not 8-byte aligned!" -- assertion failed [20886,1137866335]

I checked other posts on the forum that had issues with memory alignment, but since acados has been successfully tested on the DS1202, I imagined the issue could be in the settings of the Simulink model. The settings for the hardware implementation are as shown in the following picture:

What could be causing this error? Has someone else encountered it? I will highly appreciate any help that can be provided to solve it.

Many thanks in advance!

Cristóbal

Hi Cristóbal,

That seems to be a memory alignment issue in acados.
I would have guessed that it is a 32 bit system, as the error would very likely have shown up otherwise, but it seems that it is a 64 bit system from a brief online search.
Anyway, which version of acados are you on, and what QP solver are you using?
This might help to find the issue.

Best,
Jonathan

Hi Jonathan,

Thank you very much for such a fast reply, I really appreciate your help.

The processor is a 64-bit Freescale QorIQ P5020, and the acados version is v.0.5.1 (I didn’t manage to find it explicitly, but I cloned the repository on the 31st of July, so that should be the version). The qp solver is partial condensing HPIPM ('PARTIAL_CONDENSING_HPIPM'), and the NLP solver is SQP with real-time iteration ('SQP_RTI'). Please let me know if there is any additional information or tests that I could provide to find the issue.

Again, thank you very much for all the help.

Kind regards,

Cristóbal

Hi,

I looked into the relevant code and made this PR: Fix memory alignment in condensing by FreyJo · Pull Request #1614 · acados/acados · GitHub
Could you test this version of acados in your workflow and let me know if it solves the issue?

Best,
Jonathan

It worked, thank you very much!