Skip to content

Instantly share code, notes, and snippets.

@ueliwechsler
Last active November 18, 2020 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ueliwechsler/25a8c4397089166324991661a2250c0e to your computer and use it in GitHub Desktop.
Save ueliwechsler/25a8c4397089166324991661a2250c0e to your computer and use it in GitHub Desktop.
using BinaryBuilder
name = "Ipopt_Spral"
version = v"0.1.0"
## Sources
sources = [
GitSource("https://github.com/coin-or-tools/ThirdParty-Metis.git", "48d89108b173dcf74cc7a27d0beff0eb5eedadd5"), # master
GitSource("https://github.com/lanl-ansi/spral.git", "3842fffd5b16f0bf85be6f4b2832816ac4405763"), # master
GitSource("https://github.com/lanl-ansi/Ipopt.git", "78a05e2b9138074682a057297b61524f7cb32b53"), # master
]
script = raw"""
cd ${WORKSPACE}/srcdir
# Compile METIS
cd ThirdParty-Metis && ./get.Metis
mkdir build
cd build
../configure --prefix=${PWD}
make && make install
export METISDIR=${PWD}
# Install Dependenices
# TODO: FIX
# sudo apt-get install hwloc libhwloc-dev
# sudo apt install libopenblas-dev
if [[ "${nbits}" == 64 ]] && [[ "${target}" != aarch64* ]]; then
OPENBLAS="${libdir}/libopenblas64_.${dlext}"
else
OPENBLAS="${libdir}/libopenblas.${dlext}"
fi
# ===== BUILD SPRAL =====
# Follow the instruction: https://github.com/lanl-ansi/spral/blob/master/COMPILE.md
cd ${WORKSPACE}/srcdir
cd spral
mkdir build
# ./autogen.sh # If compiling from scratch.
#CFLAGS=-fPIC CPPFLAGS=-fPIC CXXFLAGS=-fPIC FFLAGS=-fPIC \
# FCFLAGS=-fPIC ./configure --prefix=${PWD}/build \
# --with-blas="-lopenblas" --with-lapack="-llapack" \
# --with-metis="-L${METISDIR}/lib -lcoinmetis" \
# --with-metis-inc-dir="-I${METISDIR}/include/coin-or/metis"
./autogen.sh # If compiling from scratch.
CFLAGS=-fPIC CPPFLAGS=-fPIC CXXFLAGS=-fPIC FFLAGS=-fPIC \
FCFLAGS=-fPIC ./configure --prefix=${PWD}/build \
--with-blas="${OPENBLAS}" --with-lapack="${OPENBLAS}" \
--with-metis="-L${METISDIR}/lib -lcoinmetis" \
--with-metis-inc-dir="-I${METISDIR}/include/coin-or/metis"
make && make install
# USAGE
export SPRALDIR=${PWD}/build
export OMP_CANCELLATION=TRUE
export OMP_NESTED=TRUE
export OMP_PROC_BIND=TRUE
# ===== BUILD IPOPT =====
# Follow the instruction: https://github.com/lanl-ansi/Ipopt/blob/master/COMPILE.md
cd ${WORKSPACE}/srcdir/Ipopt
mkdir build
cd build
../configure --prefix=${PWD} --with-spral="-L${SPRALDIR}/lib -L${METISDIR}/lib \
-lspral -lgfortran -lhwloc -lm -lcoinmetis "${OPENBLAS}" -lstdc++ -fopenmp" \
--with-lapack-lflags="-llapack -lopenblas"
make && make install
"""
platforms = [
# Linux(:i686, libc=:glibc),
Linux(:x86_64, libc=:glibc),
# Linux(:aarch64, libc=:glibc),
# Linux(:armv7l, libc=:glibc, call_abi=:eabihf),
# Linux(:powerpc64le, libc=:glibc),
# Linux(:i686, libc=:musl),
# Linux(:x86_64, libc=:musl),
# Linux(:aarch64, libc=:musl),
# Linux(:armv7l, libc=:musl, call_abi=:eabihf),
# MacOS(:x86_64),
# FreeBSD(:x86_64),
# Windows(:i686),
# Windows(:x86_64)
]
# The products that we will ensure are always built
products = Product[
# LibraryProduct("libipopt", :libipopt),
# LibraryProduct("spral_ssids", :spral_ssids)
]
# Dependencies that must be installed before this package can be built
dependencies = [
Dependency("OpenBLAS_jll"),
Dependency("Hwloc_jll"),
# Dependency("CompilerSupportLibraries_jll")
]
# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)
@ueliwechsler
Copy link
Author

ueliwechsler commented Nov 18, 2020

Progress so far:

  • Metis compiled successfully
  • SPRAL: fails, does not seem to find OPENBLAS
checking for dummy main to link with Fortran 77 libraries... none
checking for Fortran 77 name-mangling scheme... lower case, underscore, no extra underscore
checking for sgemm_ in /workspace/destdir/lib/libopenblas64_.so... no
checking if sgemm_ is being linked in already... no
checking for sgemm_ in -lopenblas... no
checking for ATL_xerbla in -latlas... no
checking for sgemm_ in -lblas... no
checking for sgemm_ in -lmkl_gf_lp64... no
checking for sgemm_ in -lmkl... no
checking for sgemm_ in -framework vecLib... no
checking for sgemm_ in -lcxml... no
checking for sgemm_ in -ldxml... no
checking for sgemm_ in -lscs... no
checking for sgemm_ in -lcomplib.sgimath... no
checking for sgemm_ in -lblas... (cached) no
checking for sgemm_ in -lblas... (cached) no
configure: error: No BLAS library found.

Even though in /workspace/destdir/lib/ there seems to be a libopenblas64_.so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment