[Coin-ipopt] PARDISO linear solver for IPOPT in Matlab

Peter Carbonetto pcarbo at cs.ubc.ca
Fri Nov 9 20:11:09 EST 2007

After a great deal of trial and error, I managed to get the Pardiso linear 
solver working for IPOPT with the Matlab interface. My understanding is 
that the Pardiso solver performs quite well (as the 2005 study by Gould, 
Yu and Scott suggests) so I thought it might be interest to describe my 
installation procedure.

I downloaded the Intel 32-bit PARDISO library that was compiled using gcc 
4.1.0. As it so happens, my copy of MATLAB is version 7.5, and it was 
compiled using gcc 4.1.1. So there is some hope that the libraries will 
link properly.

Here are the basic steps I followed:

1. I built shared libraries for the BLAS and LAPACK routines, libblas.so 
and liblapack.so. It appears that it is necessary to compile the BLAS and 
LAPACK libraries on your own, rather than let the IPOPT installation do 
the work if you were to follow the default installation steps described in 
the manual. I used gfortran to compile the Fortran code and built the 
libraries with the commands:

   gfortran -fPIC -fexceptions -funroll-all-loops -O3 -shared \
     -o libblas.so *.f

   gfortran -fPIC -fexceptions -funroll-all-loops -O3 -shared \
     -o liblapack.so *.f

2. I downloaded the PARDISO library. I put the pardiso.lic license file 
in the directory pointed to by the environment ariable PARDISO_LIC_PATH. I 
also set the environment variable OMP_NUM_THREADS to 1.

3. Next, I downloaded and unpacked the latest release of IPOPT (version 
3.3.3). I configured IPOPT with something like:

   ./configure CC=gcc CXX=g++ F77=gfortran                             \
     --with-blas="-L$HOME/blas -lblas"                                 \
     --with-lapack="-L$HOME/lapack -llapack"                           \
     --with-pardiso="-L$HOME/pardiso -lpardiso_GFORTRAN_IA32"          \
     ADD_CXXFLAGS="-fPIC -fexceptions" ADD_CFLAGS="-fPIC -fexceptions" \
     ADD_FFLAGS="-fPIC -fexceptions"

4. I get complaints from the linker when I try to compile one of the C++ 
examples. (It may be because I forgot to include the gfortran library in 
the configuration above.) I can, however, run the Matlab interface for 
IPOPT using the Pardiso linear solver. The command I used to compile the 
MEX file looks something like this:

   mex -cxx -O CXX="g++" -L$(IPOPT_HOME)/lib -L$(PARDISO_HOME)         \
       -L$(BLAS_HOME) -I$(IPOPT_HOME)/include -L$(LAPACK_HOME) -lipopt \
       -lpardiso_GFORTRAN_IA32 -llapack -lblas -output ipopt.mexglx    \

Then I tried an example. I ran the Matlab script examplehs071.m
located in MatlabInterface/examples/hs071. In order to test the
PARDISO solver, I modified the call to IPOPT like so:

   x = ipopt(x0,lb,ub,lbc,ubc,'computeObjectiveHS071','computeGradientHS071',...

And it works! It converges to the correct solution.

Peter Carbonetto
Ph.D. Candidate
Dept. of Computer Science
University of British Columbia

More information about the Coin-ipopt mailing list