From 4f6e8297c2b131a8458aecd8323487aa510ec5cc Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 21 Nov 2023 14:28:41 +0100 Subject: [PATCH] GHA: Fix OpenMP not found on macos (#2207) * Ensure cmake can find OpenMP * Assert that amici was compiled with OpenMP support * Update installation guide Fixes #2182 --- .github/workflows/test_python_cplusplus.yml | 15 +++++++++------ documentation/python_installation.rst | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test_python_cplusplus.yml b/.github/workflows/test_python_cplusplus.yml index 860e1d6218..a531d2db2c 100644 --- a/.github/workflows/test_python_cplusplus.yml +++ b/.github/workflows/test_python_cplusplus.yml @@ -36,6 +36,9 @@ jobs: - name: Install python package run: scripts/installAmiciSource.sh + - name: Check OpenMP support + run: source build/venv/bin/activate && python -c "import amici; import sys; sys.exit(not amici.compiledWithOpenMP())" + - name: Python tests (part 1) run: | source build/venv/bin/activate \ @@ -225,15 +228,12 @@ jobs: - run: echo "BNGPATH=${AMICI_DIR}/ThirdParty/BioNetGen-2.7.0" >> $GITHUB_ENV # Ensure CMake is using the python version that we will use for the python tests later on - run: echo "PYTHON_EXECUTABLE=${Python3_ROOT_DIR}/bin/python3" >> $GITHUB_ENV + - run: echo "OpenMP_ROOT=$(brew --prefix)/opt/libomp" >> $GITHUB_ENV + - run: echo "BOOST_ROOT=$(brew --prefix)/opt/boost" >> $GITHUB_ENV # install amici dependencies - name: homebrew - run: | - brew install hdf5 swig gcc cppcheck libomp boost \ - && brew ls -v boost \ - && brew ls -v libomp \ - && echo LDFLAGS="-L/usr/local/lib/ -L/usr/local/Cellar/boost/1.81.0_1/lib/" >> $GITHUB_ENV \ - && echo CPPFLAGS="-I /usr/local/Cellar/boost/1.81.0_1/include/" >> $GITHUB_ENV + run: brew install hdf5 swig gcc cppcheck libomp boost - name: Build AMICI run: scripts/buildAll.sh @@ -241,6 +241,9 @@ jobs: - name: Install python package run: scripts/installAmiciSource.sh + - name: Check OpenMP support + run: source build/venv/bin/activate && python -c "import amici; import sys; sys.exit(not amici.compiledWithOpenMP())" + - name: cppcheck run: scripts/run-cppcheck.sh diff --git a/documentation/python_installation.rst b/documentation/python_installation.rst index a0fcf0908b..6cc3402e61 100644 --- a/documentation/python_installation.rst +++ b/documentation/python_installation.rst @@ -13,7 +13,7 @@ Installation of the AMICI Python package has the following prerequisites: * CBLAS compatible BLAS library (e.g., OpenBLAS, CBLAS, Atlas, Accelerate, Intel MKL) * a C++17 compatible C++ compiler and a C compiler - (e.g., g++, clang, Intel C++ compiler, mingw) + (e.g., g++>=9.1, clang>=12, Intel C++ compiler, mingw) If these requirements are fulfilled and all relevant paths are setup properly, AMICI can be installed using: @@ -44,6 +44,9 @@ Install the AMICI dependencies via ``apt`` # optionally for HDF5 support: sudo apt install libhdf5-serial-dev + # optionally for boost support (thread-specific CPU times, extended math functions, serialization) + libboost-chrono-dev libboost-math-dev libboost-serialization-dev + Install AMICI: .. code-block:: bash @@ -88,13 +91,13 @@ Alternatively: .. code-block:: bash - sudo pacman -Si python swig openblas gcc hdf5 boost-libs + sudo pacman -Si python swig openblas gcc hdf5 boost-libs 2. Upgrade installed packages if required mininum versions are not satisfied for AMICI installation. .. code-block:: bash - sudo pacman -Su python swig openblas gcc hdf5 boost-libs + sudo pacman -Su python swig openblas gcc hdf5 boost-libs 3. Install AMICI: @@ -117,6 +120,13 @@ Install the AMICI dependencies using homebrew: # optionally for parallel simulations: brew install libomp + # followed by either `brew link openmp` once, + # or `export OpenMP_ROOT=$(brew --prefix)/opt/libomp"` where `OpenMP_ROOT` will have to be set during every re-installation of AMICI or any new model import + + # optionally for boost support (thread-specific CPU times, extended math functions, serialization) + brew install boost && export BOOST_ROOT=$(brew --prefix)/opt/boost + # followed by either `brew link boost` once, + # or `export BOOST_ROOT=$(brew --prefix)/opt/boost"` where `BOOST_ROOT` will have to be set during every re-installation of AMICI or any new model import Install AMICI: