Coder Social home page Coder Social logo

Dynamic allocations about osqp-eigen HOT 7 OPEN

robotology avatar robotology commented on June 12, 2024
Dynamic allocations

from osqp-eigen.

Comments (7)

traversaro avatar traversaro commented on June 12, 2024 2

Hello @GiulioRomualdi and @traversaro , I'm back ! Was this addressed at some point ? Can I run the solver with Eigen::internal::set_malloc_allowed(false) ?

I am doing some profiling on this, and it seems that solveProblem is malloc-free, but several update*** methods are still using mallocs.

from osqp-eigen.

ahoarau avatar ahoarau commented on June 12, 2024 1

It also says that it is the only place where they perform memory allocations in the solver.
Like qpOASES, you need to setup (allocs) and then solve (no allocs).
So I believe that createOsqpSparseMatrix would only be called once before the osqp_setup function, and then all the functions called would be to update the said matrices

from osqp-eigen.

traversaro avatar traversaro commented on June 12, 2024

@GiulioRomualdi What do you think about this? I think it is a good idea.

from osqp-eigen.

S-Dafarra avatar S-Dafarra commented on June 12, 2024

Hi @ahoarau,
with #5 and 38825e5 (and for the record 7109a22, my bad 😅 ) we have been trying to reduce memory allocation by reusing some buffers. Can you check this out? Comments are welcome 😉

from osqp-eigen.

GiulioRomualdi avatar GiulioRomualdi commented on June 12, 2024

Hi @ahoarau,
Remove/reduce memory allocation is, of course, a best practice, so I'll try to follow this objectivity. However, some memory allocations cannot be removed. Indeed osqp itself uses memory allocation.
For example, csc_spalloc() method allocates memory dynamically.

osqpSparseMatrix = csc_spalloc(rows, cols, numberOfNonZeroCoeff, 1, 0);

Furthermore, every time a new optimization problem is initialized the following memory allocations are performed https://github.com/oxfordcontrol/osqp/blob/master/src/osqp.c#L111-L118

from osqp-eigen.

NUDTUGVexplorer avatar NUDTUGVexplorer commented on June 12, 2024

when I run the example MPCExample.cpp
it has an error: Segmentation fault (core dumped).
Then I debug the program, it shows the error in the following lines.

solver.settings()->setWarmStart(true);

how to solve the issue? Thanks a lot.

from osqp-eigen.

ahoarau avatar ahoarau commented on June 12, 2024

Hello @GiulioRomualdi and @traversaro , I'm back ! Was this addressed at some point ?
Can I run the solver with Eigen::internal::set_malloc_allowed(false) ?

from osqp-eigen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.