Skip to content

Commit

Permalink
Merge branch 'develop' into update_refs
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl authored Apr 20, 2024
2 parents 6aee0e3 + e8493cf commit c1784db
Show file tree
Hide file tree
Showing 67 changed files with 1,173 additions and 1,430 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test_petab_test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,27 @@ jobs:

- name: Install petab
run: |
source ./build/venv/bin/activate \
source ./venv/bin/activate \
&& pip3 install wheel pytest shyaml pytest-cov pysb
# retrieve test models
- name: Download and install PEtab test suite
run: |
git clone --depth 1 --branch main \
https://github.com/PEtab-dev/petab_test_suite \
&& source ./build/venv/bin/activate \
&& source ./venv/bin/activate \
&& cd petab_test_suite && pip3 install -e .
- name: Run PEtab-related unit tests
run: |
source ./build/venv/bin/activate \
source ./venv/bin/activate \
&& pytest --cov-report=xml:coverage.xml \
--cov=./ python/tests/test_*petab*.py python/tests/petab/
# run test models
- name: Run PEtab test suite
run: |
source ./build/venv/bin/activate \
source ./venv/bin/activate \
&& AMICI_PARALLEL_COMPILE="" pytest -v \
--cov-report=xml:coverage.xml \
--cov-append \
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/test_python_cplusplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ jobs:
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())"
run: source 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 \
source venv/bin/activate \
&& pytest \
--ignore-glob=*petab* \
--ignore-glob=*test_splines.py \
Expand All @@ -64,7 +64,7 @@ jobs:
- name: Python tests splines
if: ${{ github.base_ref == 'master' || github.event.merge_group.base_ref == 'master'}}
run: |
source build/venv/bin/activate \
source venv/bin/activate \
&& pytest \
--cov=amici \
--cov-report=xml:"${AMICI_DIR}/build/coverage_py.xml" \
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:

- name: Python tests
run: |
source build/venv/bin/activate \
source venv/bin/activate \
&& pytest \
--cov=amici \
--cov-report=xml:"${AMICI_DIR}/build/coverage_py.xml" \
Expand Down Expand Up @@ -214,7 +214,7 @@ jobs:

- name: Install notebook dependencies
run: |
source build/venv/bin/activate \
source venv/bin/activate \
&& pip install jax[cpu]
- name: example notebooks
Expand Down Expand Up @@ -251,7 +251,7 @@ jobs:
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())"
run: source venv/bin/activate && python -c "import amici; import sys; sys.exit(not amici.compiledWithOpenMP())"

- name: cppcheck
run: scripts/run-cppcheck.sh
Expand Down Expand Up @@ -296,7 +296,7 @@ jobs:
scripts/installAmiciSource.sh
- name: Check OpenMP support
run: source build/venv/bin/activate && python -c "import amici; import sys; sys.exit(not amici.compiledWithOpenMP())"
run: source venv/bin/activate && python -c "import amici; import sys; sys.exit(not amici.compiledWithOpenMP())"

- name: Get BioNetGen
run: scripts/buildBNGL.sh
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/test_python_ver_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,16 @@ jobs:
- name: Install python package
run: scripts/installAmiciSource.sh

# until https://github.com/dateutil/dateutil >2.8.2 is released https://github.com/dateutil/dateutil/issues/1314
- run: source build/venv/bin/activate && pip3 install git+https://github.com/dateutil/dateutil.git@296d419fe6bf3b22897f8f210735ac9c4e1cb796
if: matrix.python-version == '3.12'

# install pysb before sympy to allow for sympy>=1.12 (https://github.com/pysb/pysb/commit/e83937cb8c74afc9b2fa96595b68464946745f33)
- run: source build/venv/bin/activate && pip3 install git+https://github.com/pysb/pysb
- run: source venv/bin/activate && pip3 install git+https://github.com/pysb/pysb

# until sympy>1.12 is released
- run: source build/venv/bin/activate && pip3 install git+https://github.com/sympy/sympy.git@master
- run: source venv/bin/activate && pip3 install git+https://github.com/sympy/sympy.git@master
if: matrix.python-version == '3.12'

- name: Python tests
run: |
source build/venv/bin/activate \
source venv/bin/activate \
&& python3 -m pytest \
--durations=10 \
--ignore-glob=*petab* \
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,4 @@ CS_Signalling_ERBB_RAS_AKT/
cache_fiddy/*
debug/*
tests/benchmark-models/cache_fiddy/*
venv/*
75 changes: 75 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,81 @@

## v0.X Series

### v0.23.1 (2024-03-11)

* Fixes installation issues related to building SuiteSparse on some systems
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2375

### v0.23.0 (2024-03-07)

**Features**

* SBML `InitialAssignment` are no longer absorbed into other model expressions,
but are available as parameters or expressions (`w`) in the amici model
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2304,
https://github.com/AMICI-dev/AMICI/pull/2305,
https://github.com/AMICI-dev/AMICI/pull/2345,
https://github.com/AMICI-dev/AMICI/pull/2359
* Upgraded to SuiteSparse 7.6
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2316
* Model expressions `w` are now split into static and dynamic expressions,
and only evaluated as needed
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2303
* Exposed additional solver settings:
* `Solver.setMaxConvFails()`: maximum number of non-linear solver
convergence failures
* `Solver.setMaxNonlinIters()`: maximum number of non-linear solver
iterations
* `Solver.setMaxStepSize()`: maximum step size
* `Solver.setConstraints()`: for setting (non)negativity/positivity
constraints on state variables

by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2335,
https://github.com/AMICI-dev/AMICI/pull/2360,
https://github.com/AMICI-dev/AMICI/pull/2340
* Improved output for debugging simulation failures:
`ReturnData.{xdot,J}` now contain the respective
values from the timepoint of failure, not the last output timepoint.
NaN/Inf warnings now always include the timepoint at which the issue
occurred. Note that C++ stacktraces are now only logged for debug builds.
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2349,
https://github.com/AMICI-dev/AMICI/pull/2347,
https://github.com/AMICI-dev/AMICI/pull/2366
* Updated dataframes import/export to include parameter values and scales
by @FFroehlich in https://github.com/AMICI-dev/AMICI/pull/2351

**Fixes**

* CMake: Updated BLAS detection and some minor fixes
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2318
and https://github.com/AMICI-dev/AMICI/pull/2357
* Deterministic ordering of source files in generated `CMakeLists.txt`
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2322
* Fixed size check in `Model::setStateIsNonNegative`
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2332
* Fixed uncaught C++ exception in `runAmiciSimulation` that may crash Python
in case of invalid values for standard deviations
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2338
* Fixed missing import in `amici/petab/petab_import.py`
by @plakrisenko in https://github.com/AMICI-dev/AMICI/pull/2342
* Fixed `ReturnDataView` `AttributeError: messages`
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2341
* Added a missing return code constant `LSETUP_FAIL`
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2353
* Fixed in-place building of model wheels
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2352
* Made is-zero-checks compatible with the upcoming sympy>1.12
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2350
* Fixed issues with paths containing blanks for sundials
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2361
* Added `amici.petab.conditions` to the API documentation
by @PaulJonasJost in https://github.com/AMICI-dev/AMICI/pull/2364
* Improved type annotations in swig-wrappers
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2344,
https://github.com/AMICI-dev/AMICI/pull/2365

**Full Changelog**: https://github.com/AMICI-dev/AMICI/compare/v0.22.0...v0.23.0

### v0.22.0 (2024-02-23)

**Features**
Expand Down
108 changes: 19 additions & 89 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ endif()
# find dependencies
include(GNUInstallDirs)

include(AmiciFindBLAS)
find_package(OpenMP)
find_package(Boost COMPONENTS chrono)

Expand All @@ -132,85 +133,23 @@ elseif(AMICI_TRY_ENABLE_HDF5)
endif()

set(VENDORED_SUNDIALS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/sundials)
set(VENDORED_SUNDIALS_BUILD_DIR ${VENDORED_SUNDIALS_DIR}/build)
set(VENDORED_SUNDIALS_INSTALL_DIR ${VENDORED_SUNDIALS_BUILD_DIR})
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
if(AMICI_PYTHON_BUILD_EXT_ONLY)
set(VENDORED_SUNDIALS_BUILD_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(VENDORED_SUNDIALS_INSTALL_DIR ${VENDORED_SUNDIALS_BUILD_DIR})
else()
set(VENDORED_SUNDIALS_BUILD_DIR ${VENDORED_SUNDIALS_DIR}/build)
set(VENDORED_SUNDIALS_INSTALL_DIR ${VENDORED_SUNDIALS_BUILD_DIR})
endif()
find_package(
SUNDIALS REQUIRED PATHS
"${VENDORED_SUNDIALS_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/sundials/")
message(STATUS "Found SUNDIALS: ${SUNDIALS_DIR}")

set(GSL_LITE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/gsl")

# AMICI requires BLAS, currently Intel MKL, CBLAS or MATLAB BLAS can be used.
# The latter is not supported via CMake yet.
set(BLAS
"CBLAS"
CACHE STRING "BLAS library to use")
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)
else()
set(BLAS_INCLUDE_DIRS
""
CACHE STRING "")
set(BLAS_LIBRARIES
-lmkl
CACHE STRING "")
endif()
elseif(
NOT DEFINED ENV{BLAS_LIBS}
AND NOT DEFINED ENV{BLAS_CFLAGS}
AND NOT BLAS_FOUND)
# if nothing is specified via environment variables, let's try FindBLAS
if($(CMAKE_VERSION) VERSION_GREATER_EQUAL 3.22)
set(BLA_SIZEOF_INTEGER 8)
endif()

if(APPLE AND (NOT DEFINED BLA_VENDOR OR BLA_VENDOR STREQUAL "All"))
set(BLA_VENDOR Apple)
find_package(BLAS)
if(BLAS_FOUND)
set_property(
TARGET BLAS::BLAS
APPEND
PROPERTY INTERFACE_COMPILE_DEFINITIONS ACCELERATE_NEW_LAPACK)
set_property(
TARGET BLAS::BLAS
APPEND
PROPERTY INTERFACE_COMPILE_DEFINITIONS ACCELERATE_LAPACK_ILP64)
else()
set(BLA_VENDOR "All")
endif()

endif()
if(NOT BLAS_FOUND)
find_package(BLAS)
endif()
if(NOT BLAS_FOUND)
# Nothing specified by the user and FindBLAS didn't find anything; let's try
# if cblas is available on the system paths.
set(BLAS_INCLUDE_DIRS
""
CACHE STRING "")
set(BLAS_LIBRARIES
-lcblas
CACHE STRING "")
endif()
endif()
add_compile_definitions(AMICI_BLAS_${BLAS})

# Add target to create version file
add_custom_target(
version
Expand Down Expand Up @@ -285,16 +224,6 @@ set(AMICI_SRC_LIST

add_library(${PROJECT_NAME} ${AMICI_SRC_LIST})

# legacy python package environment variables:
if(DEFINED ENV{BLAS_CFLAGS})
target_compile_options(${PROJECT_NAME} PRIVATE "$ENV{BLAS_CFLAGS}")
endif()
if(DEFINED ENV{BLAS_LIBS})
# Note that, on Windows, at least for ninja, this will only work with dashes
# instead of slashes in any linker options
target_link_libraries(${PROJECT_NAME} PUBLIC "$ENV{BLAS_LIBS}")
endif()

set(AMICI_CXX_OPTIONS
""
CACHE STRING "C++ options for libamici (semicolon-separated)")
Expand All @@ -315,10 +244,6 @@ target_include_directories(
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/swig>
PRIVATE ${SUNDIALS_PRIVATE_INCLUDE_DIRS})

if(NOT "${BLAS_INCLUDE_DIRS}" STREQUAL "")
target_include_directories(${PROJECT_NAME} PUBLIC ${BLAS_INCLUDE_DIRS})
endif()

if("$ENV{ENABLE_AMICI_DEBUGGING}"
OR "$ENV{ENABLE_GCOV_COVERAGE}"
OR CMAKE_BUILD_TYPE MATCHES "Debug")
Expand Down Expand Up @@ -354,11 +279,11 @@ target_link_libraries(
SUNDIALS::sunnonlinsolfixedpoint_static
SUNDIALS::cvodes_static
SUNDIALS::idas_static
${BLAS_LIBRARIES}
$<$<BOOL:${Boost_CHRONO_FOUND}>:Boost::chrono>
$<$<BOOL:${OpenMP_FOUND}>:OpenMP::OpenMP_CXX>
${CMAKE_DL_LIBS}
PRIVATE
BLAS::BLAS
$<$<BOOL:${SUNDIALS_SUPERLUMT_ENABLE}>:SUNDIALS::sundials_sunlinsolsuperlumt>
)

Expand Down Expand Up @@ -457,16 +382,21 @@ install(
EXPORT AmiciTargets
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Amici"
NAMESPACE Upstream::)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/AmiciConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/AmiciConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Amici)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/AmiciConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/AmiciConfigVersion.cmake
${CMAKE_CURRENT_LIST_DIR}/cmake/AmiciFindBLAS.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Amici)

install(DIRECTORY ThirdParty/gsl/gsl TYPE INCLUDE)
# When running from setup.py, this is a symlink we need to dereference
get_filename_component(_swig_realpath "swig" REALPATH)
install(DIRECTORY "${_swig_realpath}"
DESTINATION ${CMAKE_INSTALL_DATADIR}/amici)

configure_file(cmake/AmiciFindBLAS.cmake
${CMAKE_CURRENT_BINARY_DIR}/AmiciFindBLAS.cmake COPYONLY)

# Register package?
if(EXPORT_PACKAGE)
export(PACKAGE Amici)
Expand Down
6 changes: 3 additions & 3 deletions ThirdParty/sundials/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ project(SUNDIALS C)

# Specify the location of additional CMAKE modules
set(CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake
${PROJECT_SOURCE_DIR}/cmake/macros
${PROJECT_SOURCE_DIR}/cmake/tpl
"${PROJECT_SOURCE_DIR}/cmake"
"${PROJECT_SOURCE_DIR}/cmake/macros"
"${PROJECT_SOURCE_DIR}/cmake/tpl"
)

# MACRO definitions
Expand Down
2 changes: 1 addition & 1 deletion ThirdParty/sundials/cmake/tpl/FindKLU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ if (NOT SUITESPARSECONFIG_LIBRARY)
mark_as_advanced(SUITESPARSECONFIG_LIBRARY)
endif ()

set(KLU_LIBRARIES ${KLU_LIBRARY} ${AMD_LIBRARY} ${COLAMD_LIBRARY} ${BTF_LIBRARY} ${SUITESPARSECONFIG_LIBRARY})
set(KLU_LIBRARIES "${KLU_LIBRARY}" "${AMD_LIBRARY}" "${COLAMD_LIBRARY}" "${BTF_LIBRARY}" "${SUITESPARSECONFIG_LIBRARY}")

# set package variables including KLU_FOUND
include(FindPackageHandleStandardArgs)
Expand Down
Loading

0 comments on commit c1784db

Please sign in to comment.