Obtaining HSL

jgillis edited this page Jun 22, 2017 · 19 revisions

The IPOPT solver comes with a feature to detect the presence of 'libhsl.so'/'libhsl.dll' at runtime. Here is a report on how to obtain this 'libhsl.so'/'libhsl.dll'.

Step 1: Installation

Option 1: Compile the solvers from source

The following instructions work on Linux/Mac and Msys environment on Windows.

  1. Make sure that BLAS, LAPACK and a Fortran compiler are installed on your system (on Ubuntu/Debian systems, you can install these by running sudo apt-get install libblas3gf libblas-dev liblapack3gf liblapack-dev gfortran).

  2. Obtain the proprietary source coinhsl package from http://www.hsl.rl.ac.uk/ipopt/. When filling out the forms, please mention that you plan to use the routines with Ipopt/CasADi. Note that, unfortunately, we cannot guarantee the stability of using the newer linear solvers (MA57, MA77, MA86 and MA97 that are only free for academics) since HSL has not granted us any maintenance license.

  3. wget http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/OLD/metis-4.0.3.tar.gz

  4. tar -xvf metis-4.0.3.tar.gz

  5. Unpack the coinhsl package and navigate into the resutling coinhsl sources folder.

  6. mv ../metis-4.0.3 .

  7. $> ./configure --prefix=(where_you_want_to_install) LIBS="-llapack" --with-blas="-L/usr/lib -lblas" CXXFLAGS="-g -O2 -fopenmp" FCFLAGS="-g -O2 -fopenmp" CFLAGS="-g -O2 -fopenmp" (For Windows, make sure to use forward slashes in paths. Also for Windows, you probably need to compile and include -lcoinblas and -lcoinlapack as well.)

  8. $> make

  9. $> make install

  10. Create a symbolic link from libcoinhsl.so to libhsl.so (libcoinhsl.dylib -> libhsl.dylib on OSX):

    $> ln -s (hsl_install_directory)/libcoinhsl.so (hsl_install_directory)/libhsl.so

Option 2: Obtain pre-compiled binaries

Obtain pre-compiled libraries as a tar/zip file from http://www.hsl.rl.ac.uk/ipopt/ Note that the Win32 bit version works fine on a 64 bit machine, too.

Note: Some users reported that they had problems using the pre-compiled binaries. So in case you first try the pre-compiled binaries and fail with them, you probably have to wait an additional day until you can use the solvers since you have to request a different download link for the source files.

Step 2: Make IPOPT see the solvers

Once you have the solvers, you should just append the directory where it resides to the LD_LIBRARY_PATH environment variable (or DYLD_LIBRARY_PATH on OSX, or PATH on Windows).

The most common way to set LD_LIBRARY_PATH=(hsl_install_directory), or DYLD_LIBRARY_PATH for OSX users, is to add something like this to your .bashrc or .bash_profile

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:(hsl_install_directory/lib)

Note: if you use CasADi from Matlab, do check if your env variable is correctly passed on getenv('LD_LIBRARY_PATH'). If it's not, try firing up Matlab from a terminal where that variable is set correctly.

On Ubuntu/Debian systems, if you configured the compilation of the solvers with --prefix=/usr, this step 2 is not necessary.

Threaded execution

Since you went to the trouble of compiling with -fopenmp, you should export OMP_NUM_THREADS=7 or something so that HSL knows to go faster.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.