Skip to content

FLOAT codegen argument doesn't work as expected #114

Open
@kirkrudolph

Description

@kirkrudolph

Issue

Using the following code in Python, I'm expecting the resulting generated code to use floats because of FLOAT='True'. Instead, it looks like the generated code is still using doubles.

prob.codegen('osqp_gen',parameters='vectors', FLOAT='True')

Outputs the following to the console along with the generated files.

-----------------------------------------------------------------
           OSQP v0.6.3  -  Operator Splitting QP Solver
              (c) Bartolomeo Stellato,  Goran Banjac
        University of Oxford  -  Stanford University 2021
-----------------------------------------------------------------
problem:  variables n = 172, constraints m = 304
          nnz(P) + nnz(A) = 1161
settings: linear system solver = qdldl,
          eps_abs = 1.0e-03, eps_rel = 1.0e-03,
          eps_prim_inf = 1.0e-04, eps_dual_inf = 1.0e-04,
          rho = 1.00e-01 (adaptive),
          sigma = 1.00e-06, alpha = 1.60, max_iter = 4000
          check_termination: on (interval 25),
          scaling: on, scaled_termination: off
          warm start: on, polish: off, time_limit: off

Getting workspace from OSQP object...                           [done]
Creating target directories...                                  [done]
Copying OSQP sources...                                         [done]
Generating customized code...                                   [done]
Compiling Python wrapper...                                     [done]
Copying code-generated Python solver to current directory...    [done]

In osqp_gen > include > osqp_configure.h I see:

/* DFLOAT */
/* #undef DFLOAT */

/* DLONG */
#define DLONG

In osqp_gen > include > qdldl_types.h I see:

// QDLDL integer and float types
typedef long long    QDLDL_int;   /* for indices */
typedef double  QDLDL_float; /* for numerical values  */
typedef unsigned char   QDLDL_bool;  /* for boolean values  */

Compiling

Running the CMakeLists.txt file, it also shows Floats are still disabled.

-- We are on a Generic system
-- Embedded is 1
-- Passing EMBEDDED flag to compiler
-- Disabling printing for embedded
-- Printing is OFF
-- Disabling profiling for embedded
-- Profiling is OFF
-- Floats are OFF
-- Disabling long integers (64bit) on 32bit machine
-- Long integers (64bit) are OFF

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions