Skip to content

Commit

Permalink
Release 0.11.18
Browse files Browse the repository at this point in the history
Merge pull request #1531 from AMICI-dev/release_0.11.18
  • Loading branch information
dweindl authored Jul 12, 2021
2 parents c037706 + ff1553d commit bd3b89d
Show file tree
Hide file tree
Showing 29 changed files with 585 additions and 165 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/deploy_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,28 @@ jobs:
password: ${{ secrets.pypi_password }}
packages_dir: python/sdist/dist

bioSimulatorsUpdateCliAndDockerImage:
name: Release to BioSimulators
needs: pypi
runs-on: ubuntu-latest
env:
# Owner/repository-id for the GitHub repository for the downstream command-line interface and Docker image
DOWNSTREAM_REPOSITORY: biosimulators/Biosimulators_AMICI

# Username/token to use the GitHub API to trigger an action on the GitHub repository for the downstream
# command-line interface and Docker image. Tokens can be generated at https://github.com/settings/tokens.
# The token should have the scope `repo`
GH_ISSUE_USERNAME: ${{ secrets.BIOSIMULATORS_USERNAME }}
GH_ISSUE_TOKEN: ${{ secrets.BIOSIMULATORS_TOKEN }}
steps:
- name: Trigger GitHub action that will build and release the downstream command-line interface and Docker image
run: |
PACKAGE_VERSION="${GITHUB_REF/refs\/tags\/v/}"
WORKFLOW_FILE=ci.yml
curl \
-X POST \
-u ${GH_ISSUE_USERNAME}:${GH_ISSUE_TOKEN} \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${DOWNSTREAM_REPOSITORY}/actions/workflows/${WORKFLOW_FILE}/dispatches \
-d "{\"ref\": \"dev\", \"inputs\": {\"simulatorVersion\": \"${PACKAGE_VERSION}\", \"simulatorVersionLatest\": \"true\"}}"
32 changes: 0 additions & 32 deletions .github/workflows/release_biosimulators.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
python -m pip install --upgrade pip \
&& pip install pytest petab \
&& choco install -y ninja \
&& choco install -y swig --version=4.0.1
&& choco install -y swig
- name: Install OpenBLAS
shell: powershell
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

## v0.X Series

### v0.11.18 (2021-07-12)

New:
* Allow specifying maximum integration time via
`amici::Solver::setMaxTime()` (#1530)
* Py: Add `failfast` and `num_threads` argument to `simulate_petab`
(#1528, #1524)
* Enable typehints / static type checking for AMICI-generated model modules
(#1514) (`amici.ModelModule`, available with Python>=3.8)

Fixes:
* Python: Fix unused argument `generate_sensitivity_code` in `pysb2amici`
(#1526)
* Python: Fix C(++) stdout redirection which could have let to deadlocks in
exotic situations (#1529)
* Py: Fixed deprecation warning (#1525)
* Py: Proper typehints for SWIG interface (#1523), enabling better static type
checking and IDE integration (available with Python>=3.9)
* C++: Fixed clang compiler warning (#1521)
* C++: Fix inherited variadic ctor in exception class (#1520)
* PEtab: More informative output for unhandled species overrides (#1519)
* Return SbmlImporter from PEtab model import (#1517)


### v0.11.17 (2021-05-30)

Fixes:
Expand Down
2 changes: 2 additions & 0 deletions include/amici/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,14 @@ constexpr int AMICI_TOO_MUCH_WORK= -1;
constexpr int AMICI_TOO_MUCH_ACC= -2;
constexpr int AMICI_ERR_FAILURE= -3;
constexpr int AMICI_CONV_FAILURE= -4;
constexpr int AMICI_RHSFUNC_FAIL= -8;
constexpr int AMICI_ILL_INPUT= -22;
constexpr int AMICI_ERROR= -99;
constexpr int AMICI_NO_STEADY_STATE= -81;
constexpr int AMICI_DAMPING_FACTOR_ERROR= -86;
constexpr int AMICI_SINGULAR_JACOBIAN= -809;
constexpr int AMICI_NOT_IMPLEMENTED= -999;
constexpr int AMICI_MAX_TIME_EXCEEDED = -1000;
constexpr int AMICI_SUCCESS= 0;
constexpr int AMICI_DATA_RETURN= 1;
constexpr int AMICI_ROOT_RETURN= 2;
Expand Down
23 changes: 22 additions & 1 deletion include/amici/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ namespace amici {
*/
class AmiException : public std::exception {
public:
/**
* @brief Constructor with printf style interface
* @param fmt error message with printf format
* @param ... printf formatting variables
*/
AmiException();

/**
* @brief Constructor with printf style interface
* @param fmt error message with printf format
Expand All @@ -40,6 +47,14 @@ class AmiException : public std::exception {
*/
void storeBacktrace(int nMaxFrames);

protected:
/**
* @brief Store the provided message
* @param fmt error message with printf format
* @param argptr pointer to variadic argument list
*/
void storeMessage(const char *fmt, va_list argptr);

private:
std::array<char, 500> msg_;
std::array<char, 500> trace_;
Expand Down Expand Up @@ -131,7 +146,13 @@ class IntegrationFailureB : public AmiException {
*/
class SetupFailure : public AmiException {
public:
using AmiException::AmiException;
/**
* @brief Constructor with printf style interface
* @param fmt error message with printf format
* @param ... printf formatting variables
*/
explicit SetupFailure(char const* fmt, ...);

};


Expand Down
6 changes: 3 additions & 3 deletions include/amici/model_dimensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ struct ModelDimensions {
*/
int ndwdw {0};

/** Number of nonzero elements in the \f$w\f$ derivative of \f$xdot\f$ */
/** Number of nonzero elements in the \f$ w \f$ derivative of \f$ xdot \f$ */
int ndxdotdw {0};

/**
* Number of nonzero elements in the \f$y\f$ derivative of
* \f$dJy\f$ (dimension `nytrue`)
* Number of nonzero elements in the \f$ y \f$ derivative of
* \f$ dJy \f$ (dimension `nytrue`)
*/
std::vector<int> ndJydy;

Expand Down
19 changes: 19 additions & 0 deletions include/amici/serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <cassert>
#include <fstream>
#include <iostream>
#include <chrono>

#include <boost/serialization/array.hpp>
#include <boost/serialization/vector.hpp>
Expand Down Expand Up @@ -83,6 +84,24 @@ void serialize(Archive &ar, amici::Solver &s, const unsigned int /*version*/) {
ar &s.cpu_time_;
ar &s.cpu_timeB_;
ar &s.rdata_mode_;
ar &s.maxtime_;
}

/**
* @brief Serialize std::chrono::duration to boost archive
* @param ar Archive
* @param d Duration
*/
template <class Archive, class Period, class Rep>
void serialize(Archive &ar, std::chrono::duration<Period, Rep> &d, const unsigned int /*version*/) {
Period tmp_period;
if (Archive::is_loading::value) {
ar &tmp_period;
d = std::chrono::duration<Period, Rep>(tmp_period);
} else {
tmp_period = d.count();
ar &tmp_period;
}
}

/**
Expand Down
50 changes: 41 additions & 9 deletions include/amici/solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <cmath>
#include <functional>
#include <memory>
#include <chrono>

namespace amici {

Expand Down Expand Up @@ -47,6 +48,9 @@ namespace amici {
*/
class Solver {
public:
/** Type of what is passed to Sundials solvers as user_data */
using user_data_type = std::pair<Model *, Solver const*>;

Solver() = default;

/**
Expand Down Expand Up @@ -468,6 +472,30 @@ class Solver {
*/
void setMaxSteps(long int maxsteps);

/**
* @brief Returns the maximum time allowed for integration
* @return Time in seconds
*/
double getMaxTime() const;

/**
* @brief Set the maximum time allowed for integration
* @param maxtime Time in seconds
*/
void setMaxTime(double maxtime);

/**
* @brief Start timer for tracking integration time
*/
void startTimer() const;

/**
* @brief Check whether maximum integration time was exceeded
* @return True if the maximum integration time was exceeded,
* false otherwise.
*/
bool timeExceeded() const;

/**
* @brief returns the maximum number of solver steps for the backward
* problem
Expand Down Expand Up @@ -1113,21 +1141,16 @@ class Solver {
virtual void setErrHandlerFn() const = 0;

/**
* @brief Attaches the user data instance (here this is a Model) to the
* forward problem
*
* @param model Model instance
* @brief Attaches the user data to the forward problem
*/
virtual void setUserData(Model *model) const = 0;
virtual void setUserData() const = 0;

/**
* @brief attaches the user data instance (here this is a Model) to the
* backward problem
* @brief attaches the user data to the backward problem
*
* @param which identifier of the backwards problem
* @param model Model instance
*/
virtual void setUserDataB(int which, Model *model) const = 0;
virtual void setUserDataB(int which) const = 0;

/**
* @brief specifies the maximum number of steps for the forward
Expand Down Expand Up @@ -1519,6 +1542,9 @@ class Solver {
mutable std::vector<std::unique_ptr<void, std::function<void(void *)>>>
solver_memory_B_;

/** Sundials user_data */
mutable user_data_type user_data;

/** internal sensitivity method flag used to select the sensitivity solution
* method. Only applies for Forward Sensitivities. */
InternalSensitivityMethod ism_ {InternalSensitivityMethod::simultaneous};
Expand All @@ -1540,6 +1566,12 @@ class Solver {
/** maximum number of allowed integration steps */
long int maxsteps_ {10000};

/** Maximum wall-time for integration in seconds */
std::chrono::duration<double, std::ratio<1>> maxtime_ {std::chrono::duration<double>::max()};

/** Time at which solver timer was started */
mutable std::chrono::time_point<std::chrono::system_clock> starttime_;

/** linear solver for the forward problem */
mutable std::unique_ptr<SUNLinSolWrapper> linear_solver_;

Expand Down
4 changes: 2 additions & 2 deletions include/amici/solver_cvodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ class CVodeSolver : public Solver {

void setErrHandlerFn() const override;

void setUserData(Model *model) const override;
void setUserData() const override;

void setUserDataB(int which, Model *model) const override;
void setUserDataB(int which) const override;

void setMaxNumSteps(long int mxsteps) const override;

Expand Down
4 changes: 2 additions & 2 deletions include/amici/solver_idas.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ class IDASolver : public Solver {

void setErrHandlerFn() const override;

void setUserData(Model *model) const override;
void setUserData() const override;

void setUserDataB(int which, Model *model) const override;
void setUserDataB(int which) const override;

void setMaxNumSteps(long int mxsteps) const override;

Expand Down
Loading

0 comments on commit bd3b89d

Please sign in to comment.