Skip to content

Commit

Permalink
updated optimizer compilation scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
wahln committed Feb 1, 2023
1 parent b353948 commit 5eff06f
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 48 deletions.
9 changes: 7 additions & 2 deletions optimization/optimizer/compile_ipopt_minGW_octave640.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ pacman -Sy
# pacman -S --noconfirm --needed wget which git
pacman -S --noconfirm --needed which

echo "check_certificate = off" >> ~/.wgetrc

# Run the following commands to create directories and get the IPOPT source. We dont need lapack and blas, since Octave comes with lapack and openblas

mkdir ipopt && cd ipopt
Expand All @@ -20,10 +22,13 @@ tar -zxvf Ipopt-3.12.13.tgz
mv Ipopt-3.12.13/* ./

cd $IPOPTDIR/ThirdParty/Blas
# First we need to replace the url as the version can no longer be downloaded
sed -i 's,http://www.netlib.org/blas/,http://coin-or-tools.github.io/ThirdParty-Blas/,g' get.Blas
./get.Blas
cd $IPOPTDIR/ThirdParty/Lapack
./get.Lapack
cd $IPOPTDIR/ThirdParty/Metis
sed -i 's,http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/OLD/,http://coin-or-tools.github.io/ThirdParty-Metis/,g' get.Metis
./get.Metis
cd $IPOPTDIR/ThirdParty/Mumps
# First we need to replace the url as the version can no longer be downloaded
Expand Down Expand Up @@ -51,10 +56,10 @@ cd ../..
# If everything worked, you should see some (static) libraries when doing ls /usr/local/lib
# we can get the mex interface

git clone --depth 1 --branch 1.0.0 https://github.com/ebertolazzi/mexIPOPT
git clone --depth 1 --branch 1.1.4 https://github.com/ebertolazzi/mexIPOPT

# and compile it.
mkoctfile --mex -ImexIPOPT/src -I$IPOPTINSTALLDIR/include/coin mexIPOPT/src/ipopt.cc mexIPOPT/src/IpoptInterfaceCommon.cc -v -DMATLAB_MEXFILE -DHAVE_CSTDDEF -DIPOPT_INTERFACE_MISSING_COPY_N -lipopt -lcoinmumps -lcoinmetis -lcoinlapack -lcoinblas -lgfortran -L$IPOPTINSTALLDIR/lib
mkoctfile --mex -ImexIPOPT/toolbox/src -I$IPOPTINSTALLDIR/include/coin mexIPOPT/toolbox/src/ipopt.cc mexIPOPT/toolbox/src/IpoptInterfaceCommon.cc -v -DMATLAB_MEXFILE -DHAVE_CSTDDEF -DIPOPT_INTERFACE_MISSING_COPY_N -lipopt -lcoinmumps -lcoinmetis -lcoinlapack -lcoinblas -lgfortran -L$IPOPTINSTALLDIR/lib

echo "Do you wish to remove the IPOPT compilation directories?"
select yn in "Yes" "No"; do
Expand Down
46 changes: 0 additions & 46 deletions optimization/optimizer/compile_ipopt_ubuntu22_octave64.sh

This file was deleted.

62 changes: 62 additions & 0 deletions optimization/optimizer/compile_ipopt_ubuntu22_octave640.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# The following has been tested in Ubuntu 22.04 with gcc
# Note that this uses a reference BLAS and LAPACK and links everything statically.
# For better optimizer performence, consider using optimized implementations (e.g. OpenBLAS) and an updated IPOPT and use this script as a guideline.
# You could also link against openblas and lapack as octave uses those libraries anyways
echo "check_certificate = off" >> ~/.wgetrc

# Run the following commands to create directories and get the IPOPT source.
mkdir ipopt && cd ipopt
export IPOPTINSTALLDIR=`pwd`
cd ..

mkdir IpoptMUMPS && cd IpoptMUMPS
export IPOPTDIR=`pwd`

wget --no-check-certificate https://www.coin-or.org/download/source/Ipopt/Ipopt-3.12.13.tgz
tar -zxvf Ipopt-3.12.13.tgz
mv Ipopt-3.12.13/* ./

cd $IPOPTDIR/ThirdParty/Blas
# First we need to replace the url as the version can no longer be downloaded
sed -i 's,http://www.netlib.org/blas/,http://coin-or-tools.github.io/ThirdParty-Blas/,g' get.Blas
./get.Blas
cd $IPOPTDIR/ThirdParty/Lapack
./get.Lapack
cd $IPOPTDIR/ThirdParty/Metis
sed -i 's,http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/OLD/,http://coin-or-tools.github.io/ThirdParty-Metis/,g' get.Metis
./get.Metis
cd $IPOPTDIR/ThirdParty/Mumps
# First we need to replace the url as the version can no longer be downloaded
sed -i 's,http://mumps.enseeiht.fr/,http://coin-or-tools.github.io/ThirdParty-Mumps/,g' get.Mumps
./get.Mumps

cd $IPOPTDIR


# Now lets start the build process
mkdir build
cd build

../configure --prefix=$IPOPTINSTALLDIR --disable-shared --enable-static ADD_FFLAGS="-fallow-argument-mismatch -fPIC" ADD_FCLAGS="-fallow-argument-mismatch -fPIC" ADD_CXXFLAGS="-fPIC" ADD_CFLAGS="-fPIC"
make
make install

cd ../..

# If everything worked, you should see some (static) libraries when doing ls /usr/local/lib
# we can get the mex interface

git clone --depth 1 --branch 1.1.4 https://github.com/ebertolazzi/mexIPOPT

# and compile it.
mkoctfile --mex -ImexIPOPT/toolbox/src -I$IPOPTINSTALLDIR/include/coin mexIPOPT/toolbox/src/ipopt.cc mexIPOPT/toolbox/src/IpoptInterfaceCommon.cc -v -DMATLAB_MEXFILE -DHAVE_CSTDDEF -DIPOPT_INTERFACE_MISSING_COPY_N -lipopt -lcoinmumps -lcoinmetis -lcoinlapack -lcoinblas -lgfortran -L$IPOPTINSTALLDIR/lib

echo "Do you wish to remove the IPOPT compilation directories?"
select yn in "Yes" "No"; do
case $yn in
Yes ) rm -rf $IPOPTDIR; rm -rf mexIPOPT; break;;
No ) exit;;
esac
done


0 comments on commit 5eff06f

Please sign in to comment.