Skip to content

Commit

Permalink
Merge pull request #342 from ICB-DCM/develop
Browse files Browse the repository at this point in the history
Release 0.4.6
  • Loading branch information
dweindl authored Jun 3, 2021
2 parents ee1de80 + e75509e commit ae54b7f
Show file tree
Hide file tree
Showing 191 changed files with 5,888 additions and 2,831 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/parpe_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ jobs:
-DBUILD_TESTS=OFF \
&& cmake --build "${AMICI_PATH}/build" --parallel -- VERBOSE=1
- name: Install google test
run: ThirdParty/installGoogleTest.sh

- name: Install parPE Python deps
run: |
pip install -r ${PARPE_BASE}/python/requirements.txt
- name: "Install parPE deps: fides"
run: |
sudo apt install libspdlog-dev && ${PARPE_BASE}/ThirdParty/installFides.sh
- name: Configure parPE
run: |
cmake \
Expand All @@ -69,7 +70,8 @@ jobs:
-DIPOPT_INCLUDE_DIRS=/usr/include/coin/ \
-DIPOPT_LIBRARIES=/usr/lib/libipopt.so \
-DGCOV_REPORT=TRUE \
-DBUILD_TESTING=TRUE
-DBUILD_TESTING=TRUE \
-DPARPE_ENABLE_FIDES=TRUE
- name: Build parPE
# with sonar build wrapper
Expand Down
32 changes: 9 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10) # for GoogleTest
cmake_policy(VERSION 3.10)
cmake_minimum_required(VERSION 3.13) # pkg_search_module GLOBAL
cmake_policy(VERSION 3.13)

if(POLICY CMP0074)
# Use package_ROOT environment variables
Expand Down Expand Up @@ -51,6 +51,7 @@ set(BUILD_PYTHON_MODULE FALSE CACHE BOOL "Build Python module?")
set(BLAS "CBLAS" CACHE STRING "BLAS library to use")
set_property(CACHE BLAS PROPERTY STRINGS "CBLAS" "MKL")
set(PARPE_ENABLE_MPI TRUE CACHE BOOL "Use MPI?")
set(PARPE_ENABLE_FIDES FALSE CACHE BOOL "Enable fides optimizer?")
set(PARPE_ENABLE_IPOPT TRUE CACHE BOOL "Enable ipopt optimizer?")
set(PARPE_ENABLE_CERES TRUE CACHE BOOL "Enable ceres optimizer?")
set(PARPE_ENABLE_DLIB FALSE CACHE BOOL "Enable dlib optimizers?")
Expand All @@ -68,13 +69,17 @@ if(${PARPE_ENABLE_MPI})
endif(${PARPE_ENABLE_MPI})
# </Build options>

if(${PARPE_ENABLE_FIDES})
find_package(Fides REQUIRED)
endif(${PARPE_ENABLE_FIDES})

find_package(PkgConfig)
pkg_search_module(IPOPT REQUIRED IMPORTED_TARGET GLOBAL ipopt>=3.11.0 )

if(${ENABLE_DLIB})
if(${PARPE_ENABLE_DLIB})
set(DLIB_DIR "${CMAKE_CURRENT_LIST_DIR}/ThirdParty/dlib-19.7"
CACHE FILEPATH "DLIB base directory")
endif(${ENABLE_DLIB})
endif(${PARPE_ENABLE_DLIB})

# PThreads
set(THREADS_PREFER_PTHREAD_FLAG ON)
Expand All @@ -101,25 +106,6 @@ if(${BUILD_TESTING})
set(TESTS_MPIEXEC_COMMAND
mpiexec --allow-run-as-root --oversubscribe -n 4 CACHE STRING "")

# googletest
add_definitions(-DGTEST_LANGUAGE_CXX11)
find_package(Threads REQUIRED)
if ($ENV{GOOGLETEST_DIR})
set(GOOGLETEST_DIR $ENV{GOOGLETEST_DIR})
else()
set(GOOGLETEST_DIR "${CMAKE_CURRENT_LIST_DIR}/ThirdParty/googletest")
endif()
if (EXISTS ${GOOGLETEST_DIR})
set(GTestSrc ${GOOGLETEST_DIR}/googletest)
set(GMockSrc ${GOOGLETEST_DIR}/googlemock)
else ()
message(FATAL_ERROR "No googletest src dir found - set GOOGLETEST_DIR "
"or run ../ThirdParty/installGoogleTest.sh to enable!"
" (Or disable building tests with BUILD_TESTING=OFF)")
endif ()
include_directories(${GTestSrc} "${GTestSrc}/include"
${GMockSrc} "${GMockSrc}/include")

# <Coverage>
# Create test coverage reports?
set(GCOV_REPORT FALSE CACHE BOOL "Create GCOV report?")
Expand Down
9 changes: 8 additions & 1 deletion CMakeModules/ParPEConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ include(CMakeFindDependencyMacro)
set(PARPE_ENABLE_MPI @PARPE_ENABLE_MPI@)
set(PARPE_ENABLE_IPOPT @PARPE_ENABLE_IPOPT@)
set(PARPE_ENABLE_CERES @PARPE_ENABLE_CERES@)
set(PARPE_ENABLE_FIDES @PARPE_ENABLE_FIDES@)

if(${PARPE_ENABLE_MPI})
find_dependency(MPI REQUIRED)
endif()

if(${PARPE_ENABLE_IPOPT})
find_dependency(PkgConfig REQUIRED)
pkg_search_module(IPOPT REQUIRED IMPORTED_TARGET GLOBAL ipopt>=3.11.0)
pkg_search_module(IPOPT REQUIRED IMPORTED_TARGET GLOBAL ipopt=@IPOPT_VERSION@)
message("-- Found Ipopt version: ${IPOPT_VERSION}")
endif()

if(${PARPE_ENABLE_CERES})
Expand All @@ -21,6 +23,11 @@ find_dependency(Ceres COMPONENTS
find_dependency(Eigen3 REQUIRED)
endif()

if(${PARPE_ENABLE_FIDES})
find_dependency(Fides
HINTS "${CMAKE_SOURCE_DIR}/ThirdParty/fides-cpp/build/")
endif()

find_dependency(Amici REQUIRED)
find_dependency(OpenMP)
find_dependency(HDF5 COMPONENTS C CXX HL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ThirdParty/installDeps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@ cd "$script_dir"
./installCeres.sh

./installIpopt.sh

./installGoogleTest.sh
32 changes: 20 additions & 12 deletions ThirdParty/installDlib.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
#!/usr/bin/env bash
# build DLIB
# Download and build DLIB

set -euo pipefail
script_dir=$(dirname "$0")
script_dir=$(cd "${script_dir}" && pwd)
cd "${script_dir}"

make_opts=${MAKEOPTS-}

dlib_archive="dlib-19.7.tar.bz2"
if [ ! -d "dlib-19.7" ]; then
dlib_dir=${script_dir}/dlib-19.7

if [ ! -d "${dlib_dir}" ]; then
if [ ! -f "${dlib_archive}" ]; then
wget "http://dlib.net/files/${dlib_archive}" -o "${dlib_archive}"
wget "http://dlib.net/files/${dlib_archive}" -O "${dlib_archive}"
fi
tar -xjf "${dlib_archive}"
fi

cd "dlib-19.7/"
cd "${dlib_dir}"
mkdir -p build && cd build/
cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
-DDLIB_NO_GUI_SUPPORT=ON \
-DDLIB_GIF_SUPPORT=OFF \
-DDLIB_JPEG_SUPPORT=OFF \
-DDLIB_PNG_SUPPORT=OFF \
-DDLIB_LINK_WITH_SQLITE3=OFF \
..
cmake -S .. \
-DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
-DDLIB_NO_GUI_SUPPORT=ON \
-DDLIB_GIF_SUPPORT=OFF \
-DDLIB_JPEG_SUPPORT=OFF \
-DDLIB_PNG_SUPPORT=OFF \
-DDLIB_LINK_WITH_SQLITE3=OFF \
..

make -j12 && make install
make ${make_opts} && make install
44 changes: 44 additions & 0 deletions ThirdParty/installFides.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
# Download and build fides-cpp

build_blaze() {
cd "${script_dir}"

if [[ ! -d "${blaze_dir}" ]]; then
if [[ ! -f "blaze-3.8.tar.gz" ]]; then
wget https://bitbucket.org/blaze-lib/blaze/downloads/blaze-3.8.tar.gz
fi
tar -xzf blaze-3.8.tar.gz
cd blaze-3.8
cmake -S . -B build/ -DCMAKE_INSTALL_PREFIX="$(pwd)/build/install"
cd build
make -j2 install
fi
}

build_fides() {
if [ ! -d "${fides_dir}" ]; then
cd "${script_dir}"
git clone https://github.com/dweindl/fides-cpp.git
cd "${fides_dir}"
git checkout 9906bdac6a1966ddd4b37b96f98ad8f89770c128
fi

cd "${fides_dir}"
cmake -S . -B build -DBUILD_TESTING=OFF
cd build
make ${make_opts}
}

set -euo pipefail
script_dir=$(dirname "$0")
script_dir=$(cd "${script_dir}" && pwd)
cd "${script_dir}"

make_opts=${MAKEOPTS-}

fides_dir=${script_dir}/fides-cpp
blaze_dir=${script_dir}/blaze-3.8

build_blaze
build_fides
28 changes: 0 additions & 28 deletions ThirdParty/installGoogleTest.sh

This file was deleted.

72 changes: 43 additions & 29 deletions ThirdParty/installIpopt.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# build Ipopt
# Download and build Ipopt and HSL

set -euo pipefail
script_dir=$(dirname "$0")
Expand All @@ -16,6 +16,7 @@ hsl_install_dir="${ipopt_dir}/ThirdParty-HSL/install"

if [[ ! -d "${ipopt_dir}" ]]; then
if [[ ! -f "${ipopt_archive}" ]]; then
echo "Downloading IpOpt source archive ..."
wget -O "${ipopt_archive}" "${ipopt_url}"
else
echo "Skipping download step."
Expand All @@ -26,50 +27,63 @@ if [[ ! -d "${ipopt_dir}" ]]; then
# Handle HSL solvers
cd "${ipopt_dir}"
if [[ ! -d "ThirdParty-HSL" ]]; then
echo "Cloning ThirdParty-HSL ..."
git clone https://github.com/coin-or-tools/ThirdParty-HSL.git
fi

cd ThirdParty-HSL

# Need some coinhsl library.
if [[ ! -d "coinhsl" ]]; then
# Need some coinhsl library. Check for common ones:
if [[ -f "${script_dir}/coinhsl-2015.06.23.tar.gz" ]]; then
tar -xzf "${script_dir}/coinhsl-2015.06.23.tar.gz"
mv coinhsl-2015.06.23 coinhsl
elif [[ -f "${script_dir}/coinhsl-2014.01.10.tar.gz" ]]; then
tar -xzf "${script_dir}/coinhsl-2014.01.10.tar.gz"
mv coinhsl-2014.01.10 coinhsl
elif [[ -f "${script_dir}/coinhsl-2019.05.21.tar.gz" ]]; then
tar -xzf "${script_dir}/coinhsl-2019.05.21.tar.gz"
mv coinhsl-2019.05.21 coinhsl
# ThirdParty/coinhsl ?
if [[ -d "${script_dir}/coinhsl" ]]; then
echo "Using coinhsl from ${script_dir}/coinhsl"
cp -aR "${script_dir}/coinhsl" coinhsl
else
echo "Did not find coinhsl/ or a known coinhsl archive."
echo "Name your coinhsl version."
read version
if [[ -f "${script_dir}/coinhsl-${version}.tar.gz" ]]; then
tar -xzf "${script_dir}/coinhsl-${version}.tar.gz"
mv coinhsl-${version} coinhsl
else
echo "Press any key to continue"
read -n 1 -s -r
fi
# Check for common ones:
coinhsl_archive_names="
coinhsl-2014.01.10
coinhsl-2015.06.23
coinhsl-2019.05.21
"
for coinhsl_archive in $coinhsl_archive_names; do
if [[ -f "${script_dir}/${coinhsl_archive}.tar.gz" ]]; then
echo "Unpacking ${script_dir}/${coinhsl_archive}.tar.gz ..."
tar -xzf "${script_dir}/${coinhsl_archive}.tar.gz"
mv "${coinhsl_archive}" coinhsl
fi
done
fi

if [[ ! -d "coinhsl" ]]; then
echo "Did not find coinhsl/ or a known coinhsl archive." \
"IpOpt will probably not work."
fi
fi

# Use Intel MKL for lapack?
lapack_lflags=""
if [[ -v MKL_SHLIB ]]; then
# Will require F77=ifort when using intel compilers.
lapack_lflags="--with-lapack-lflags=${MKL_SHLIB}"
fi

./configure --prefix="${hsl_install_dir}"
make
./configure --prefix="${hsl_install_dir}" \
--with-lapack "${lapack_lflags}" \
--disable-static --enable-shared
make $make_opts
make install
(cd ${hsl_install_dir}/lib && test ! -e libhsl.so && ln -s libcoinhsl.so libhsl.so || true)

cd "${ipopt_dir}"

PKG_CONFIG_PATH=${PKG_CONFIG_PATH-}:${hsl_install_dir}/lib/pkgconfig/ \
./configure --prefix="${ipopt_install_dir}" \
--enable-static \
--disable-shared \
--disable-static \
--enable-shared \
--with-pic \
--with-hsl \
--with-hsl-cflags=-I${hsl_install_dir}/include/coin-or/hsl \
--with-hsl-lflags="-L${hsl_install_dir}/lib/ -lcoinhsl" \
--disable-linear-solver-loader
--disable-linear-solver-loader \
--with-lapack "${lapack_lflags}"
make $make_opts
make $make_opts install
else
Expand Down
Loading

0 comments on commit ae54b7f

Please sign in to comment.