-
Notifications
You must be signed in to change notification settings - Fork 3
Compiling HSL Libraries for use with NLPModelsAlgencan.jl
This page documents how to compile HSL MA57 to use with Algencan (only MA57 for now).
-
Get the source code from HSL from http://www.hsl.rl.ac.uk/catalogue/hsl_ma57.html. I only have access to the academic version, so this documentation is assuming that you have that version. Probably the code is the same for both the academic and paid version, so the documentation should work anyhow. After downloading the code you should have a file named
hsl_ma57-5.2.0.tar.gz
. -
Get the latest version of 4.0.X METIS from http://glaros.dtc.umn.edu/gkhome/fsroot/sw/metis/OLD. In my case I got the file
metis-4.0.3.tar.gz
. -
Grab the patches from the NLPModelsAlgencan.jl project page (it is in the deps/patches subdir).
-
Put the sources and patches obtained above in a new directory that you created only for the compilation and move there.
-
Unpack metis, compile it with
-fPIC
and save in the METISPATH variable its location. I didtar xvf metis-4.0.3.tar.gz cd metis-4.0.3 make COPTIONS="-fPIC -O3" export METISPATH=$PWD cd ..
-
Unpack
hsl_ma57-5.2.0.tar.gz
and patch it using thepatch_ma57.txt
and compile it. In my case I didtar xvf hsl_ma57-5.2.0.tar.gz cd hsl_ma57-5.2.0 patch -p1 < ../patch_ma57.txt ./configure --with-metis=$METISPATH/libmetis.a --prefix=$PWD CFLAGS="-fPIC -O3" FCFLAGS="-fPIC -O3" FFLAGS="-fPIC -O3" make make install export MA57PATH=$PWD cd ..
Obs: Note that we use the
$METISPATH
variable that was defined above to point to the METIS source.Obs2: If you want you can run a
make check
to verify the compilation. -
Unpack
Algencan-3.1.1.tgz
, apply the patch and compile.cd algencan-3.1.1 patch -p1 < ../patch_algencan.txt make
Obs: You may want to test Algencan with a CUTEst problem.
-
Generate the shared library. From the top Algencan dir do:
cd lib gfortran -shared -o libalgencan.so -Wl,--whole-archive libalgencan.a -Wl,--no-whole-archive -l gfortran -lblas -llapack export ALGENCAN_LIB_DIR=$PWD
Now you can install NLPModelsAlgencan.jl using in the package mode of Julia's REPL
(1.x) pkg> add NLPModelsAlgencan
julia> using NLPModelsAlgencan
Obs: If you installed Algencan before and compiled a new shared library it is better to uninstall it, garbage collect and then install it with the ALGENCAN_LIB_DIR
pointing to the newly compiled library.
(v1.x) pkg> rm NLPModelsAlgencan
(v1.x) pkg> gc
(v1.x) pkg> add NLPModelsAlgencan
julia> using NLPModelsAlgencan