Skip to content

Commit

Permalink
Merge branch 'develop' into fix_2182_openmp
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Nov 21, 2023
2 parents fb0f2a9 + 8b836ae commit ca373e2
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 62 deletions.
44 changes: 44 additions & 0 deletions .github/actions/setup-amici-cpp/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Set up AMICI C++
description: |
Build the AMICI C++ interface and set things for for coverage analysis.
(Currently ubuntu-only).
runs:
using: "composite"
steps:
# BioNetGen Path
- run: echo "BNGPATH=${GITHUB_WORKSPACE}/ThirdParty/BioNetGen-2.7.0" >> $GITHUB_ENV
shell: bash

# use all available cores
- run: echo "AMICI_PARALLEL_COMPILE=" >> $GITHUB_ENV
shell: bash

# enable coverage
- run: echo "ENABLE_GCOV_COVERAGE=TRUE" >> $GITHUB_ENV
shell: bash

- name: Set up Sonar tools
uses: ./.github/actions/setup-sonar-tools

- name: Install apt dependencies
uses: ./.github/actions/install-apt-dependencies

- name: Install additional apt dependencies
run: |
sudo apt-get update \
&& sudo apt-get install -y \
cmake \
python3-venv \
lcov
shell: bash

- name: Build AMICI dependencies
run: scripts/buildDependencies.sh
shell: bash

- name: Build AMICI
run: scripts/buildAmici.sh
shell: bash
env:
CI_SONARCLOUD: "TRUE"
159 changes: 117 additions & 42 deletions .github/workflows/test_python_cplusplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,13 @@ on:
- master

jobs:
build:
name: Tests Ubuntu

# TODO: prepare image with more deps preinstalled
ubuntu-cpp-python-tests:
name: C++/Python tests Ubuntu
runs-on: ubuntu-22.04

env:
AMICI_PARALLEL_COMPILE: ""
ENABLE_GCOV_COVERAGE: "TRUE"
CI_SONARCLOUD: "TRUE"

strategy:
matrix:
python-version: [ 3.9 ]
python-version: [ "3.9" ]

steps:
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -33,28 +26,9 @@ jobs:
- run: git fetch --prune --unshallow

- run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV
- run: echo "BNGPATH=${GITHUB_WORKSPACE}/ThirdParty/BioNetGen-2.7.0" >> $GITHUB_ENV

- name: Set up Sonar tools
uses: ./.github/actions/setup-sonar-tools

- name: Install apt dependencies
uses: ./.github/actions/install-apt-dependencies

# install amici dependencies
- name: apt
run: |
sudo apt-get update \
&& sudo apt-get install -y \
cmake \
python3-venv \
lcov

- name: Build AMICI dependencies
run: scripts/buildDependencies.sh

- name: Build AMICI
run: CI_SONARCLOUD=TRUE scripts/buildAmici.sh
- name: Set up AMICI C++ libraries
uses: ./.github/actions/setup-amici-cpp

- name: C++ tests
run: scripts/run-cpp-tests.sh
Expand All @@ -65,19 +39,20 @@ jobs:
- name: Check OpenMP support
run: source build/venv/bin/activate && python -c "import amici; import sys; sys.exit(not amici.compiledWithOpenMP())"

- name: Python tests
- name: Python tests (part 1)
run: |
source build/venv/bin/activate \
&& pytest \
--ignore-glob=*petab* \
--ignore-glob=*test_splines.py \
--ignore-glob=*test_splines_short.py \
--ignore-glob=*test_pysb.py \
--cov=amici \
--cov-report=xml:"${AMICI_DIR}/build/coverage_py.xml" \
--cov-append \
--durations=10 \
${AMICI_DIR}/python/tests
- name: Python tests splines
if: ${{ github.base_ref == 'master' || github.event.merge_group.base_ref == 'master'}}
run: |
Expand All @@ -89,16 +64,77 @@ jobs:
--durations=10 \
${AMICI_DIR}/python/tests/test_splines.py
- name: Install notebook dependencies
- name: Codecov Python
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: build/coverage_py.xml
flags: python
fail_ci_if_error: true
verbose: true

- name: Capture coverage info (lcov)
run: |
source build/venv/bin/activate \
&& pip install jax[cpu]
lcov --compat-libtool --no-external \
-d ${AMICI_DIR}/build/CMakeFiles/amici.dir/src \
-b ${AMICI_DIR} -c -o coverage_cpp.info \
&& lcov --compat-libtool --no-external \
-d ${AMICI_DIR}/python/sdist/build/temp_amici/CMakeFiles/amici.dir/src \
-b ${AMICI_DIR}/python/sdist -c -o coverage_py.info \
&& lcov -a coverage_cpp.info -a coverage_py.info -o coverage.info
- name: example notebooks
run: scripts/runNotebook.sh python/examples/example_*/
- name: Codecov CPP
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.info
flags: cpp
fail_ci_if_error: true

- name: doc notebooks
run: scripts/runNotebook.sh documentation/GettingStarted.ipynb
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner \
-Dsonar.cfamily.build-wrapper-output=bw-output \
-Dsonar.projectVersion="$(git describe --abbrev=4 --dirty=-dirty --always --tags | tr -d '\n')"
ubuntu-python-tests:
name: Python tests Ubuntu
runs-on: ubuntu-22.04

strategy:
matrix:
python-version: [ "3.9" ]

steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- uses: actions/checkout@v3
- run: git fetch --prune --unshallow

- run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV

- name: Set up AMICI C++ libraries
uses: ./.github/actions/setup-amici-cpp

- name: Install python package
run: scripts/installAmiciSource.sh

- name: Python tests
run: |
source build/venv/bin/activate \
&& pytest \
--cov=amici \
--cov-report=xml:"${AMICI_DIR}/build/coverage_py.xml" \
--cov-append \
--durations=10 \
${AMICI_DIR}/python/tests/test_pysb.py \
${AMICI_DIR}/python/tests/test_splines_short.py
- name: Codecov Python
uses: codecov/codecov-action@v3.1.0
Expand All @@ -109,7 +145,7 @@ jobs:
fail_ci_if_error: true
verbose: true

- name: lcov
- name: Capture coverage info (lcov)
run: |
lcov --compat-libtool --no-external \
-d ${AMICI_DIR}/build/CMakeFiles/amici.dir/src \
Expand All @@ -124,7 +160,7 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.info
flags: cpp
flags: cpp_python
fail_ci_if_error: true

- name: Run sonar-scanner
Expand All @@ -136,6 +172,45 @@ jobs:
-Dsonar.cfamily.build-wrapper-output=bw-output \
-Dsonar.projectVersion="$(git describe --abbrev=4 --dirty=-dirty --always --tags | tr -d '\n')"
ubuntu-notebook-tests:
name: Notebook tests Ubuntu
runs-on: ubuntu-22.04

strategy:
matrix:
python-version: [ "3.9" ]

steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- uses: actions/checkout@v3
- run: git fetch --prune --unshallow

- run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV

- name: Set up AMICI C++ libraries
uses: ./.github/actions/setup-amici-cpp

- name: Install python package
run: scripts/installAmiciSource.sh

- name: Install notebook dependencies
run: |
source build/venv/bin/activate \
&& pip install jax[cpu]
- name: example notebooks
run: scripts/runNotebook.sh python/examples/example_*/

- name: doc notebooks
run: scripts/runNotebook.sh documentation/GettingStarted.ipynb

# TODO: Include notebooks in coverage report

osx:
name: Tests OSX
runs-on: macos-latest
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
cmake_minimum_required(VERSION 3.15)
cmake_policy(VERSION 3.15...3.27)

# cmake >=3.27
if(POLICY CMP0144)
cmake_policy(SET CMP0144 NEW)
endif(POLICY CMP0144)

project(amici)

# misc options
Expand Down
60 changes: 47 additions & 13 deletions documentation/amici_refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -1011,19 +1011,6 @@ @Article{MassonisVil2022
url = {https://doi.org/10.1093/bioinformatics/btac755},
}
@Article{RaimundezFed2022,
author = {Raimundez, Elba and Fedders, Michael and Hasenauer, Jan},
journal = {bioRxiv},
title = {Posterior marginalization accelerates Bayesian inference for dynamical systems},
year = {2022},
abstract = {Bayesian inference is an important method in the life and natural sciences for learning from data. It provides information about parameter uncertainties, and thereby the reliability of models and their predictions. Yet, generating representative samples from the Bayesian posterior distribution is often computationally challenging. Here, we present an approach that lowers the computational complexity of sample generation for problems with scaling, offset and noise parameters. The proposed method is based on the marginalization of the posterior distribution, which reduces the dimensionality of the sampling problem. We provide analytical results for a broad class of problems and show that the method is suitable for a large number of applications. Subsequently, we demonstrate the benefit of the approach for various application examples from the field of systems biology. We report a substantial improvement up to 50 times in the effective sample size per unit of time, in particular when applied to multi-modal posterior problems. As the scheme is broadly applicable, it will facilitate Bayesian inference in different research fields.Competing Interest StatementThe authors have declared no competing interest.},
doi = {10.1101/2022.12.02.518841},
elocation-id = {2022.12.02.518841},
eprint = {https://www.biorxiv.org/content/early/2022/12/03/2022.12.02.518841.full.pdf},
publisher = {Cold Spring Harbor Laboratory},
url = {https://www.biorxiv.org/content/early/2022/12/03/2022.12.02.518841},
}
@Article{AlbadryHoe2022,
author = {Albadry, Mohamed and Höpfl, Sebastian and Ehteshamzad, Nadia and König, Matthias and Böttcher, Michael and Neumann, Jasna and Lupp, Amelie and Dirsch, Olaf and Radde, Nicole and Christ, Bruno and Christ, Madlen and Schwen, Lars Ole and Laue, Hendrik and Klopfleisch, Robert and Dahmen, Uta},
journal = {Scientific Reports},
Expand Down Expand Up @@ -1217,6 +1204,53 @@ @Article{TunedalVio2023
url = {https://physoc.onlinelibrary.wiley.com/doi/abs/10.1113/JP284652},
}
@Unknown{HasenauerMer2023,
author = {Hasenauer, Jan and Merkt, Simon and Ali, Solomon and Gudina, Esayas and Adissu, Wondimagegn and Münchhoff, Maximilian and Graf, Alexander and Krebs, Stefan and Elsbernd, Kira and Kisch, Rebecca and Sirgu, Sisay and Fantahun, Bereket and Bekele, Delayehu and Rubio-Acero, Raquel and Gashaw, Mulatu and Girma, Eyob and Yilma, Daniel and Zeynudin, Ahmed and Paunovic, Ivana and Wieser, Andreas},
creationdate = {2023-09-19T09:21:01},
doi = {10.21203/rs.3.rs-3307821/v1},
modificationdate = {2023-09-19T09:21:01},
month = {09},
title = {Long-term monitoring of SARS-CoV-2 seroprevalence and variants in Ethiopia provides prediction for immunity and cross-immunity},
year = {2023},
}
@Article{RaimundezFed2023,
author = {Elba Raim{\'{u}}ndez and Michael Fedders and Jan Hasenauer},
journal = {{iScience}},
title = {Posterior marginalization accelerates Bayesian inference for dynamical models of biological processes},
year = {2023},
month = {sep},
pages = {108083},
creationdate = {2023-10-04T14:12:00},
doi = {10.1016/j.isci.2023.108083},
modificationdate = {2023-10-04T14:12:00},
publisher = {Elsevier {BV}},
}
@Article{Mendes2023,
author = {Mendes, Pedro},
journal = {Frontiers in Cell and Developmental Biology},
title = {Reproducibility and FAIR principles: the case of a segment polarity network model},
year = {2023},
issn = {2296-634X},
volume = {11},
abstract = {The issue of reproducibility of computational models and the related FAIR principles (findable, accessible, interoperable, and reusable) are examined in a specific test case. I analyze a computational model of the segment polarity network in Drosophila embryos published in 2000. Despite the high number of citations to this publication, 23 years later the model is barely accessible, and consequently not interoperable. Following the text of the original publication allowed successfully encoding the model for the open source software COPASI. Subsequently saving the model in the SBML format allowed it to be reused in other open source software packages. Submission of this SBML encoding of the model to the BioModels database enables its findability and accessibility. This demonstrates how the FAIR principles can be successfully enabled by using open source software, widely adopted standards, and public repositories, facilitating reproducibility and reuse of computational cell biology models that will outlive the specific software used.},
creationdate = {2023-10-28T19:05:54},
doi = {10.3389/fcell.2023.1201673},
modificationdate = {2023-10-28T19:05:54},
url = {https://www.frontiersin.org/articles/10.3389/fcell.2023.1201673},
}
@Misc{HuckBal2023,
author = {Wilhelm Huck and Mathieu Baltussen and Thijs de Jong and Quentin Duez and William Robinson},
title = {Chemical reservoir computation in a self-organizing reaction network},
year = {2023},
creationdate = {2023-11-18T09:09:45},
doi = {10.21203/rs.3.rs-3487081/v1},
modificationdate = {2023-11-18T09:10:08},
publisher = {Research Square Platform LLC},
}
@Comment{jabref-meta: databaseType:bibtex;}
@Comment{jabref-meta: grouping:
Expand Down
Loading

0 comments on commit ca373e2

Please sign in to comment.