Menu

FORCES QP solver and openMP library

2014-03-18
2014-03-27
  • Tobias Weber

    Tobias Weber - 2014-03-18

    Hello ACADO team/community,

    I have two issues:

    FORCES:

    First I set up an OCP in the code generation framework with QP oases and full condensing. Everything worked fine. I used this options:

    mpc.set( INTEGRATOR_TYPE,               INT_IRK_GL2     );
    mpc.set( NUM_INTEGRATOR_STEPS,          10              );
    mpc.set( IMPLICIT_INTEGRATOR_NUM_ITS,   2           );
    mpc.set( HESSIAN_APPROXIMATION,         GAUSS_NEWTON    );
    mpc.set( DISCRETIZATION_TYPE,           SINGLE_SHOOTING );
    mpc.set( LINEAR_ALGEBRA_SOLVER,         GAUSS_LU        ); 
    mpc.set( HOTSTART_QP,                   YES             );
    mpc.set( SPARSE_QP_SOLUTION,        FULL_CONDENSING ); 
    mpc.set( QP_SOLVER,                 QP_QPOASES      ); 
    mpc.set( GENERATE_TEST_FILE,            YES             );
    mpc.set( GENERATE_MAKE_FILE,            YES             );
    

    Then i tried to uses forces and only changed some options to do so:

    mpc.set( INTEGRATOR_TYPE,               INT_IRK_GL2     );
    mpc.set( NUM_INTEGRATOR_STEPS,          10              );
    mpc.set( IMPLICIT_INTEGRATOR_NUM_ITS,   2           );
    mpc.set( HESSIAN_APPROXIMATION,         GAUSS_NEWTON    );
    mpc.set( DISCRETIZATION_TYPE,           MULTIPLE_SHOOTING ); // CHANGE HERE TO FORCES
    mpc.set( LINEAR_ALGEBRA_SOLVER,         GAUSS_LU        ); 
    mpc.set( HOTSTART_QP,                   NO              ); // NO HOTSTART WITH FORCES
    mpc.set( SPARSE_QP_SOLUTION,        SPARSE_SOLVER   ); // CHANGE TO SPARCE SOLVER
    mpc.set( QP_SOLVER,                 QP_FORCES       ); // USE QP FORCES
    mpc.set( CG_HARDCODE_CONSTRAINT_VALUES, NO          ); // NEEDED FOR FORCES
    mpc.set( GENERATE_TEST_FILE,            YES             );
    mpc.set( GENERATE_MAKE_FILE,            YES             );
    

    I just commented the changes. The cmake and make of the OCP describing C++ file worked quite fine, but when i executed the C-code exporting executable i got the following error:

    [ACADO] Error: stageH: getSubMatrix: invalid column arguments
    lhs name is var, size: 0 x 0
    rhs1 name is Q1, size: 8 x 8
    [ACADO] Error: Incompatible vector dimensions
    Code: (RET_VECTOR_DIMENSION_MISMATCH)
    File: /home/toweber/HIWI_KUKA_LWR/ACADOtoolkit/src/code_generation/export_arithmetic_statement.cpp
    Line: 242

    [ACADO] Error: Unable to export statement due to incomplete definition
    Code: (RET_UNABLE_TO_EXPORT_STATEMENT)
    File: /home/toweber/HIWI_KUKA_LWR/ACADOtoolkit/src/code_generation/export_statement_block.cpp
    Line: 287

    lhs name is H11, size: 8 x 1
    rhs1 name is QN1, size: 8 x 8
    [ACADO] Error: Incompatible vector dimensions
    Code: (RET_VECTOR_DIMENSION_MISMATCH)
    File: /home/toweber/HIWI_KUKA_LWR/ACADOtoolkit/src/code_generation/export_arithmetic_statement.cpp
    Line: 242

    [ACADO] Error: Unable to export statement due to incomplete definition
    Code: (RET_UNABLE_TO_EXPORT_STATEMENT)
    File: /home/toweber/HIWI_KUKA_LWR/ACADOtoolkit/src/code_generation/export_statement_block.cpp
    Line: 287

    It very strange as I didn`t change anything in the OCP descrition. Have I set a wrong option? I tried some changes there but actually then ACADO complains about wrong options for solver FORCES. I checked with the ACADO documentation and thought my OCP is compatible with both solvers. I can also shortly describe my OCP if needed.


    openMP:

    I used multiple shooting then with the QP oases solver and thought about openMP to speed up my code. Everything worked fine but actually the performance goes down.

    My code normally executes in about half a millisekond (one RTI, single shooting full condensing) and now it is about 0.6 millisekonds (multiple shooting with and without openMP). So I just wanted to aks in which timescales you guys normally use openMP for speedup and what are your experiences with openMP.

    I guessed open MP is just not suited for such fast code to speed up because of thread managing overhead. Wrote a simple mex file and parallelized a loop that supported this idea. Got speedup there when code execution takes more than 10 millisekonds ore somthing.

    Have someone used other parallelization tools with ACADO yet?

    Anyway, thanks beforehand to your help. Its not urgend as I will use single shooting now.

    Best regards Tobias

     
  • Milan Vukov

    Milan Vukov - 2014-03-27

    Hi,

    For the first question I need more info. Which version of ACADO are you using?

    About the second question... Yes, the MS is a bit more expensive that SS. As you saw, parallelization does not help always. If your model equations are simple and thus integration is cheap, that (probably) means that integration of the model + sens. generation takes small amount of overall execution time. Consequently, parallelization will not help much. Plus, one needs to take into account parallelization overhead -- which in some cases is not so negligible. This depends a bit on compiler, OpenMP implementation and so on.

     

    Last edit: Milan Vukov 2014-03-27

Log in to post a comment.