Hi Jonathan,
We tried your suggestion but that does not work.
However, we went through the code deeper and find out mem->hpipm_workspace->stat
address can be printed out, and mem->hpipm_workspace->stat_m
has a value of 17.
When we tried to print mem->hpipm_workspace->stat[0]
, the program stoped. Hence, it is obvious that the memory of this vector is not assigned properly.
We then checked this vector in x_ocp_qp_ipm.c
(in function void OCP_QP_IPM_WS_CREATE
), and found the codes below
// double/float stuff
REAL *d_ptr = (REAL *) sv_ptr;
workspace->stat = d_ptr;
int stat_m = 17;
d_ptr += stat_m*(1+arg->stat_max);
So, stat_m=17
is confirmed, and clearly the vector “stat” has been assigned memory here, but somehow not successfully when returned to function void *ocp_qp_hpipm_memory_assign
Finally, we tried a very direction solution, i.e. adding manually the memory for this vector in the function void *ocp_qp_hpipm_memory_assign
as
assign_and_advance_double(17*(1+opts->stat_max), &ipm_workspace->stat, &c_ptr);
So the final function of void *ocp_qp_hpipm_memory_assign
becomes
Magically, the program worked
Now I’m not sure if this can be a PR (does it work for other architectures?), and why the memory of a single vector is not assigned inside HPIPM create function correctly so that we have to do it manually in ACADOS create function.
Cheers,
Yutao