problems about NMPC ( ipopt, codegen, parallel computing )

901 views
Skip to first unread message

장희준

unread,
Jul 13, 2021, 9:39:12 PM7/13/21
to CasADi
Hi

I'm making NMPC code and facing computing time in real-time.

---------------------------------------------------------------------------------------------------------------------
environment
Ubuntu 18.04, python 3.6 and 3.8 ( test ), casadi ( 3.5.5, build binary)
with hsl, clang build 
and make code with opti stack
 --------------------------------------------------------------------------------------------------------------------

There are three questions in total as follows,

1. ipopt code-gen problem

I tried to speed up my code, so i did code generation

================== Code line ======================
opts['ipopt.linear_solver'] = 'ma57'
opts['ipopt.expect_infeasible_problem'] = 'yes'
opts['ipopt.hessian_approximation'] = "limited-memory"
opts['expand'] = True
opts['jit'] = True

opti.solver('ipopt', opts)

function = opti.to_function(' function', [var1, var2, var3, parm1, parm2, parm3], [var1,var2,var3])

function.generate('solve_function.c')
=================================================

but i am using ipopt ma57 and seems like the warning msg as below may possibly be coming from the optimzer I'm using right now.


==================== CONSOLE ====================

CasADi - 2021-07-13 21:03:59 WARNING("The function "solver", which is of type "IpoptInterface" cannot be code generated. The generation will proceed, but compilation of the code will not be possible.") [.../casadi/core/function_internal.cpp:2453]

===================================================

i would like to use ipopt ma versions(57,86,97) to use parallel computing
( in hsl page they told that 57, 86, 97 version can do parallel computing )

Is there any way to solve this..? I think some people in the forum that they have successfully wrapped my Ipopt with c++codes using codegen. I wish there is a hope for this problem. 


2. parallel computing problem

I made my code using options like expand & JIT in solver option

but when i use that options, my cpu only use one thread.. 
( tested with ma57, 86, 97 )

and when i deactivate options( expand, jit ), 16 threads run but only use around 30% and 
computing time is worse than using one core.

i checked pre_time and wall_time but that have no big difference.

is there some way to make all thread  to run in 100% maximum capacity of CPU in 16 thread?

3. considering about using OpEn 

I saw other questions in this group about ipopt problems and some answers was said that using OpEn will be good attempt. 

but I'm worried about accuracy and parallel computing

Is someone used OpEn and can tell me some details about pros and cons comparing to Ipopt? I've only used Ipopt so far.




Plz take my last wisdom tooth and give me any intuition for these questions.
 

Message has been deleted

Joris Gillis

unread,
Jul 22, 2021, 8:22:41 AM7/22/21
to CasADi
Hi there,

Ipopt is not code-generateable.
You still can get all the speedup using compilation/jit of the function evaluations though ( https://github.com/casadi/casadi/wiki/FAQ:-how-to-perform-jit-for-function-evaluations-of-my-optimization-problem%3F )
Unless you gave CasADi some opportunities to parallelize Function evaluations in your code, the only parallelism is in Ipopt.
We do not give support here for Ipopt specific questions I'm afraid.

Best regards,
  Joris

장희준

unread,
Jul 26, 2021, 8:59:49 AM7/26/21
to CasADi
thanks about reply!

I need to change my optimizer ipopt to other which i can gen C code..

and i have another question about your reply..!

"Unless you gave CasADi some opportunities to parallelize Function evaluations in your code, the only parallelism is in Ipopt."

I made my code using map(https://web.casadi.org/docs/#map) , expand, jit true and jit option . 

I think i give opportunity to casadi .. so..  which optimizer can calculate in parallel..?

I really thanks to this group!! 





2021년 7월 22일 목요일 오후 9시 22분 41초 UTC+9에 joris.g...@gmail.com님이 작성:
Reply all
Reply to author
Forward
0 new messages