This is a guide detailing the compilation of Ipopt with SPRAL as a linear solver. It was developed assuming a standard installation of Ubuntu 18.04 LTS. To begin, first, compile the LANL ANSI version of SPRAL using the compilation suggestions described therein.
First, create a directory where Ipopt will be compiled from source (not via coinbrew), e.g.,
mkdir -p ${HOME}/SoftwareThe remainder of this guide assumes such a directory has been created. Then, clone the Ipopt repository via
cd ${HOME}/Software
git clone https://github.com/lanl-ansi/Ipopt.git --branch develTo rebuild configuration files for Ipopt, if needed (e.g., during development), execute
cd ${HOME}/Software/Ipopt
git clone https://github.com/coin-or-tools/BuildTools.git
export COIN_AUTOTOOLS_DIR="${HOME}/local2"
./BuildTools/install_autotools.sh
./BuildTools/run_autotoolsIf you are not modifying the directory or source structure of Ipopt, this step is not required.
To compile Ipopt with SPRAL (CPU support only), specify ${SPRALDIR} as the directory containing lib/libspral.a, then execute
cd ${HOME}/Software/Ipopt
mkdir build
cd build
../configure --prefix=${PWD} --with-spral-lflags="-L${SPRALDIR}/lib -L${METISDIR}/lib \
-lspral -lgfortran -lhwloc -lm -lcoinmetis -lopenblas -lstdc++ -fopenmp" \
--with-spral-cflags="-I${SPRALDIR}/include" --with-lapack-lflags="-llapack -lopenblas"
make && make installTo compile with GPU support, execute
cd ${HOME}/Software/Ipopt
mkdir build
cd build
../configure --prefix=${PWD} --with-spral-lflags="-L${SPRALDIR}/lib -L${METISDIR}/lib \
-lspral -lgfortran -lhwloc -lm -lcoinmetis -lopenblas -lstdc++ -fopenmp \
-lcudadevrt -lcudart -lcuda -lcublas" --with-spral-cflags="-I${SPRALDIR}/include" \
--with-lapack-lflags="-llapack -lopenblas"
make && make installEnsure the following environment variables are set when using the SPRAL library:
export OMP_CANCELLATION=TRUE
export OMP_NESTED=TRUE
export OMP_PROC_BIND=TRUEWithin the build directory created above, the examples/ScalableProblems directory contains a set of scalable test problems.
After compilation of Ipopt, these examples can be compiled via
cd ${HOME}/Software/Ipopt/build
cd examples/ScalableProblems && makeAs an example, if Ipopt was compiled with SPRAL support, try creating a file named ipopt.opt in this directory with the contents
linear_solver spral
spral_use_gpu no
Then, solve a test problem, e.g.,
time ./solve_problem MBndryCntrl1 768If SPRAL was compiled with GPU support, next try modifying the ipopt.opt file to contain
linear_solver spral
spral_use_gpu yes
Then, solve the same test problem, e.g.,
time ./solve_problem MBndryCntrl1 768The real time required by the solver should typically decrease on very large, dense problems, compared with a solve using spral_use_gpu no.
If this is not the case, ensure your GPU is actually being recognized by SPRAL.
This issue is briefly discussed near the end of the associated SPRAL compilation guide.
Thanks for the note! It's been a while since these instructions have been updated, so I apologize for that. The forks are also dated, although they should still be usable.
In fact, the SPRAL interface to Ipopt is now supported in the official Ipopt repository. I also know there have been updates to the official SPRAL repository. Nonetheless, I have not seen this segmentation fault in my testing of the forked versions. It's possible that your issue would be resolved using the newer versions of Ipopt and SPRAL.
If it still doesn't work after compiling with newer versions, you could try to report an issue to either the upstream Ipopt or SPRAL repository, but it'd be good to isolate the issue, first. I'd be happy to take a look using the forked versions if you have a minimum working example (maybe an NL file?) that produces the segfault.