Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPOPT not picking up HSL solvers in Ubuntu 16.04 #2032

Closed
AntonSavchenko opened this issue Jun 22, 2017 · 10 comments
Closed

IPOPT not picking up HSL solvers in Ubuntu 16.04 #2032

AntonSavchenko opened this issue Jun 22, 2017 · 10 comments
Assignees

Comments

@AntonSavchenko
Copy link

Hello,
I recently tried getting the HSL solvers, following the instructions here:
https://github.com/casadi/casadi/wiki/Obtaining-HSL
There are some inconsistencies though, and I still haven't managed to make it work. First off, some of the proposed lapack packages can't be found:

E: Unable to locate package libblas3gf
E: Unable to locate package liblapack3gf

Next, even when I try setting the symbolic link in the <coinhsl_build>/lib folder like so
ln -s libcoinhsl.so libhsl.so
as well as inserting this path to the
etc/ld.so.conf.d/coinhsl.conf
file, and adding
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<coinhsl_build>/lib
the IPOPT doesn't seem to be picking it up...

Whenever I switch from 'mumps' solver to 'ma27' or 'ma57', it produces the following output:

Exception of type: OPTION_INVALID in file "../../../../Ipopt/src/Algorithm/IpAlgBuilder.cpp" at line 345:
 Exception message: Selected linear solver MA57 not available.
Tried to obtain MA57 from shared library "libhsl.so", but the following error occured:
libhsl.so: cannot open shared object file: No such file or directory

I'm not sure if it's the problem with casadi, ipopt, the hsl solvers or ubuntu 16.04, and everyone I asked said "it should be working like that" - I'm kind of at a loss...
Thank you in advance.

@jgillis
Copy link
Member

jgillis commented Jun 22, 2017

Alright, lets debug..
Which OS? Which version of CasADi? Are you using CasADi thorugh Python/Matlab/C ?
If Python, which environment (command line/spyder/...)?

@AntonSavchenko
Copy link
Author

Hi!
I use Ubuntu 16.04, more precisely:

Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial

I got CasADi 3.2.0 for matlab 2014b (I use matlab 2016b). Thus far I tried both a compiled version of the HSL release, and the sources which I compiled myself following instructions.

@jgillis
Copy link
Member

jgillis commented Jun 22, 2017

Is CasADi built or from the binaries?

Could you provide the output of the following commands?
bash: ldd <coinhsl_build>/lib/libhsl.so
matlab: getenv('LD_LIBRARY_PATH')

@AntonSavchenko
Copy link
Author

CasADi is from the binaries, I did attempt to compile one, but was unable to determine correct flags

The bash output is as follows:

asavchen@syst28 lib$ ldd libhsl.so 
	linux-vdso.so.1 =>  (0x00007ffc010eb000)
	liblapack.so.3 => /usr/lib/liblapack.so.3 (0x00007f6df0c64000)
	libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x00007f6df0938000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6df062f000)
	libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f6df040d000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6df0042000)
	libblas.so.3 => /usr/lib/libblas.so.3 (0x00007f6defdd3000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6defbbd000)
	libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f6def97d000)
	/lib64/ld-linux-x86-64.so.2 (0x000056267d60e000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6def779500)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6def55c000)

The matlab output is

getenv('LD_LIBRARY_PATH')
ans =
/apps/matlab/sys/os/glnxa64:/apps/matlab/bin/glnxa64:/apps/matlab/extern/lib/glnxa64:/apps/matlab/runtime/glnxa64:/apps/matlab/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/apps/matlab/sys/java/jre/glnxa64/jre/lib/amd64/server

So, the LD_LIBRARY_PATH in matlab looks completely different from the one that is shown when I check in bash
echo $LD_LIBRARY_PATH

@jgillis
Copy link
Member

jgillis commented Jun 22, 2017

Right, so looks like matlab is ignoring your environment.
Let's hack it in to see if that's the issue:
start your matlab from command line, from the terminal where you did the LD_LIBRARY_PATH export.
e.g. matlab may work as a command or you may need to specify the full path e.g. /usr/local/bin/matlab

@AntonSavchenko
Copy link
Author

Wow, that worked! Why haven't I thought of trying that?.. :)
The export is written in .bashrc, so I thought it's supposed to be loading when I login, i.e. the echo command works all the time.

Thanks for the help, it was driving me nuts for days!

@jgillis
Copy link
Member

jgillis commented Jun 22, 2017

np I'll put up a notice in our wiki..

@jgillis jgillis closed this as completed Jun 22, 2017
@jgillis
Copy link
Member

jgillis commented Jun 22, 2017

There must be a more proper way that doesn't require starting Matlab from command line, though. Do report it in case you find it

@tpweber17
Copy link

Was there ever a new solution to this? The command line method worked but wouldnt mind something that addresses the problem...

@Hdang92
Copy link

Hdang92 commented Dec 30, 2020

Hi, could you please tell me which version of MA57 you used? I have the ma57-3.10.0 and i don't know how you set the symbolic link because i don't have the file libcoinhsl.so as you have. I have the following files :
libma57.so.0.0.0
libma57.so.0
libma57.so
libma57.la
libma57.a
libfakemetis.so.0.0.0
libfakemetis.so.0
libfakemetis.so
libfakemetis.la
libfakemetis.a

i tried to create a symbolic link with the libma57.so files but i get the same crash of matlab all the time. If you need more details about my setup i would gladly write you a PM.

Kind regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants