Skip to content

Commit

Permalink
GHA: Fix OpenMP not found on macos (#2207)
Browse files Browse the repository at this point in the history
* Ensure cmake can find OpenMP
* Assert that amici was compiled with OpenMP support
* Update installation guide

Fixes #2182
  • Loading branch information
dweindl authored Nov 21, 2023
1 parent 8b836ae commit 4f6e829
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/test_python_cplusplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -225,22 +228,22 @@ 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

- 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

Expand Down
16 changes: 13 additions & 3 deletions documentation/python_installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:

Expand All @@ -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:

Expand Down

0 comments on commit 4f6e829

Please sign in to comment.