Skip to content

Commit ae54b7f

Browse files
authored
Merge pull request #342 from ICB-DCM/develop
Release 0.4.6
2 parents ee1de80 + e75509e commit ae54b7f

File tree

191 files changed

+5888
-2831
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+5888
-2831
lines changed

.github/workflows/parpe_tests.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,14 @@ jobs:
5353
-DBUILD_TESTS=OFF \
5454
&& cmake --build "${AMICI_PATH}/build" --parallel -- VERBOSE=1
5555
56-
- name: Install google test
57-
run: ThirdParty/installGoogleTest.sh
58-
5956
- name: Install parPE Python deps
6057
run: |
6158
pip install -r ${PARPE_BASE}/python/requirements.txt
6259
60+
- name: "Install parPE deps: fides"
61+
run: |
62+
sudo apt install libspdlog-dev && ${PARPE_BASE}/ThirdParty/installFides.sh
63+
6364
- name: Configure parPE
6465
run: |
6566
cmake \
@@ -69,7 +70,8 @@ jobs:
6970
-DIPOPT_INCLUDE_DIRS=/usr/include/coin/ \
7071
-DIPOPT_LIBRARIES=/usr/lib/libipopt.so \
7172
-DGCOV_REPORT=TRUE \
72-
-DBUILD_TESTING=TRUE
73+
-DBUILD_TESTING=TRUE \
74+
-DPARPE_ENABLE_FIDES=TRUE
7375
7476
- name: Build parPE
7577
# with sonar build wrapper

CMakeLists.txt

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
cmake_minimum_required(VERSION 3.10) # for GoogleTest
2-
cmake_policy(VERSION 3.10)
1+
cmake_minimum_required(VERSION 3.13) # pkg_search_module GLOBAL
2+
cmake_policy(VERSION 3.13)
33

44
if(POLICY CMP0074)
55
# Use package_ROOT environment variables
@@ -51,6 +51,7 @@ set(BUILD_PYTHON_MODULE FALSE CACHE BOOL "Build Python module?")
5151
set(BLAS "CBLAS" CACHE STRING "BLAS library to use")
5252
set_property(CACHE BLAS PROPERTY STRINGS "CBLAS" "MKL")
5353
set(PARPE_ENABLE_MPI TRUE CACHE BOOL "Use MPI?")
54+
set(PARPE_ENABLE_FIDES FALSE CACHE BOOL "Enable fides optimizer?")
5455
set(PARPE_ENABLE_IPOPT TRUE CACHE BOOL "Enable ipopt optimizer?")
5556
set(PARPE_ENABLE_CERES TRUE CACHE BOOL "Enable ceres optimizer?")
5657
set(PARPE_ENABLE_DLIB FALSE CACHE BOOL "Enable dlib optimizers?")
@@ -68,13 +69,17 @@ if(${PARPE_ENABLE_MPI})
6869
endif(${PARPE_ENABLE_MPI})
6970
# </Build options>
7071

72+
if(${PARPE_ENABLE_FIDES})
73+
find_package(Fides REQUIRED)
74+
endif(${PARPE_ENABLE_FIDES})
75+
7176
find_package(PkgConfig)
7277
pkg_search_module(IPOPT REQUIRED IMPORTED_TARGET GLOBAL ipopt>=3.11.0 )
7378

74-
if(${ENABLE_DLIB})
79+
if(${PARPE_ENABLE_DLIB})
7580
set(DLIB_DIR "${CMAKE_CURRENT_LIST_DIR}/ThirdParty/dlib-19.7"
7681
CACHE FILEPATH "DLIB base directory")
77-
endif(${ENABLE_DLIB})
82+
endif(${PARPE_ENABLE_DLIB})
7883

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

104-
# googletest
105-
add_definitions(-DGTEST_LANGUAGE_CXX11)
106-
find_package(Threads REQUIRED)
107-
if ($ENV{GOOGLETEST_DIR})
108-
set(GOOGLETEST_DIR $ENV{GOOGLETEST_DIR})
109-
else()
110-
set(GOOGLETEST_DIR "${CMAKE_CURRENT_LIST_DIR}/ThirdParty/googletest")
111-
endif()
112-
if (EXISTS ${GOOGLETEST_DIR})
113-
set(GTestSrc ${GOOGLETEST_DIR}/googletest)
114-
set(GMockSrc ${GOOGLETEST_DIR}/googlemock)
115-
else ()
116-
message(FATAL_ERROR "No googletest src dir found - set GOOGLETEST_DIR "
117-
"or run ../ThirdParty/installGoogleTest.sh to enable!"
118-
" (Or disable building tests with BUILD_TESTING=OFF)")
119-
endif ()
120-
include_directories(${GTestSrc} "${GTestSrc}/include"
121-
${GMockSrc} "${GMockSrc}/include")
122-
123109
# <Coverage>
124110
# Create test coverage reports?
125111
set(GCOV_REPORT FALSE CACHE BOOL "Create GCOV report?")

CMakeModules/ParPEConfig.cmake.in

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ include(CMakeFindDependencyMacro)
55
set(PARPE_ENABLE_MPI @PARPE_ENABLE_MPI@)
66
set(PARPE_ENABLE_IPOPT @PARPE_ENABLE_IPOPT@)
77
set(PARPE_ENABLE_CERES @PARPE_ENABLE_CERES@)
8+
set(PARPE_ENABLE_FIDES @PARPE_ENABLE_FIDES@)
89

910
if(${PARPE_ENABLE_MPI})
1011
find_dependency(MPI REQUIRED)
1112
endif()
1213

1314
if(${PARPE_ENABLE_IPOPT})
1415
find_dependency(PkgConfig REQUIRED)
15-
pkg_search_module(IPOPT REQUIRED IMPORTED_TARGET GLOBAL ipopt>=3.11.0)
16+
pkg_search_module(IPOPT REQUIRED IMPORTED_TARGET GLOBAL ipopt=@IPOPT_VERSION@)
17+
message("-- Found Ipopt version: ${IPOPT_VERSION}")
1618
endif()
1719

1820
if(${PARPE_ENABLE_CERES})
@@ -21,6 +23,11 @@ find_dependency(Ceres COMPONENTS
2123
find_dependency(Eigen3 REQUIRED)
2224
endif()
2325

26+
if(${PARPE_ENABLE_FIDES})
27+
find_dependency(Fides
28+
HINTS "${CMAKE_SOURCE_DIR}/ThirdParty/fides-cpp/build/")
29+
endif()
30+
2431
find_dependency(Amici REQUIRED)
2532
find_dependency(OpenMP)
2633
find_dependency(HDF5 COMPONENTS C CXX HL REQUIRED)

ThirdParty/installDeps.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,3 @@ cd "$script_dir"
1515
./installCeres.sh
1616

1717
./installIpopt.sh
18-
19-
./installGoogleTest.sh

ThirdParty/installDlib.sh

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
#!/usr/bin/env bash
2-
# build DLIB
2+
# Download and build DLIB
33

44
set -euo pipefail
5+
script_dir=$(dirname "$0")
6+
script_dir=$(cd "${script_dir}" && pwd)
7+
cd "${script_dir}"
8+
9+
make_opts=${MAKEOPTS-}
510

611
dlib_archive="dlib-19.7.tar.bz2"
7-
if [ ! -d "dlib-19.7" ]; then
12+
dlib_dir=${script_dir}/dlib-19.7
13+
14+
if [ ! -d "${dlib_dir}" ]; then
815
if [ ! -f "${dlib_archive}" ]; then
9-
wget "http://dlib.net/files/${dlib_archive}" -o "${dlib_archive}"
16+
wget "http://dlib.net/files/${dlib_archive}" -O "${dlib_archive}"
1017
fi
1118
tar -xjf "${dlib_archive}"
1219
fi
1320

14-
cd "dlib-19.7/"
21+
cd "${dlib_dir}"
1522
mkdir -p build && cd build/
16-
cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
17-
-DDLIB_NO_GUI_SUPPORT=ON \
18-
-DDLIB_GIF_SUPPORT=OFF \
19-
-DDLIB_JPEG_SUPPORT=OFF \
20-
-DDLIB_PNG_SUPPORT=OFF \
21-
-DDLIB_LINK_WITH_SQLITE3=OFF \
22-
..
23+
cmake -S .. \
24+
-DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
25+
-DDLIB_NO_GUI_SUPPORT=ON \
26+
-DDLIB_GIF_SUPPORT=OFF \
27+
-DDLIB_JPEG_SUPPORT=OFF \
28+
-DDLIB_PNG_SUPPORT=OFF \
29+
-DDLIB_LINK_WITH_SQLITE3=OFF \
30+
..
2331

24-
make -j12 && make install
32+
make ${make_opts} && make install

ThirdParty/installFides.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
# Download and build fides-cpp
3+
4+
build_blaze() {
5+
cd "${script_dir}"
6+
7+
if [[ ! -d "${blaze_dir}" ]]; then
8+
if [[ ! -f "blaze-3.8.tar.gz" ]]; then
9+
wget https://bitbucket.org/blaze-lib/blaze/downloads/blaze-3.8.tar.gz
10+
fi
11+
tar -xzf blaze-3.8.tar.gz
12+
cd blaze-3.8
13+
cmake -S . -B build/ -DCMAKE_INSTALL_PREFIX="$(pwd)/build/install"
14+
cd build
15+
make -j2 install
16+
fi
17+
}
18+
19+
build_fides() {
20+
if [ ! -d "${fides_dir}" ]; then
21+
cd "${script_dir}"
22+
git clone https://github.com/dweindl/fides-cpp.git
23+
cd "${fides_dir}"
24+
git checkout 9906bdac6a1966ddd4b37b96f98ad8f89770c128
25+
fi
26+
27+
cd "${fides_dir}"
28+
cmake -S . -B build -DBUILD_TESTING=OFF
29+
cd build
30+
make ${make_opts}
31+
}
32+
33+
set -euo pipefail
34+
script_dir=$(dirname "$0")
35+
script_dir=$(cd "${script_dir}" && pwd)
36+
cd "${script_dir}"
37+
38+
make_opts=${MAKEOPTS-}
39+
40+
fides_dir=${script_dir}/fides-cpp
41+
blaze_dir=${script_dir}/blaze-3.8
42+
43+
build_blaze
44+
build_fides

ThirdParty/installGoogleTest.sh

Lines changed: 0 additions & 28 deletions
This file was deleted.

ThirdParty/installIpopt.sh

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# build Ipopt
2+
# Download and build Ipopt and HSL
33

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

1717
if [[ ! -d "${ipopt_dir}" ]]; then
1818
if [[ ! -f "${ipopt_archive}" ]]; then
19+
echo "Downloading IpOpt source archive ..."
1920
wget -O "${ipopt_archive}" "${ipopt_url}"
2021
else
2122
echo "Skipping download step."
@@ -26,50 +27,63 @@ if [[ ! -d "${ipopt_dir}" ]]; then
2627
# Handle HSL solvers
2728
cd "${ipopt_dir}"
2829
if [[ ! -d "ThirdParty-HSL" ]]; then
30+
echo "Cloning ThirdParty-HSL ..."
2931
git clone https://github.com/coin-or-tools/ThirdParty-HSL.git
3032
fi
3133

3234
cd ThirdParty-HSL
3335

36+
# Need some coinhsl library.
3437
if [[ ! -d "coinhsl" ]]; then
35-
# Need some coinhsl library. Check for common ones:
36-
if [[ -f "${script_dir}/coinhsl-2015.06.23.tar.gz" ]]; then
37-
tar -xzf "${script_dir}/coinhsl-2015.06.23.tar.gz"
38-
mv coinhsl-2015.06.23 coinhsl
39-
elif [[ -f "${script_dir}/coinhsl-2014.01.10.tar.gz" ]]; then
40-
tar -xzf "${script_dir}/coinhsl-2014.01.10.tar.gz"
41-
mv coinhsl-2014.01.10 coinhsl
42-
elif [[ -f "${script_dir}/coinhsl-2019.05.21.tar.gz" ]]; then
43-
tar -xzf "${script_dir}/coinhsl-2019.05.21.tar.gz"
44-
mv coinhsl-2019.05.21 coinhsl
38+
# ThirdParty/coinhsl ?
39+
if [[ -d "${script_dir}/coinhsl" ]]; then
40+
echo "Using coinhsl from ${script_dir}/coinhsl"
41+
cp -aR "${script_dir}/coinhsl" coinhsl
4542
else
46-
echo "Did not find coinhsl/ or a known coinhsl archive."
47-
echo "Name your coinhsl version."
48-
read version
49-
if [[ -f "${script_dir}/coinhsl-${version}.tar.gz" ]]; then
50-
tar -xzf "${script_dir}/coinhsl-${version}.tar.gz"
51-
mv coinhsl-${version} coinhsl
52-
else
53-
echo "Press any key to continue"
54-
read -n 1 -s -r
55-
fi
43+
# Check for common ones:
44+
coinhsl_archive_names="
45+
coinhsl-2014.01.10
46+
coinhsl-2015.06.23
47+
coinhsl-2019.05.21
48+
"
49+
for coinhsl_archive in $coinhsl_archive_names; do
50+
if [[ -f "${script_dir}/${coinhsl_archive}.tar.gz" ]]; then
51+
echo "Unpacking ${script_dir}/${coinhsl_archive}.tar.gz ..."
52+
tar -xzf "${script_dir}/${coinhsl_archive}.tar.gz"
53+
mv "${coinhsl_archive}" coinhsl
54+
fi
55+
done
5656
fi
57+
58+
if [[ ! -d "coinhsl" ]]; then
59+
echo "Did not find coinhsl/ or a known coinhsl archive." \
60+
"IpOpt will probably not work."
61+
fi
62+
fi
63+
64+
# Use Intel MKL for lapack?
65+
lapack_lflags=""
66+
if [[ -v MKL_SHLIB ]]; then
67+
# Will require F77=ifort when using intel compilers.
68+
lapack_lflags="--with-lapack-lflags=${MKL_SHLIB}"
5769
fi
5870

59-
./configure --prefix="${hsl_install_dir}"
60-
make
71+
./configure --prefix="${hsl_install_dir}" \
72+
--with-lapack "${lapack_lflags}" \
73+
--disable-static --enable-shared
74+
make $make_opts
6175
make install
62-
(cd ${hsl_install_dir}/lib && test ! -e libhsl.so && ln -s libcoinhsl.so libhsl.so || true)
6376

6477
cd "${ipopt_dir}"
78+
79+
PKG_CONFIG_PATH=${PKG_CONFIG_PATH-}:${hsl_install_dir}/lib/pkgconfig/ \
6580
./configure --prefix="${ipopt_install_dir}" \
66-
--enable-static \
67-
--disable-shared \
81+
--disable-static \
82+
--enable-shared \
6883
--with-pic \
6984
--with-hsl \
70-
--with-hsl-cflags=-I${hsl_install_dir}/include/coin-or/hsl \
71-
--with-hsl-lflags="-L${hsl_install_dir}/lib/ -lcoinhsl" \
72-
--disable-linear-solver-loader
85+
--disable-linear-solver-loader \
86+
--with-lapack "${lapack_lflags}"
7387
make $make_opts
7488
make $make_opts install
7589
else

0 commit comments

Comments
 (0)