Skip to content

Commit

Permalink
Merge pull request #2451 from dweindl/release_0.25.1
Browse files Browse the repository at this point in the history
Release 0.25.1
  • Loading branch information
dweindl authored May 17, 2024
2 parents 7487607 + d9b4477 commit 17d6e77
Show file tree
Hide file tree
Showing 21 changed files with 117 additions and 57 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ updates:
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-patch", "version-update:semver-minor"]
target-branch: "develop"
4 changes: 2 additions & 2 deletions .github/workflows/test_matlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV

- name: Install MATLAB
uses: matlab-actions/setup-matlab@v1
uses: matlab-actions/setup-matlab@v2
- name: Run script
uses: matlab-actions/run-command@v1
uses: matlab-actions/run-command@v2
with:
command: cd matlab; installAMICI; addpath tests; testModels
4 changes: 2 additions & 2 deletions .github/workflows/test_python_cplusplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cache/pooch
Expand Down Expand Up @@ -273,7 +273,7 @@ jobs:

steps:
- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/Library/Caches/pooch
Expand Down
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@

## v0.X Series

### v0.25.0 (2024-05-TBD)
### v0.25.1 (2024-05-16)

**Fixes**
* Avoid clashes with sympy-entities in `plot_expressions`
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2440
* PEtab: fix KeyErrors for missing parameters in `fill_in_parameters`
(default values are now used if only a subset of parameters is provided)
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2449
* CMake: Fix Intel MKL detection when not using environment modules
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2443
* CMake: Fix some issues with multi-config generators
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2445

**Full Changelog**: https://github.com/AMICI-dev/AMICI/compare/v0.25.0...v0.25.1


### v0.25.0 (2024-05-08)

This release requires Python >= 3.10.

Expand Down
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ if("$ENV{ENABLE_AMICI_DEBUGGING}" OR "$ENV{ENABLE_GCOV_COVERAGE}")
else()
add_compile_options(-O0 -g)
endif()
set(CMAKE_BUILD_TYPE "Debug")
endif()

# coverage options
Expand Down Expand Up @@ -135,7 +134,7 @@ endif()
set(VENDORED_SUNDIALS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/sundials)
set(SUNDIALS_PRIVATE_INCLUDE_DIRS "${VENDORED_SUNDIALS_DIR}/src")
# Handle different sundials build/install dirs, depending on whether we are
# building the Python extension only or the full C++ interface
# building the Python extension only or the full C++ interface
if(AMICI_PYTHON_BUILD_EXT_ONLY)
set(VENDORED_SUNDIALS_BUILD_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(VENDORED_SUNDIALS_INSTALL_DIR ${VENDORED_SUNDIALS_BUILD_DIR})
Expand Down
51 changes: 34 additions & 17 deletions cmake/AmiciFindBLAS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,33 @@ set_property(CACHE BLAS PROPERTY STRINGS "CBLAS" "MKL" "ACCELERATE")

if(${BLAS} STREQUAL "MKL" OR DEFINED ENV{MKLROOT})
if(DEFINED ENV{MKLROOT})
# This is set by Environment Modules
message(STATUS "Using MKL_INCDIR and MKL_LIB from environment module")
set(BLAS
"MKL"
CACHE STRING "BLAS library to use" FORCE)
set(BLAS_INCLUDE_DIRS
"$ENV{MKL_INCDIR}"
CACHE STRING "" FORCE)
set(BLAS_LIBRARIES
"$ENV{MKL_LIB}"
CACHE STRING "" FORCE)

# Was MKLROOT set by /opt/intel/oneapi/setvars.sh? then cmake will find it
message(STATUS "Trying to find BLAS based on MKLROOT=$ENV{MKLROOT}")
# give the user the option to override the BLA_VENDOR
if(NOT DEFINED BLA_VENDOR)
set(BLA_VENDOR Intel10_64lp)
endif()
message(STATUS "Trying FindBLAS with BLA_VENDOR=${BLA_VENDOR}")
find_package(BLAS)
if(BLAS_FOUND)
message(STATUS "Found BLAS via FindBLAS and MKLROOT")
else()
# This is set by Environment Modules and might not be compatible with
# FindBLAS
message(STATUS "Using MKL_INCDIR and MKL_LIB from environment module")
set(BLAS_INCLUDE_DIRS
"$ENV{MKL_INCDIR}"
CACHE STRING "" FORCE)
set(BLAS_LIBRARIES
"$ENV{MKL_LIB}"
CACHE STRING "" FORCE)
endif()
else()
message(STATUS "BLAS is set to MKL, but MKLROOT is not set.")
set(BLAS_INCLUDE_DIRS
""
CACHE STRING "")
Expand All @@ -42,6 +57,7 @@ elseif(

if(APPLE AND (NOT DEFINED BLA_VENDOR OR BLA_VENDOR STREQUAL "All"))
set(BLA_VENDOR Apple)
message(STATUS "Trying FindBLAS with BLA_VENDOR=${BLA_VENDOR}")
find_package(BLAS)
if(BLAS_FOUND)
message(STATUS "Found Apple Accelerate BLAS")
Expand All @@ -59,6 +75,7 @@ elseif(

endif()
if(NOT BLAS_FOUND)
message(STATUS "Trying FindBLAS with BLA_VENDOR=${BLA_VENDOR}")
find_package(BLAS)
if(BLAS_FOUND)
message(STATUS "Found BLAS via FindBLAS")
Expand All @@ -79,17 +96,17 @@ endif()
# Create an imported target
if(NOT TARGET BLAS::BLAS)
add_library(BLAS INTERFACE)
set_target_properties(BLAS PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${BLAS_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}")
set_target_properties(
BLAS PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${BLAS_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}")
add_library(BLAS::BLAS ALIAS BLAS)
if("${PROJECT_NAME}" STREQUAL "amici")
install(TARGETS BLAS EXPORT BLAS)
export(EXPORT BLAS NAMESPACE BLAS::)
install(
EXPORT BLAS
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Amici"
NAMESPACE BLAS::)
install(TARGETS BLAS EXPORT BLAS)
export(EXPORT BLAS NAMESPACE BLAS::)
install(
EXPORT BLAS
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Amici"
NAMESPACE BLAS::)
endif()

# legacy python package environment variables:
Expand Down
2 changes: 2 additions & 0 deletions cmake/cmakelang-tools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ set(ALL_CMAKE_FILES
tests/cpp/unittests/CMakeLists.txt
${CMAKE_MODULE_PATH}/cmakelang-tools.cmake
${CMAKE_MODULE_PATH}/clang-tools.cmake
${CMAKE_MODULE_PATH}/AmiciFindBLAS.cmake
${CMAKE_MODULE_PATH}/version.cmake)

list(JOIN ALL_CMAKE_FILES " " ALL_CMAKE_FILES)

# --- cmake-format ---
Expand Down
2 changes: 1 addition & 1 deletion documentation/rtd_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exhale>=0.3.7
sphinxcontrib-matlabdomain>=0.20.0
sphinxcontrib-napoleon>=0.7
pygments>=2.15.1
Jinja2==3.1.2
Jinja2==3.1.4
git+https://github.com/readthedocs/readthedocs-sphinx-ext
ipykernel
-e git+https://github.com/Benchmarking-Initiative/Benchmark-Models-PEtab.git@master#subdirectory=src/python&egg=benchmark_models_petab
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ filterwarnings =
ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning
ignore:.*:ImportWarning:tellurium
ignore:.*PyDevIPCompleter6.*:DeprecationWarning
# ignore numpy log(0) warnings (np.log(0) = -inf)
ignore:divide by zero encountered in log:RuntimeWarning

norecursedirs = .git amici_models build doc documentation matlab models ThirdParty amici sdist examples
4 changes: 2 additions & 2 deletions python/sdist/amici/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import amici
import numpy as np
import sympy as sp

from sympy.abc import _clash
from . import ExpData, ExpDataPtr, Model, ReturnData, ReturnDataPtr

StrOrExpr = Union[str, sp.Expr]
Expand Down Expand Up @@ -497,7 +497,7 @@ def evaluate(expr: StrOrExpr, rdata: ReturnDataView) -> np.array:
from sympy.utilities.lambdify import lambdify

if isinstance(expr, str):
expr = sp.sympify(expr)
expr = sp.sympify(expr, locals=_clash)

arg_names = list(sorted(expr.free_symbols, key=lambda x: x.name))
func = lambdify(arg_names, expr, "numpy")
Expand Down
45 changes: 24 additions & 21 deletions python/sdist/amici/petab/simulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,30 +166,33 @@ def simulate_petab(
amici_model=amici_model,
)

if problem_parameters is not None and not scaled_parameters:
problem_parameters = petab_problem.scale_parameters(problem_parameters)
scaled_parameters = True

if problem_parameters is None:
# scaled PEtab nominal values
problem_parameters = dict(
zip(
petab_problem.x_ids,
petab_problem.x_nominal_scaled,
strict=True,
)
problem_parameters = {}

# scaled PEtab nominal values
default_problem_parameters = dict(
zip(
petab_problem.x_ids,
petab_problem.get_x_nominal(scaled=scaled_parameters),
strict=True,
)
# depending on `fill_fixed_parameters` for parameter mapping, the
# parameter mapping may contain values instead of symbols for fixed
# parameters. In this case, we need to filter them here to avoid
# warnings in `fill_in_parameters`.
free_parameters = parameter_mapping.free_symbols
problem_parameters = {
par_id: par_value
for par_id, par_value in problem_parameters.items()
if par_id in free_parameters
}

elif not scaled_parameters:
problem_parameters = petab_problem.scale_parameters(problem_parameters)
)
# depending on `fill_fixed_parameters` for parameter mapping, the
# parameter mapping may contain values instead of symbols for fixed
# parameters. In this case, we need to filter them here to avoid
# warnings in `fill_in_parameters`.
free_parameters = parameter_mapping.free_symbols
default_problem_parameters = {
par_id: par_value
for par_id, par_value in default_problem_parameters.items()
if par_id in free_parameters
}

scaled_parameters = True
problem_parameters = default_problem_parameters | problem_parameters

# Get edatas
if edatas is None:
Expand Down
6 changes: 6 additions & 0 deletions python/sdist/amici/setup.template.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ def get_extension() -> CMakeExtension:
else:
os.environ["CMAKE_BUILD_PARALLEL_LEVEL"] = "1"

debug_build = os.getenv("ENABLE_AMICI_DEBUGGING", "").lower() in [
"1",
"true",
] or os.getenv("ENABLE_GCOV_COVERAGE", "").lower() in ["1", "true"]

return CMakeExtension(
name="model_ext",
source_dir=os.getcwd(),
Expand All @@ -37,6 +42,7 @@ def get_extension() -> CMakeExtension:
"-DAMICI_PYTHON_BUILD_EXT_ONLY=ON",
f"-DPython3_EXECUTABLE={Path(sys.executable).as_posix()}",
],
cmake_build_type="Debug" if debug_build else "Release",
)


Expand Down
4 changes: 2 additions & 2 deletions python/sdist/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ requires = [
# cf. discussion at https://github.com/numpy/numpy/issues/5888
# (https://github.com/scipy/oldest-supported-numpy/)
"oldest-supported-numpy",
"cmake-build-extension==0.5.1",
"cmake-build-extension==0.6.0",
]
build-backend = "setuptools.build_meta"

Expand All @@ -21,7 +21,7 @@ dynamic = ["version"]
description = "Advanced multi-language Interface to CVODES and IDAS"
requires-python = ">=3.10"
dependencies = [
"cmake-build-extension==0.5.1",
"cmake-build-extension==0.6.0",
"sympy>=1.9",
"numpy>=1.19.3; python_version=='3.9'",
"numpy>=1.21.4; python_version>='3.10'",
Expand Down
5 changes: 5 additions & 0 deletions python/sdist/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ def get_extensions():
],
)
# AMICI
debug_build = os.getenv("ENABLE_AMICI_DEBUGGING", "").lower() in [
"1",
"true",
] or os.getenv("ENABLE_GCOV_COVERAGE", "").lower() in ["1", "true"]
amici_ext = CMakeExtension(
name="amici",
install_prefix="amici",
Expand All @@ -153,6 +157,7 @@ def get_extensions():
"-DAMICI_PYTHON_BUILD_EXT_ONLY=ON",
f"-DPython3_EXECUTABLE={Path(sys.executable).as_posix()}",
],
cmake_build_type="Debug" if debug_build else "Release",
)
# Order matters!
return [suitesparse_config, amd, btf, colamd, klu, sundials, amici_ext]
Expand Down
5 changes: 3 additions & 2 deletions python/tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ def test_cmake_compilation(sbml_example_presimulation_module):
amici_dir = (Path(__file__).parents[2] / "build").absolute()
cmd = (
f"set -e; "
f"cmake -S {source_dir} -B '{build_dir}' -DAmici_DIR={amici_dir}; "
f"cmake --build '{build_dir}'"
f"cmake -S {source_dir} -B '{build_dir}' "
f"-DCMAKE_BUILD_TYPE=Debug -DAmici_DIR={amici_dir}; "
f"cmake --build '{build_dir}' --config Debug"
)

try:
Expand Down
3 changes: 2 additions & 1 deletion scripts/buildAmici.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ mkdir -p "${amici_build_dir}"
cd "${amici_build_dir}"

if [ "${GITHUB_ACTIONS:-}" = true ] ||
[ "${ENABLE_AMICI_DEBUGGING:-}" = TRUE ]; then
[ "${ENABLE_AMICI_DEBUGGING:-}" = TRUE ] ||
[ "${ENABLE_GCOV_COVERAGE:-}" = TRUE ]; then
# Running on CI server
build_type="Debug"
# exceptions instead of terminate()
Expand Down
2 changes: 1 addition & 1 deletion scripts/installAmiciSource.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fi
export PYTHON_EXECUTABLE="${AMICI_PATH}/venv/bin/python"

python -m pip install --upgrade pip wheel
python -m pip install --upgrade pip setuptools cmake_build_extension numpy
python -m pip install --upgrade pip setuptools cmake_build_extension==0.6.0 numpy
python -m pip install git+https://github.com/FFroehlich/pysb@fix_pattern_matching # pin to PR for SPM with compartments
AMICI_BUILD_TEMP="${AMICI_PATH}/python/sdist/build/temp" \
python -m pip install --verbose -e "${AMICI_PATH}/python/sdist[petab,test,vis]" --no-build-isolation
Expand Down
5 changes: 4 additions & 1 deletion src/CMakeLists.template.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ endif()
find_package(Amici TPL_AMICI_VERSION REQUIRED HINTS
${CMAKE_CURRENT_LIST_DIR}/../../build)
message(STATUS "Found AMICI ${Amici_DIR}")
set_target_properties(Upstream::amici PROPERTIES
MAP_IMPORTED_CONFIG_RELWITHDEBINFO RelWithDebInfo;Release;
MAP_IMPORTED_CONFIG_RELEASE Release
MAP_IMPORTED_CONFIG_DEBUG Debug;RelWithDebInfo;)

# Debug build?
if("$ENV{ENABLE_AMICI_DEBUGGING}" OR "$ENV{ENABLE_GCOV_COVERAGE}")
Expand All @@ -47,7 +51,6 @@ if("$ENV{ENABLE_AMICI_DEBUGGING}" OR "$ENV{ENABLE_GCOV_COVERAGE}")
else()
add_compile_options(-O0 -g)
endif()
set(CMAKE_BUILD_TYPE "Debug")
endif()

# coverage options
Expand Down
5 changes: 4 additions & 1 deletion swig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ find_package(
Python3
COMPONENTS Interpreter Development NumPy
REQUIRED)
message(STATUS "Found numpy ${Python3_NumPy_VERSION} include dir ${Python3_NumPy_INCLUDE_DIRS}")
message(
STATUS
"Found numpy ${Python3_NumPy_VERSION} include dir ${Python3_NumPy_INCLUDE_DIRS}"
)
set(AMICI_INTERFACE_LIST
${CMAKE_CURRENT_SOURCE_DIR}/amici.i
${CMAKE_CURRENT_SOURCE_DIR}/edata.i
Expand Down
1 change: 1 addition & 0 deletions tests/benchmark-models/test_petab_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"Isensee_JCB2018",
"Beer_MolBioSystems2014",
"Alkan_SciSignal2018",
"Lang_PLOSComputBiol2024",
# excluded due to excessive numerical failures
"Crauste_CellSystems2017",
"Fujita_SciSignal2010",
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.25.0
0.25.1

0 comments on commit 17d6e77

Please sign in to comment.