[Ipopt] compiling HSL loadable module under linux

Ipopt User ipoptuser at gmail.com
Tue Sep 30 11:41:09 EDT 2014


I recently downloaded HSL for using better linear solvers in IPOPT.
Unfortunately, I cannot get a loadable module to work.

I am using Debian Wheezy, MATLAB R2013a x64 and the IPOPT3.11.8 Matlab
interface (
http://www.coin-or.org/download/binary/Ipopt/Ipopt-3.11.8-linux64mac64win32win64-matlabmexfiles.zip
),
and wish to use the HSL shared library libhsl.so. Unfortunately, none of
fancier linear solvers (MA77, MA87, MA97) works.

First, I followed the directions from
Ipopt-3.11.9/ThirdParty/HSL/INSTALL.HSL
~/Ipopt-3.11.9/ThirdParty/HSL$ ./configure --enable-loadable-library
ADD_CXXFLAGS="-fPIC -fexceptions" ADD_CFLAGS="-fPIC -fexceptions"
ADD_FFLAGS="-fPIC -fexceptions"
~/Ipopt-3.11.9/ThirdParty/HSL$ make
it recognizes and compiles all HSL solvers, but the result of the
compilation process is not a .so file:
:~/Ipopt-3.11.9/ThirdParty/HSL$ find . -regex '.*lib.*hsl.*'
./libcoinhsl.la
./coinhsl/libcoinhsl.sym
./.libs/libcoinhsl.a
./.libs/libcoinhsl.la
./.libs/libcoinhsl.lai
./lib/libcoinhsl.a
./lib/libcoinhsl.la
./lib/pkgconfig/coinhsl.pc
./lib/libhsl.so
The last file is a symlink to a nonexisting file.

Alternatively, I have tried to compile HSL directly. The steps I take to
install the HSL shared library are:
~/coinhsl-2014.01.10$ ./configure
~/coinhsl-2014.01.10$ make
~/coinhsl-2014.01.10$ ln -s .libs/libcoinhsl.so .libs/libhsl.so
~/coinhsl-2014.01.10$ LD_LIBRARY_PATH="/home/user/coinhsl-2014.01.10" matlab
These steps always succeed, and I can use MA27.

When I use GCC 4.7.2 (ships with Debian Wheezy), I get error [1] (printed
below this e-mail) whenever I try to use ipopt with one of the fancier HSL
solvers in Matlab. This can be solved by running Matlab with a current
version of libgfortran (see [2]). However, Matlab crashes on fancier
solvers, e.g., MA87 gives [3], MA87 gives "*** glibc detected ***
/usr/local/MATLAB/R2013a/bin/glnxa64/MATLAB: corrupted double-linked list:
0x000000000312d2a0 ***" and MA97 gives "MKL ERROR: Parameter 8 was
incorrect on entry to DGEMM".

When I use GCC 4.4.7 (which is the recommended version for compiling mex
files for Matlab 2013a), error [1] does not appear. When I use the solver
MA87, Matlab crashes as soon as it calls the solver [4]. When using MA77,
IPOPT reports "WARNING: Problem in step computation; switching to emergency
mode." MA97 gives "MKL ERROR: Parameter 3 was incorrect on entry to DGEMM".
and exists with a message similar to [3] (the differences are in the
hexagonal numbers).

HSL has responded to this issue with:
>> If MA27 works and nothing else does, it suggests that its probably
related to the BLAS API. Mathworks, for reasons only know to themselves,
decided to use the ILP64 interface rather than the standard LP64 interface
[i.e. all integer parameters to BLAS calls need to be 64-bit not 32-bit].
This causes a massive headache for anyone calling BLAS from a mex binary,
and can lead to the sorts of problems you indicate as the pointers the BLAS
think they've been passed are wrong.

>> In terms of fixing it, the easiest way is probably to figure out how to
link against an LP64 BLAS library for the mex binary - but be careful as
Ipopt may be using ILP64 for its own calls to the BLAS if compiled with the
matlab interface. A different trick is to compile the HSL codes with
-fdefault-integer-8, but that may then break the ipopt/hsl interface
instead.

Their suggestion is to try this mailing list, since "(..) it may be that by
compiling the HSL codes using the ipopt build system they've already
incorporated a fix for the issue (rather than using the precompiled
library)." However, as you can see at the start of this message, the
standard method of compiling libhsl.so does not work.

Any help would be greatly appreciated.

[1]
Exception of type: OPTION_INVALID in file
"../../../../Ipopt/src/Algorithm/IpAlgBuilder.cpp" at line 369:
 Exception message: Selected linear solver HSL_MA77 not available.
Tried to obtain HSL_MA77 from shared library "libhsl.so", but the following
error occured:
/usr/local/MATLAB/R2013a/bin/glnxa64/../../sys/os/glnxa64/libgfortran.so.3:
version `GFORTRAN_1.4' not found (required by
/home/user/Ipopt-3.11.9/ThirdParty/HSL/lib/libhsl.so)

EXIT: Invalid option encountered.

[2]
cd /usr/local/MATLAB/R2013a/sys/os/glnxa64
rm libstdc++.so.6
rm libgfortran.so.3
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17 libstdc++.so.6
ln -s /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0 libgfortran.so.3

[3]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffe107f0700 (LWP 51207)]
0x00007ffe12a29e56 in LSteps_Any_Loop4gas_1 () from
/usr/local/MATLAB/R2013a/bin/glnxa64/mkl.so
(gdb) bt
#0  0x00007ffe12a29e56 in LSteps_Any_Loop4gas_1 () from
/usr/local/MATLAB/R2013a/bin/glnxa64/mkl.so
#1  0x0000000000000000 in ?? ()

[4]
(gdb) bt
#0  0x00007ffe13a4b8f0 in mkl_blas_mc3_dtrsv_utu () from
/usr/local/MATLAB/R2013a/bin/glnxa64/mkl.so
#1  0x00007ffe13166c43 in mkl_blas_mc3_dtrsv () from
/usr/local/MATLAB/R2013a/bin/glnxa64/mkl.so
#2  0x00007ffe11e36315 in mkl_blas_dtrsv () from
/usr/local/MATLAB/R2013a/bin/glnxa64/mkl.so
#3  0x00007ffe11d20b84 in dtrsv_ () from
/usr/local/MATLAB/R2013a/bin/glnxa64/mkl.so
#4  0x00007ffe19a07575 in hsl_ma86_double::slv_solve_fwd (n=<optimized
out>, nelim=<optimized out>, col=<optimized out>, dest=..., nrhs=<optimized
out>, rhs=..., ldr=1,
    control=..., id=39399) at hsl_ma86/hsl_ma86d.f90:6102
#5  0x00007ffe19a07d0e in hsl_ma86_double::fwd_solve_bcol (bcol=<optimized
out>, blk=<optimized out>, col=<optimized out>, lfact=..., blocks=...,
nrhs=<optimized out>,
    rhs=<error reading variable: DWARF-2 expression error: DW_OP_reg
operations must be used either alone or in conjunction with DW_OP_piece or
DW_OP_bit_piece.>,
    ldr=39453, evars=..., lde=1, xlocal=...,
    rhs_local=<error reading variable: DWARF-2 expression error: DW_OP_reg
operations must be used either alone or in conjunction with DW_OP_piece or
DW_OP_bit_piece.>,
    control=..., this_thread=0, total_threads=1) at
hsl_ma86/hsl_ma86d.f90:3963
#6  0x00007ffe19a10f1d in hsl_ma86_double::task_dispatch (val=...,
invp=..., nbcol=<optimized out>, maxm=<optimized out>, maxn=<optimized out>,
    lfact=<error reading variable: DWARF-2 expression error: DW_OP_reg
operations must be used either alone or in conjunction with DW_OP_piece or
DW_OP_bit_piece.>,
    lmap=..., map=..., pos=..., stack=..., blocks=..., nodes=...,
control=..., tstats=...,
    info=<error reading variable: DWARF-2 expression error: DW_OP_reg
operations must be used either alone or in conjunction with DW_OP_piece or
DW_OP_bit_piece.>,
    st=<error reading variable: DWARF-2 expression error: DW_OP_reg
operations must be used either alone or in conjunction with DW_OP_piece or
DW_OP_bit_piece.>, nrhs=1,
    rhs=..., ldr=39453, total_threads=1, rhs_local=..., scale=...) at
hsl_ma86/hsl_ma86d.f90:3004
#7  0x00007ffe19a12cb9 in hsl_ma86_double::factorize_indef (val=...,
order=...,
    keep=<error reading variable: DWARF-2 expression error: DW_OP_reg
operations must be used either alone or in conjunction with DW_OP_piece or
DW_OP_bit_piece.>,
    control=...,
    info=<error reading variable: DWARF-2 expression error: DW_OP_reg
operations must be used either alone or in conjunction with DW_OP_piece or
DW_OP_bit_piece.>,
    nrhs=<optimized out>, ldr=39453, rhs=..., scale=...) at
hsl_ma86/hsl_ma86d.f90:2280
#8  0x00007ffe19a199ae in hsl_ma86_double::ma86_factor_solve_mult_double (
    n=<error reading variable: DWARF-2 expression error: DW_OP_reg
operations must be used either alone or in conjunction with DW_OP_piece or
DW_OP_bit_piece.>, ptr=...,
    row=..., val=..., order=...,
    keep=<error reading variable: DWARF-2 expression error: DW_OP_reg
operations must be used either alone or in conjunction with DW_OP_piece or
DW_OP_bit_piece.>,
    control=<error reading variable: DWARF-2 expression error: DW_OP_reg
operations must be used either alone or in conjunction with DW_OP_piece or
DW_OP_bit_piece.>,
    info=<error reading variable: DWARF-2 expression error: DW_OP_reg
operations must be used either alone or in conjunction with DW_OP_piece or
DW_OP_bit_piece.>,
    nrhs=1, lx=39453, x=..., scale=...) at hsl_ma86/hsl_ma86d.f90:1537
#9  0x00007ffe19a1d530 in ma86_factor_solve_d (n=39453, cptr=<optimized
out>, crow=<optimized out>, cval=<optimized out>,
    corder=<error reading variable: DWARF-2 expression error: DW_OP_reg
operations must be used either alone or in conjunction with DW_OP_piece or
DW_OP_bit_piece.>,
    ckeep=<optimized out>, ccontrol=..., cinfo=..., nrhs=1, ldx=39453,
cx=VOID, cscale=<error reading variable: Cannot access memory at address
0x0>)
    at hsl_ma86/C/hsl_ma86d_ciface.f90:337
#10 0x00007ffe19d2f71f in Ipopt::Ma86SolverInterface::MultiSolve(bool, int
const*, int const*, int, double*, bool, int) ()
   from /home/user/Documents/MATLAB/libs/ipopt.mexa64
#11 0x00007ffe19d25013 in
Ipopt::TSymLinearSolver::MultiSolve(Ipopt::SymMatrix const&,
std::vector<Ipopt::SmartPtr<Ipopt::Vector const>,
std::allocator<Ipopt::SmartPtr<Ipopt::Vector const> > >&,
std::vector<Ipopt::SmartPtr<Ipopt::Vector>,
std::allocator<Ipopt::SmartPtr<Ipopt::Vector> > >&, bool, int) ()
---Type <return> to continue, or q <return> to quit---
   from /home/user/Documents/MATLAB/libs/ipopt.mexa64
#12 0x00007ffe19d98002 in
Ipopt::StdAugSystemSolver::MultiSolve(Ipopt::SymMatrix const*, double,
Ipopt::Vector const*, double, Ipopt::Vector const*, double, Ipopt::Matrix
const*, Ipopt::Vector const*, double, Ipopt::Matrix const*, Ipopt::Vector
const*, double, std::vector<Ipopt::SmartPtr<Ipopt::Vector const>,
std::allocator<Ipopt::SmartPtr<Ipopt::Vector const> > >&,
std::vector<Ipopt::SmartPtr<Ipopt::Vector const>,
std::allocator<Ipopt::SmartPtr<Ipopt::Vector const> > >&,
std::vector<Ipopt::SmartPtr<Ipopt::Vector const>,
std::allocator<Ipopt::SmartPtr<Ipopt::Vector const> > >&,
std::vector<Ipopt::SmartPtr<Ipopt::Vector const>,
std::allocator<Ipopt::SmartPtr<Ipopt::Vector const> > >&,
std::vector<Ipopt::SmartPtr<Ipopt::Vector>,
std::allocator<Ipopt::SmartPtr<Ipopt::Vector> > >&,
std::vector<Ipopt::SmartPtr<Ipopt::Vector>,
std::allocator<Ipopt::SmartPtr<Ipopt::Vector> > >&,
std::vector<Ipopt::SmartPtr<Ipopt::Vector>,
std::allocator<Ipopt::SmartPtr<Ipopt::Vector> > >&,
std::vector<Ipopt::SmartPtr<Ipopt::Vector>,
std::allocator<Ipopt::SmartPtr<Ipopt::Vector> > >&, bool, int) () from
/home/user/Documents/MATLAB/libs/ipopt.mexa64
#13 0x00007ffe19cfe7ba in Ipopt::AugSystemSolver::Solve(Ipopt::SymMatrix
const*, double, Ipopt::Vector const*, double, Ipopt::Vector const*, double,
Ipopt::Matrix const*, Ipopt::Vector const*, double, Ipopt::Matrix const*,
Ipopt::Vector const*, double, Ipopt::Vector const&, Ipopt::Vector const&,
Ipopt::Vector const&, Ipopt::Vector const&, Ipopt::Vector&, Ipopt::Vector&,
Ipopt::Vector&, Ipopt::Vector&, bool, int) () from
/home/user/Documents/MATLAB/libs/ipopt.mexa64
#14 0x00007ffe19d9da99 in
Ipopt::LowRankAugSystemSolver::Solve(Ipopt::SymMatrix const*, double,
Ipopt::Vector const*, double, Ipopt::Vector const*, double, Ipopt::Matrix
const*, Ipopt::Vector const*, double, Ipopt::Matrix const*, Ipopt::Vector
const*, double, Ipopt::Vector const&, Ipopt::Vector const&, Ipopt::Vector
const&, Ipopt::Vector const&, Ipopt::Vector&, Ipopt::Vector&,
Ipopt::Vector&, Ipopt::Vector&, bool, int) () from
/home/user/Documents/MATLAB/libs/ipopt.mexa64
#15 0x00007ffe19d03c37 in
Ipopt::LeastSquareMultipliers::CalculateMultipliers(Ipopt::Vector&,
Ipopt::Vector&) () from /home/user/Documents/MATLAB/libs/ipopt.mexa64
#16 0x00007ffe19ce58cb in
Ipopt::DefaultIterateInitializer::least_square_mults(Ipopt::Journalist
const&, Ipopt::IpoptNLP&, Ipopt::IpoptData&,
Ipopt::IpoptCalculatedQuantities&,
Ipopt::SmartPtr<Ipopt::EqMultiplierCalculator> const&, double) () from
/home/user/Documents/MATLAB/libs/ipopt.mexa64
#17 0x00007ffe19ce7e9e in
Ipopt::DefaultIterateInitializer::SetInitialIterates() () from
/home/user/Documents/MATLAB/libs/ipopt.mexa64
#18 0x00007ffe19d05216 in Ipopt::IpoptAlgorithm::InitializeIterates() ()
from /home/user/Documents/MATLAB/libs/ipopt.mexa64
#19 0x00007ffe19d08cef in Ipopt::IpoptAlgorithm::Optimize(bool) () from
/home/user/Documents/MATLAB/libs/ipopt.mexa64
#20 0x00007ffe19c868bb in Ipopt::IpoptApplication::call_optimize() () from
/home/user/Documents/MATLAB/libs/ipopt.mexa64
#21 0x00007ffe19c8fc8f in
Ipopt::IpoptApplication::OptimizeNLP(Ipopt::SmartPtr<Ipopt::NLP> const&,
Ipopt::SmartPtr<Ipopt::AlgorithmBuilder>&) ()
   from /home/user/Documents/MATLAB/libs/ipopt.mexa64
#22 0x00007ffe19c8facd in
Ipopt::IpoptApplication::OptimizeNLP(Ipopt::SmartPtr<Ipopt::NLP> const&) ()
from /home/user/Documents/MATLAB/libs/ipopt.mexa64
#23 0x00007ffe19c86081 in
Ipopt::IpoptApplication::OptimizeTNLP(Ipopt::SmartPtr<Ipopt::TNLP> const&)
() from /home/user/Documents/MATLAB/libs/ipopt.mexa64
#24 0x00007ffe19c83a25 in mexFunction () from
/home/user/Documents/MATLAB/libs/ipopt.mexa64
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20140930/c9dd9e1d/attachment-0001.html>


More information about the Ipopt mailing list