diff --git a/documentation/rtd_requirements.txt b/documentation/rtd_requirements.txt index c5fe2d49a9..cd37291f32 100644 --- a/documentation/rtd_requirements.txt +++ b/documentation/rtd_requirements.txt @@ -12,7 +12,7 @@ sphinx_rtd_theme>=1.0.0 petab>=0.1.20 sphinx-autodoc-typehints==1.19.2 git+https://github.com/readthedocs/sphinx-hoverxref@main -ipython==8.4.0 +ipython==8.10.0 breathe==4.34.0 #exhale>=0.3.5 -e git+https://github.com/mithro/sphinx-contrib-mithro#egg=sphinx-contrib-exhale-multiproject&subdirectory=sphinx-contrib-exhale-multiproject diff --git a/include/amici/solver.h b/include/amici/solver.h index 4d5c06c9fe..76e2ec9d5f 100644 --- a/include/amici/solver.h +++ b/include/amici/solver.h @@ -7,6 +7,7 @@ #include "amici/logging.h" #include +#include #include #include #include @@ -487,7 +488,7 @@ class Solver { double getMaxTime() const; /** - * @brief Set the maximum time allowed for integration + * @brief Set the maximum CPU time allowed for integration * @param maxtime Time in seconds */ void setMaxTime(double maxtime); @@ -1607,11 +1608,11 @@ class Solver { /** maximum number of allowed integration steps */ long int maxsteps_ {10000}; - /** Maximum wall-time for integration in seconds */ + /** Maximum CPU-time for integration in seconds */ std::chrono::duration> maxtime_ {std::chrono::duration::max()}; /** Time at which solver timer was started */ - mutable std::chrono::time_point starttime_; + mutable std::clock_t starttime_; /** linear solver for the forward problem */ mutable std::unique_ptr linear_solver_; diff --git a/src/model.cpp b/src/model.cpp index db36040167..010fe051e1 100644 --- a/src/model.cpp +++ b/src/model.cpp @@ -1476,7 +1476,7 @@ int Model::checkFinite(gsl::span array, if(hasObservableIds()) row_id += " " + getObservableIds()[row]; if(hasParameterIds()) - col_id += " " + getParameterIds()[plist(col)]; + col_id += " " + getParameterIds()[plist(gsl::narrow(col))]; break; case ModelQuantity::dydx: if(hasObservableIds()) @@ -1488,7 +1488,7 @@ int Model::checkFinite(gsl::span array, if(hasStateIds()) row_id += " " + getStateIdsSolver()[row]; if(hasParameterIds()) - col_id += " " + getParameterIds()[plist(col)]; + col_id += " " + getParameterIds()[plist(gsl::narrow(col))]; break; case ModelQuantity::dJydy: case ModelQuantity::dJydy_matlab: @@ -1510,7 +1510,7 @@ int Model::checkFinite(gsl::span array, case ModelQuantity::drzdp: case ModelQuantity::dsigmazdp: if(hasParameterIds()) - col_id += " " + getParameterIds()[plist(col)]; + col_id += " " + getParameterIds()[plist(gsl::narrow(col))]; break; case ModelQuantity::dsigmaydy: if(hasObservableIds()) { @@ -1610,7 +1610,7 @@ int Model::checkFinite(SUNMatrix m, ModelQuantity model_quantity, realtype t) co if(hasExpressionIds()) row_id += " " + getExpressionIds()[row]; if(hasParameterIds()) - col_id += " " + getParameterIds()[plist(col)]; + col_id += " " + getParameterIds()[plist(gsl::narrow(col))]; break; default: break; diff --git a/src/solver.cpp b/src/solver.cpp index 6bb20abe74..19f4ef9b6d 100644 --- a/src/solver.cpp +++ b/src/solver.cpp @@ -859,12 +859,13 @@ void Solver::setMaxTime(double maxtime) void Solver::startTimer() const { - starttime_ = std::chrono::system_clock::now(); + starttime_ = std::clock(); } bool Solver::timeExceeded() const { - return std::chrono::system_clock::now() - starttime_ > maxtime_; + auto cputime_exceed = static_cast(std::clock() - starttime_) / CLOCKS_PER_SEC; + return std::chrono::duration(cputime_exceed) > maxtime_; } void Solver::setMaxSteps(const long int maxsteps) {