From cae005c6b0e00c993548bc02d634c7beb6f42ea1 Mon Sep 17 00:00:00 2001 From: Paul Stapor Date: Sat, 27 Jul 2019 16:45:53 +0200 Subject: [PATCH 01/13] update with publication from FOSBE2019 (#740) * update with publication from FOSBE2019 * recreate ref list, add comment for installing biblibon mac * update FischerFie2017 * Update publication list (Fix title FischerFie2017; Update SchmiesterSch2019) --- documentation/amici_refs.bib | 318 ++++++++++++++--------- documentation/recreate_reference_list.py | 4 +- documentation/references.md | 26 +- 3 files changed, 214 insertions(+), 134 deletions(-) diff --git a/documentation/amici_refs.bib b/documentation/amici_refs.bib index bcc467d28b..8366aecbe1 100644 --- a/documentation/amici_refs.bib +++ b/documentation/amici_refs.bib @@ -1,4 +1,44 @@ % Encoding: UTF-8 + + + + +@article{VillaverdeRai2019, + Author = {Villaverde, Alejandro F. and Raim\'undez, Elba and Hasenauer, Jan and Banga, Julio R.}, + Date-Added = {2019-07-26 10:02:28 +0200}, + Date-Modified = {2019-07-26 10:04:48 +0200}, + Journal = {accepted for publication in Proc. of the Foundations of Syst. Biol. in Engin. (FOSBE)}, + Keywords = {ODE, large-scale, Parameter identification, prediction uncertainty, FIM, profile likelihood}, + Title = {A Comparison of Methods for Quantifying Prediction Uncertainty in Systems Biology}, + Year = {2019}} + +@article{WangSta2019, + Author = {Wang, Dantong and Stapor, Paul and Hasenauer, Jan}, + Date-Added = {2019-07-26 09:11:43 +0200}, + Date-Modified = {2019-07-26 09:13:12 +0200}, + Journal = {accepted for publication in Proc. of the Foundations of Syst. Biol. in Engin. (FOSBE)}, + Keywords = {mixed-effect models, dirac mixture model, dmd, sigma points}, + Title = {Dirac mixture distributions for the approximation of mixed effects models}, + Year = {2019}} + +@article{LinesPas2019, + Author = {Lines, Glenn Terje and Paszkowski, Lukasz and Schmiester, Leonard and Weindl, Daniel and Stapor, Paul and Hasenauer, Jan}, + Date-Added = {2019-07-26 09:08:46 +0200}, + Date-Modified = {2019-07-26 09:13:34 +0200}, + Journal = {accepted for publication in Proc. of the Foundations of Syst. Biol. in Engin. (FOSBE)}, + Keywords = {ODE, large-scale, Simulation, steady state, Newton solver}, + Title = {Efficient computation of steady states in large-scale ODE models of biochemical reaction networks}, + Year = {2019}} + +@article{KapferSta2019, + Author = {Kapfer, Eva-Maria and Stapor, Paul and Hasenauer, Jan}, + Date-Added = {2019-07-26 08:59:38 +0200}, + Date-Modified = {2019-07-26 09:13:24 +0200}, + Journal = {accepted for publication in Proc. of the Foundations of Syst. Biol. in Engin. (FOSBE)}, + Keywords = {Optimization, large-scale, parameter estimation, Parameter identification, standards, PEtab, SBML, SED-ML, ODE, Simulation, steady state}, + Title = {Challenges in the calibration of large-scale ordinary differential equation models}, + Year = {2019}} + @article{BallnusHug2017, Author = {Ballnus, B. and Hug, S. and Hatz, K. and G{\"o}rlitz, L. and Hasenauer, J. and Theis, F. J.}, Date-Added = {2019-03-19 23:04:09 +0100}, @@ -10,7 +50,8 @@ @article{BallnusHug2017 Number = {63}, Title = {Comprehensive benchmarking of {Markov} chain {Monte} {Carlo} methods for dynamical systems}, Volume = {11}, - Year = {2017}} + Year = {2017}, + Bdsk-Url-1 = {https://doi.org/10.1186/s12918-017-0433-1}} @article{BallnusSch2018, Abstract = {Motivation: Mathematical models have become standard tools for the investigation of cellular processes and the unraveling of signal processing mechanisms. The parameters of these models are usually derived from the available data using optimization and sampling methods. However, the efficiency of these methods is limited by the properties of the mathematical model, e.g. non-identifiabilities, and the resulting posterior distribution. In particular, multi-modal distributions with long valleys or pronounced tails are difficult to optimize and sample. Thus, the developement or improvement of optimization and sampling methods is subject to ongoing research. @@ -31,7 +72,8 @@ @article{BallnusSch2018 Pst = {ppublish}, Title = {Bayesian parameter estimation for biochemical reaction networks using region-based adaptive parallel tempering}, Volume = {34}, - Year = {2018}} + Year = {2018}, + Bdsk-Url-1 = {https://doi.org/10.1093/bioinformatics/bty229}} @article{BastCal2018, Author = {Bast, Lisa and Calzolari, Filippo and Strasser, Michael and Hasenauer, Jan and Theis, Fabian J. and Ninkovic, Jovica and Marr, Carsten}, @@ -54,7 +96,8 @@ @article{BoigerHas2016 Pages = {125009}, Title = {Integration based profile likelihood calculation for {PDE} constrained parameter estimation problems}, Volume = {32}, - Year = {2016}} + Year = {2016}, + Bdsk-Url-1 = {https://doi.org/10.1088/0266-5611/32/12/125009}} @article{FiedlerRae2016, Author = {Fiedler, A. and Raeth, S. and Theis, F. J. and Hausser, A. and Hasenauer, J.}, @@ -67,21 +110,25 @@ @article{FiedlerRae2016 Number = {80}, Title = {Tailored parameter optimization methods for ordinary differential equation models with steady-state constraints}, Volume = {10}, - Year = {2016}} + Year = {2016}, + Bdsk-Url-1 = {https://doi.org/10.1186/s12918-016-0319-7}} -@article{FischerFie2017, - Abstract = {Cellular development has traditionally been described as a series of transitions between discrete cell states, such as the sequence of double negative, double positive and single positive stages in T-cell development. Recent advances in single cell transcriptomics suggest an alternative description of development, in which cells follow continuous transcriptomic trajectories. A cell{\textquoteright}s state along such a trajectory can be captured with pseudotemporal ordering, which however is not able to predict development of the system in real time. We present pseudodynamics, a mathematical framework that integrates time-series and genetic knock-out information with such transcriptome-based descriptions in order to describe and analyze the real-time evolution of the system. Pseudodynamics models the distribution of a cell population across a continuous cell state coordinate over time based on a stochastic differential equation along developmental trajectories and random switching between trajectories in branching regions. To illustrate feasibility, we use pseudodynamics to estimate cell-state-dependent growth and differentiation of thymic T-cell development. The model approximates a developmental potential function (Waddington{\textquoteright}s landscape) and suggests that thymic T-cell development is biphasic and not strictly deterministic before beta-selection. Pseudodynamics generalizes classical discrete population models to continuous states and thus opens possibilities such as probabilistic model selection to single cell genomics.}, - Author = {Fischer, David S. and Fiedler, Anna K. and Kernfeld, Eric and Genga, Ryan M. J. and Hasenauer, Jan and Maehr, Rene and Theis, Fabian J.}, - Date-Added = {2019-03-19 23:04:09 +0100}, - Date-Modified = {2019-03-19 23:04:09 +0100}, - Doi = {10.1101/219188}, - Eprint = {https://www.biorxiv.org/content/early/2017/11/14/219188.full.pdf}, - Journal = {bioRxiv}, - Keywords = {pseudo time; single-cell RNA-seq}, - Publisher = {Cold Spring Harbor Laboratory}, - Title = {Beyond pseudotime: Following {T}-cell maturation in single-cell {RNA}seq time series}, - Url = {https://www.biorxiv.org/content/early/2017/11/14/219188}, - Year = {2017}} +@Article{FischerFie2017, + author = {Fischer, David S. and Fiedler, Anna K. and Kernfeld, Eric and Genga, Ryan M. J. and Bastidas-Ponce, Aim\'ee and Bakhti, Mostafa and Lickert, Heiko and Hasenauer, Jan and Maehr, Rene and Theis, Fabian J.}, + title = {Inferring population dynamics from single-cell RNA-sequencing time series data}, + journal = {Nature Biotechnology}, + year = {2019}, + volume = {37}, + pages = {461--468}, + abstract = {Cellular development has traditionally been described as a series of transitions between discrete cell states, such as the sequence of double negative, double positive and single positive stages in T-cell development. Recent advances in single cell transcriptomics suggest an alternative description of development, in which cells follow continuous transcriptomic trajectories. A cell{\textquoteright}s state along such a trajectory can be captured with pseudotemporal ordering, which however is not able to predict development of the system in real time. We present pseudodynamics, a mathematical framework that integrates time-series and genetic knock-out information with such transcriptome-based descriptions in order to describe and analyze the real-time evolution of the system. Pseudodynamics models the distribution of a cell population across a continuous cell state coordinate over time based on a stochastic differential equation along developmental trajectories and random switching between trajectories in branching regions. To illustrate feasibility, we use pseudodynamics to estimate cell-state-dependent growth and differentiation of thymic T-cell development. The model approximates a developmental potential function (Waddington{\textquoteright}s landscape) and suggests that thymic T-cell development is biphasic and not strictly deterministic before beta-selection. Pseudodynamics generalizes classical discrete population models to continuous states and thus opens possibilities such as probabilistic model selection to single cell genomics.}, + bdsk-url-1 = {https://www.biorxiv.org/content/early/2017/11/14/219188}, + bdsk-url-2 = {https://doi.org/10.1101/219188}, + date-added = {2019-03-19 23:04:09 +0100}, + date-modified = {2019-07-26 12:14:33 +0200}, + doi = {10.1038/s41587-019-0088-0}, + keywords = {pseudo time; single-cell RNA-seq; PDE}, + url = {https://www.nature.com/articles/s41587-019-0088-0}, +} @article{FroehlichKal2017, Author = {Fr\"ohlich, F. and Kaltenbacher, B. and Theis, F. J. and Hasenauer, J.}, @@ -95,7 +142,8 @@ @article{FroehlichKal2017 Pages = {e1005331}, Title = {Scalable Parameter Estimation for Genome-Scale Biochemical Reaction Networks}, Volume = {13}, - Year = {2017}} + Year = {2017}, + Bdsk-Url-1 = {https://doi.org/10.1371/journal.pcbi.1005331}} @article{FroehlichKes2017, Author = {Fr\"ohlich, Fabian and Kessler, Thomas and Weindl, Daniel and Shadrin, Alexey and Schmiester, Leonard and Hache, Hendrik and Muradyan, Artur and Schuette, Moritz and Lim, Ji-Hyun and Heinig, Matthias and Theis, Fabian and Lehrach, Hans and Wierling, Christoph and Lange, Bodo and Hasenauer, Jan}, @@ -108,7 +156,9 @@ @article{FroehlichKes2017 Publisher = {Cold Spring Harbor Labs Journals}, Title = {Efficient parameterization of large-scale mechanistic models enables drug response prediction for cancer cell lines}, Url = {http://www.biorxiv.org/content/early/2017/08/09/174094}, - Year = {2017}} + Year = {2017}, + Bdsk-Url-1 = {http://www.biorxiv.org/content/early/2017/08/09/174094}, + Bdsk-Url-2 = {https://doi.org/10.1101/174094}} @article{FroehlichRei2018, Abstract = {Single-cell time-lapse studies have advanced the quantitative understanding of cellular pathways and their inherent cell-to-cell variability. However, parameters retrieved from individual experiments are model dependent and their estimation is limited, if based on solely one kind of experiment. Hence, methods to integrate data collected under different conditions are expected to improve model validation and information content. Here we present a multi-experiment nonlinear mixed effect modeling approach for mechanistic pathway models, which allows the integration of multiple single-cell perturbation experiments. We apply this approach to the translation of green fluorescent protein after transfection using a massively parallel read-out of micropatterned single-cell arrays. We demonstrate that the integration of data from perturbation experiments allows the robust reconstruction of cell-to-cell variability, i.e., parameter densities, while each individual experiment provides insufficient information. Indeed, we show that the integration of the datasets on the population level also improves the estimates for individual cells by breaking symmetries, although each of them is only measured in one experiment. Moreover, we confirmed that the suggested approach is robust with respect to batch effects across experimental replicates and can provide mechanistic insights into the nature of batch effects. We anticipate that the proposed multi-experiment nonlinear mixed effect modeling approach will serve as a basis for the analysis of cellular heterogeneity in single-cell dynamics.}, @@ -126,7 +176,8 @@ @article{FroehlichRei2018 Ty = {JOUR}, Url = {https://doi.org/10.1038/s41540-018-0079-7}, Volume = {5}, - Year = {2018}} + Year = {2018}, + Bdsk-Url-1 = {https://doi.org/10.1038/s41540-018-0079-7}} @article{FroehlichThe2016, Author = {Fr\"ohlich, F. and Theis, F. J. and R\"{a}dler, J. O. and Hasenauer, J.}, @@ -140,7 +191,8 @@ @article{FroehlichThe2016 Pages = {1049--1056}, Title = {Parameter estimation for dynamical systems with discrete events and logical operations}, Volume = {33}, - Year = {2017}} + Year = {2017}, + Bdsk-Url-1 = {https://doi.org/10.1093/bioinformatics/btw764}} @article{FroehlichTho2016, Author = {Fr\"ohlich, F. and Thomas, P. and Kazeroonian, A. and Theis, F. J. and Grima, R. and Hasenauer, J.}, @@ -154,7 +206,8 @@ @article{FroehlichTho2016 Pages = {e1005030}, Title = {Inference for Stochastic Chemical Kinetics Using Moment Equations and System Size Expansion}, Volume = {12}, - Year = {2016}} + Year = {2016}, + Bdsk-Url-1 = {https://doi.org/10.1371/journal.pcbi.1005030}} @inproceedings{HrossFie2016, Author = {Hross, S. and Fiedler, A. and Theis, F. J. and Hasenauer, J.}, @@ -169,7 +222,8 @@ @inproceedings{HrossFie2016 Publisher = {IFAC-PapersOnLine}, Title = {Quantitative comparison of competing {PDE} models for {Pom1p} dynamics in fission yeast}, Volume = {49}, - Year = {2016}} + Year = {2016}, + Bdsk-Url-1 = {https://doi.org/10.1016/j.ifacol.2016.12.136}} @article{KazeroonianFro2016, Author = {Kazeroonian, A. and Fr{\"o}hlich, F. and Raue, A. and Theis, F. J. and Hasenauer, J.}, @@ -183,7 +237,8 @@ @article{KazeroonianFro2016 Pages = {e0146732}, Title = {{CERENA:} {Chemical} {REaction} Network {Analyzer -- A} Toolbox for the Simulation and Analysis of Stochastic Chemical Kinetics}, Volume = {11}, - Year = {2016}} + Year = {2016}, + Bdsk-Url-1 = {https://doi.org/10.1371/journal.pone.0146732}} @article{KazeroonianThe2017, Author = {Kazeroonian, A. and Theis, F. J. and Hasenauer, J.}, @@ -197,7 +252,8 @@ @article{KazeroonianThe2017 Pages = {i293--i300}, Title = {A scalable moment-closure approximation for large-scale biochemical reaction networks}, Volume = {33}, - Year = {2017}} + Year = {2017}, + Bdsk-Url-1 = {https://doi.org/10.1093/bioinformatics/btx249}} @inproceedings{LoosFie2016, Author = {Loos, C. and Fiedler, A. and Hasenauer, J.}, @@ -212,7 +268,8 @@ @inproceedings{LoosFie2016 Publisher = {Springer International Publishing}, Series = {Lecture Notes in Bioinformatics}, Title = {Parameter estimation for reaction rate equation constrained mixture models}, - Year = {2016}} + Year = {2016}, + Bdsk-Url-1 = {https://doi.org/10.1007/978-3-319-45177-0}} @article{LoosKra2018, Abstract = {Mathematical models are nowadays important tools for analyzing dynamics of cellular processes. The unknown model parameters are usually estimated from experimental data. These data often only provide information about the relative changes between conditions, hence, the observables contain scaling parameters. The unknown scaling parameters and corresponding noise parameters have to be inferred along with the dynamic parameters. The nuisance parameters often increase the dimensionality of the estimation problem substantially and cause convergence problems. In this manuscript, we propose a hierarchical optimization approach for estimating the parameters for ordinary differential equation (ODE) models from relative data. Our approach restructures the optimization problem into an inner and outer subproblem. These subproblems possess lower dimensions than the original optimization problem, and the inner problem can be solved analytically. We evaluated accuracy, robustness, and computational efficiency of the hierarchical approach by studying three signaling pathways. The proposed approach achieved better convergence than the standard approach and required a lower computation time. As the hierarchical optimization approach is widely applicable, it provides a powerful alternative to established approaches.}, @@ -227,7 +284,8 @@ @article{LoosKra2018 Pages = {4266--4273}, Title = {Hierarchical optimization for the efficient parametrization of {ODE} models}, Volume = {34}, - Year = {2018}} + Year = {2018}, + Bdsk-Url-1 = {https://doi.org/10.1093/bioinformatics/bty514}} @inbook{LoosMar2015, Author = {Loos, C. and Marr, C. and Theis, F. J. and Hasenauer, J.}, @@ -271,21 +329,27 @@ @article{MaierLoo2017 Pages = {718--725}, Title = {Robust parameter estimation for dynamical systems from outlier-corrupted data}, Volume = {33}, - Year = {2017}} + Year = {2017}, + Bdsk-Url-1 = {https://doi.org/10.1093/bioinformatics/btw703}} @article{SchaelteSta2018, Author = {Sch{\"a}lte, Y. and Stapor, P. and Hasenauer, J.}, Date-Added = {2019-03-19 23:04:09 +0100}, - Date-Modified = {2019-03-19 23:04:09 +0100}, - Journal = {to appear in Proc. of the Foundations of Syst. Biol. in Engin. (FOSBE)}, + Date-Modified = {2019-07-26 09:04:30 +0200}, + Journal = {FAC-PapersOnLine}, + Keywords = {Optimization, Parameter estimation, derivative-free, derivatives, gradients}, + Number = {19}, + Pages = {98--101}, Title = {Evaluation of Derivative-Free Optimizers for Parameter Estimation in Systems Biology}, + Volume = {51}, Year = {2018}} @article{StaporFro2018, Author = {Stapor, Paul and Fr{\"o}hlich, Fabian and Hasenauer, Jan}, Date-Added = {2019-03-19 23:04:09 +0100}, - Date-Modified = {2019-03-19 23:04:09 +0100}, + Date-Modified = {2019-07-26 09:06:44 +0200}, Journal = {Bioinformatics}, + Keywords = {adjoint sensitivity, second order methods, hessian, optimization, profile likelihood, hybrid methods, profile integration}, Number = {13}, Pages = {i151--i159}, Publisher = {Oxford University Press}, @@ -297,114 +361,103 @@ @article{VillaverdeFro2018 Abstract = {Motivation: Mechanistic kinetic models usually contain unknown parameters, which need to be estimated by optimizing the fit of the model to experimental data. This task can be computationally challenging due to the presence of local optima and ill-conditioning. While a variety of optimization methods have been suggested to surmount these issues, it is not obvious how to choose the best one for a given problem a priori, since many factors can influence their performance. A systematic comparison of methods that are suited to parameter estimation problems of sizes ranging from tens to hundreds of optimization variables is currently missing, and smaller studies indeed provided contradictory findings. Results: Here, we use a collection of benchmark problems to evaluate the performance of two families of optimization methods: (i) a multi-start of deterministic local searches; and (ii) a hybrid metaheuristic combining stochastic global search with deterministic local searches. A fair comparison is ensured through a collaborative evaluation, involving researchers applying each method on a daily basis, and a consideration of multiple performance metrics capturing the trade-off between computational efficiency and robustness. Our results show that, thanks to recent advances in the calculation of parametric sensitivities, a multi-start of gradient-based local methods is often a successful strategy, but a better performance can be obtained with a hybrid metaheuristic. The best performer is a combination of a global scatter search metaheuristic with an interior point local method, provided with gradients estimated with adjoint-based sensitivities. We provide an implementation of this novel method in an open-source software toolbox to render it available to the scientific community. Availability and Implementation: The code to reproduce the results is available at Zenodo https://doi.org/10.5281/zenodo.1160343}, Author = {Villaverde, Alejandro F. and Froehlich, Fabian and Weindl, Daniel and Hasenauer, Jan and Banga, Julio R}, Date-Added = {2019-03-19 23:04:09 +0100}, - Date-Modified = {2019-03-19 23:04:09 +0100}, + Date-Modified = {2019-07-26 09:07:31 +0200}, Journal = {Bioinformatics}, + Keywords = {large-scale, benchmarking, optimization, MEIGO, scatter-search, multi-start}, Pages = {bty736}, Title = {Benchmarking optimization methods for parameter estimation in large kinetic models}, Year = {2018}} -@Article{DharmarajanKal2019, - author = {Dharmarajan, Lekshmi and Kaltenbach, Hans-Michael and Rudolf, Fabian and Stelling, Joerg}, - title = {A Simple and Flexible Computational Framework for Inferring Sources of Heterogeneity from Single-Cell Dynamics}, - journal = {Cell Systems}, - year = {2019}, - volume = {8}, - number = {1}, - pages = {15--26.e11}, - month = mar, - issn = {2405-4712}, - comment = {doi: 10.1016/j.cels.2018.12.007}, - doi = {10.1016/j.cels.2018.12.007}, - publisher = {Elsevier}, - url = {https://doi.org/10.1016/j.cels.2018.12.007}, -} - -@Article{SchmiesterSch2019, - author = {Schmiester, Leonard and Schaelte, Yannik and Froehlich, Fabian and Hasenauer, Jan and Weindl, Daniel}, - title = {Efficient parameterization of large-scale dynamic models based on relative measurements}, - journal = {bioRxiv}, - year = {2019}, - abstract = {Motivation: Mechanistic models of biochemical reaction networks facilitate the quantitative understanding of biological processes and the integration of heterogeneous datasets. However, some biological processes require the consideration of comprehensive reaction networks and therefore large-scale models. Parameter estimation for such models poses great challenges, in particular when the data are on a relative scale. Results: Here, we propose a novel hierarchical approach combining (i) the efficient analytic evaluation of optimal scaling, offset, and error model parameters with (ii) the scalable evaluation of objective function gradients using adjoint sensitivity analysis. We evaluate the properties of the methods by parameterizing a pan-cancer ordinary differential equation model (\>1000 state variables, \>4000 parameters) using relative protein, phospho-protein and viability measurements. The hierarchical formulation improves optimizer performance considerably. Furthermore, we show that this approach allows estimating error model parameters with negligible computational overhead when no experimental estimates are available, providing an unbiased way to weight heterogeneous data. Overall, our hierarchical formulation is applicable to a wide range of models, and allows for the efficient parameterization of large-scale models based on heterogeneous relative measurements.}, - doi = {10.1101/579045}, - elocation-id = {579045}, - eprint = {https://www.biorxiv.org/content/early/2019/03/16/579045.full.pdf}, - publisher = {Cold Spring Harbor Laboratory}, - url = {https://www.biorxiv.org/content/early/2019/03/16/579045}, -} +@article{DharmarajanKal2019, + Author = {Dharmarajan, Lekshmi and Kaltenbach, Hans-Michael and Rudolf, Fabian and Stelling, Joerg}, + Comment = {doi: 10.1016/j.cels.2018.12.007}, + Doi = {10.1016/j.cels.2018.12.007}, + Issn = {2405-4712}, + Journal = {Cell Systems}, + Month = mar, + Number = {1}, + Pages = {15--26.e11}, + Publisher = {Elsevier}, + Title = {A Simple and Flexible Computational Framework for Inferring Sources of Heterogeneity from Single-Cell Dynamics}, + Url = {https://doi.org/10.1016/j.cels.2018.12.007}, + Volume = {8}, + Year = {2019}, + Bdsk-Url-1 = {https://doi.org/10.1016/j.cels.2018.12.007}} -@Article{GreggSar2019, - author = {Gregg, Robert W and Sarkar, Saumendra N and Shoemaker, Jason E}, - title = {Mathematical modeling of the cGAS pathway reveals robustness of DNA sensing to TREX1 feedback.}, - journal = {Journal of theoretical biology}, - year = {2019}, - volume = {462}, - pages = {148--157}, - month = feb, - issn = {1095-8541}, - __markedentry = {[dweindl:]}, - abstract = {Cyclic GMP-AMP synthase (cGAS) has recently been identified as the primary protein that detects cytosolic double stranded DNA to invoke a type I interferon response. The cGAS pathway is vital in the recognition of DNA encoded viruses as well as self-DNA leaked from the nucleus of damaged cells. Currently, the dynamics regulating the cGAS pathway are poorly understood; limiting our knowledge of how DNA-induced immune responses are regulated. Using systems biology approaches, we formulated a mathematical model to describe the dynamics of this pathway and examine the resulting system-level emergent properties. Unknown model parameters were fit to data compiled from literature using a Parallel Tempering Markov Chain Monte Carlo (PT-MCMC) approach, resulting in an ensemble of parameterized models. A local sensitivity analysis demonstrated that parameter sensitivity trends across model ensembles were independent of the select parameterization. An in-silico knock-down of TREX1 found that the interferon response is highly robust, showing that complete inhibition is necessary to induce chemical conditions consistent with chronic inflammation. Lastly, we demonstrate that the model recapitulates interferon expression data resulting from small molecule inhibition of cGAS. Overall, the importance of this model is exhibited in its capacity to identify sensitive components of the cGAS pathway, generate testable hypotheses, and confirm experimental observations.}, - country = {England}, - doi = {10.1016/j.jtbi.2018.11.001}, - issn-linking = {0022-5193}, - keywords = {Interferon signaling; ODE modeling; Systems biology}, - nlm-id = {0376342}, - owner = {NLM}, - pii = {S0022-5193(18)30548-4}, - pmid = {30395807}, - pubmodel = {Print-Electronic}, - pubstatus = {ppublish}, - revised = {2018-12-23}, -} +@article{GreggSar2019, + __Markedentry = {[dweindl:]}, + Abstract = {Cyclic GMP-AMP synthase (cGAS) has recently been identified as the primary protein that detects cytosolic double stranded DNA to invoke a type I interferon response. The cGAS pathway is vital in the recognition of DNA encoded viruses as well as self-DNA leaked from the nucleus of damaged cells. Currently, the dynamics regulating the cGAS pathway are poorly understood; limiting our knowledge of how DNA-induced immune responses are regulated. Using systems biology approaches, we formulated a mathematical model to describe the dynamics of this pathway and examine the resulting system-level emergent properties. Unknown model parameters were fit to data compiled from literature using a Parallel Tempering Markov Chain Monte Carlo (PT-MCMC) approach, resulting in an ensemble of parameterized models. A local sensitivity analysis demonstrated that parameter sensitivity trends across model ensembles were independent of the select parameterization. An in-silico knock-down of TREX1 found that the interferon response is highly robust, showing that complete inhibition is necessary to induce chemical conditions consistent with chronic inflammation. Lastly, we demonstrate that the model recapitulates interferon expression data resulting from small molecule inhibition of cGAS. Overall, the importance of this model is exhibited in its capacity to identify sensitive components of the cGAS pathway, generate testable hypotheses, and confirm experimental observations.}, + Author = {Gregg, Robert W and Sarkar, Saumendra N and Shoemaker, Jason E}, + Country = {England}, + Doi = {10.1016/j.jtbi.2018.11.001}, + Issn = {1095-8541}, + Issn-Linking = {0022-5193}, + Journal = {Journal of theoretical biology}, + Keywords = {Interferon signaling; ODE modeling; Systems biology}, + Month = feb, + Nlm-Id = {0376342}, + Owner = {NLM}, + Pages = {148--157}, + Pii = {S0022-5193(18)30548-4}, + Pmid = {30395807}, + Pubmodel = {Print-Electronic}, + Pubstatus = {ppublish}, + Revised = {2018-12-23}, + Title = {Mathematical modeling of the cGAS pathway reveals robustness of DNA sensing to TREX1 feedback.}, + Volume = {462}, + Year = {2019}, + Bdsk-Url-1 = {https://doi.org/10.1016/j.jtbi.2018.11.001}} -@Article{PittBan2019, - author = {Pitt, Jake Alan and Banga, Julio R}, - title = {Parameter estimation in models of biological oscillators: an automated regularised estimation approach.}, - journal = {BMC bioinformatics}, - year = {2019}, - volume = {20}, - pages = {82}, - month = feb, - issn = {1471-2105}, - __markedentry = {[dweindl:6]}, - abstract = {Dynamic modelling is a core element in the systems biology approach to understanding complex biosystems. Here, we consider the problem of parameter estimation in models of biological oscillators described by deterministic nonlinear differential equations. These problems can be extremely challenging due to several common pitfalls: (i) a lack of prior knowledge about parameters (i.e. massive search spaces), (ii) convergence to local optima (due to multimodality of the cost function), (iii) overfitting (fitting the noise instead of the signal) and (iv) a lack of identifiability. As a consequence, the use of standard estimation methods (such as gradient-based local ones) will often result in wrong solutions. Overfitting can be particularly problematic, since it produces very good calibrations, giving the impression of an excellent result. However, overfitted models exhibit poor predictive power. Here, we present a novel automated approach to overcome these pitfalls. Its workflow makes use of two sequential optimisation steps incorporating three key algorithms: (1) sampling strategies to systematically tighten the parameter bounds reducing the search space, (2) efficient global optimisation to avoid convergence to local solutions, (3) an advanced regularisation technique to fight overfitting. In addition, this workflow incorporates tests for structural and practical identifiability. We successfully evaluate this novel approach considering four difficult case studies regarding the calibration of well-known biological oscillators (Goodwin, FitzHugh-Nagumo, Repressilator and a metabolic oscillator). In contrast, we show how local gradient-based approaches, even if used in multi-start fashion, are unable to avoid the above-mentioned pitfalls. Our approach results in more efficient estimations (thanks to the bounding strategy) which are able to escape convergence to local optima (thanks to the global optimisation approach). Further, the use of regularisation allows us to avoid overfitting, resulting in more generalisable calibrated models (i.e. models with greater predictive power).}, - citation-subset = {IM}, - completed = {2019-03-13}, - country = {England}, - doi = {10.1186/s12859-019-2630-y}, - issn-linking = {1471-2105}, - issue = {1}, - keywords = {Algorithms; Biological Clocks; Calibration; Humans; Metabolic Networks and Pathways; Models, Biological; Signal Transduction; Systems Biology, methods; Dynamic modelling; Global optimisation; Parameter bounding; Parameter estimation; Regularisation}, - nlm-id = {100965194}, - owner = {NLM}, - pii = {10.1186/s12859-019-2630-y}, - pmc = {PMC6377730}, - pmid = {30770736}, - pubmodel = {Electronic}, - pubstatus = {epublish}, - revised = {2019-03-13}, -} +@article{PittBan2019, + __Markedentry = {[dweindl:6]}, + Abstract = {Dynamic modelling is a core element in the systems biology approach to understanding complex biosystems. Here, we consider the problem of parameter estimation in models of biological oscillators described by deterministic nonlinear differential equations. These problems can be extremely challenging due to several common pitfalls: (i) a lack of prior knowledge about parameters (i.e. massive search spaces), (ii) convergence to local optima (due to multimodality of the cost function), (iii) overfitting (fitting the noise instead of the signal) and (iv) a lack of identifiability. As a consequence, the use of standard estimation methods (such as gradient-based local ones) will often result in wrong solutions. Overfitting can be particularly problematic, since it produces very good calibrations, giving the impression of an excellent result. However, overfitted models exhibit poor predictive power. Here, we present a novel automated approach to overcome these pitfalls. Its workflow makes use of two sequential optimisation steps incorporating three key algorithms: (1) sampling strategies to systematically tighten the parameter bounds reducing the search space, (2) efficient global optimisation to avoid convergence to local solutions, (3) an advanced regularisation technique to fight overfitting. In addition, this workflow incorporates tests for structural and practical identifiability. We successfully evaluate this novel approach considering four difficult case studies regarding the calibration of well-known biological oscillators (Goodwin, FitzHugh-Nagumo, Repressilator and a metabolic oscillator). In contrast, we show how local gradient-based approaches, even if used in multi-start fashion, are unable to avoid the above-mentioned pitfalls. Our approach results in more efficient estimations (thanks to the bounding strategy) which are able to escape convergence to local optima (thanks to the global optimisation approach). Further, the use of regularisation allows us to avoid overfitting, resulting in more generalisable calibrated models (i.e. models with greater predictive power).}, + Author = {Pitt, Jake Alan and Banga, Julio R}, + Citation-Subset = {IM}, + Completed = {2019-03-13}, + Country = {England}, + Doi = {10.1186/s12859-019-2630-y}, + Issn = {1471-2105}, + Issn-Linking = {1471-2105}, + Issue = {1}, + Journal = {BMC bioinformatics}, + Keywords = {Algorithms; Biological Clocks; Calibration; Humans; Metabolic Networks and Pathways; Models, Biological; Signal Transduction; Systems Biology, methods; Dynamic modelling; Global optimisation; Parameter bounding; Parameter estimation; Regularisation}, + Month = feb, + Nlm-Id = {100965194}, + Owner = {NLM}, + Pages = {82}, + Pii = {10.1186/s12859-019-2630-y}, + Pmc = {PMC6377730}, + Pmid = {30770736}, + Pubmodel = {Electronic}, + Pubstatus = {epublish}, + Revised = {2019-03-13}, + Title = {Parameter estimation in models of biological oscillators: an automated regularised estimation approach.}, + Volume = {20}, + Year = {2019}, + Bdsk-Url-1 = {https://doi.org/10.1186/s12859-019-2630-y}} -@Article{KaltenbacherPed2018, - author = {Barbara Kaltenbacher and Barbara Pedretscher}, - title = {Parameter estimation in SDEs via the Fokker–Planck equation: Likelihood function and adjoint based gradient computation}, - journal = {Journal of Mathematical Analysis and Applications}, - year = {2018}, - volume = {465}, - number = {2}, - pages = {872 - 884}, - issn = {0022-247X}, - abstract = {In this paper we consider the problem of identifying parameters in stochastic differential equations. For this purpose, we transform the originally stochastic and nonlinear state equation to a deterministic linear partial differential equation for the transition probability density. We provide an appropriate likelihood cost function for parameter fitting, and derive an adjoint based approach for the computation of its gradient.}, - doi = {https://doi.org/10.1016/j.jmaa.2018.05.048}, - keywords = {Parameter identification, Stochastic differential equation, State space model, Likelihood function, Adjoint method}, - url = {http://www.sciencedirect.com/science/article/pii/S0022247X18304414}, -} +@article{KaltenbacherPed2018, + Abstract = {In this paper we consider the problem of identifying parameters in stochastic differential equations. For this purpose, we transform the originally stochastic and nonlinear state equation to a deterministic linear partial differential equation for the transition probability density. We provide an appropriate likelihood cost function for parameter fitting, and derive an adjoint based approach for the computation of its gradient.}, + Author = {Barbara Kaltenbacher and Barbara Pedretscher}, + Doi = {https://doi.org/10.1016/j.jmaa.2018.05.048}, + Issn = {0022-247X}, + Journal = {Journal of Mathematical Analysis and Applications}, + Keywords = {Parameter identification, Stochastic differential equation, State space model, Likelihood function, Adjoint method}, + Number = {2}, + Pages = {872 - 884}, + Title = {Parameter estimation in SDEs via the Fokker--Planck equation: Likelihood function and adjoint based gradient computation}, + Url = {http://www.sciencedirect.com/science/article/pii/S0022247X18304414}, + Volume = {465}, + Year = {2018}, + Bdsk-Url-1 = {http://www.sciencedirect.com/science/article/pii/S0022247X18304414}, + Bdsk-Url-2 = {https://doi.org/10.1016/j.jmaa.2018.05.048}} -@InProceedings{10.1007/978-3-030-18174-1_14, +@InProceedings{NousiainenInt2019, author = {Nousiainen, Kari and Intosalmi, Jukka and L{\"a}hdesm{\"a}ki, Harri}, title = {A Mathematical Model for Enhancer Activation Kinetics During Cell Differentiation}, booktitle = {Algorithms for Computational Biology}, year = {2019}, - editor = {Holmes, Ian and Mart{\'i}n-Vide, Carlos and Vega-Rodr{\'i}guez, Miguel A.}, + editor = {Holmes, Ian and Mart{\'\i}n-Vide, Carlos and Vega-Rodr{\'\i}guez, Miguel A.}, pages = {191--202}, address = {Cham}, publisher = {Springer International Publishing}, @@ -412,4 +465,17 @@ @InProceedings{10.1007/978-3-030-18174-1_14 isbn = {978-3-030-18174-1}, } +@Article{SchmiesterSch2019, + author = {Schmiester, Leonard and Schälte, Yannik and Fröhlich, Fabian and Hasenauer, Jan and Weindl, Daniel}, + title = {{Efficient parameterization of large-scale dynamic models based on relative measurements}}, + journal = {Bioinformatics}, + year = {2019}, + month = {07}, + issn = {1367-4803}, + abstract = {{Mechanistic models of biochemical reaction networks facilitate the quantitative understanding of biological processes and the integration of heterogeneous datasets. However, some biological processes require the consideration of comprehensive reaction networks and therefore large-scale models. Parameter estimation for such models poses great challenges, in particular when the data are on a relative scale.Here, we propose a novel hierarchical approach combining (i) the efficient analytic evaluation of optimal scaling, offset, and error model parameters with (ii) the scalable evaluation of objective function gradients using adjoint sensitivity analysis. We evaluate the properties of the methods by parameterizing a pan-cancer ordinary differential equation model (\\>1000 state variables, \\>4000 parameters) using relative protein, phospho-protein and viability measurements. The hierarchical formulation improves optimizer performance considerably. Furthermore, we show that this approach allows estimating error model parameters with negligible computational overhead when no experimental estimates are available, providing an unbiased way to weight heterogeneous data. Overall, our hierarchical formulation is applicable to a wide range of models, and allows for the efficient parameterization of large-scale models based on heterogeneous relative measurements.Supplementary information are available at Bioinformatics online. Supplementary code and data are available online at http://doi.org/10.5281/zenodo.3254429 and http://doi.org/10.5281/zenodo.3254441.}}, + doi = {10.1093/bioinformatics/btz581}, + eprint = {http://oup.prod.sis.lan/bioinformatics/advance-article-pdf/doi/10.1093/bioinformatics/btz581/29004243/btz581.pdf}, + url = {https://doi.org/10.1093/bioinformatics/btz581}, +} + @Comment{jabref-meta: databaseType:bibtex;} diff --git a/documentation/recreate_reference_list.py b/documentation/recreate_reference_list.py index 97890fa002..792d698bdb 100755 --- a/documentation/recreate_reference_list.py +++ b/documentation/recreate_reference_list.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 -"""Create AMICI publication list by year""" +"""Create AMICI publication list by year + For macOS with clang: download and install biblib-simple to avoid compiler issues + Requires pandoc""" import biblib.bib import biblib.messages diff --git a/documentation/references.md b/documentation/references.md index f9a3b23fff..d2e1239366 100644 --- a/documentation/references.md +++ b/documentation/references.md @@ -1,23 +1,38 @@ # References -List of publications using AMICI. Total number is 28. +List of publications using AMICI. Total number is 32.

2019

Dharmarajan, Lekshmi, Hans-Michael Kaltenbach, Fabian Rudolf, and Joerg Stelling. 2019. “A Simple and Flexible Computational Framework for Inferring Sources of Heterogeneity from Single-Cell Dynamics.” Cell Systems 8 (1). Elsevier: 15–26.e11. https://doi.org/10.1016/j.cels.2018.12.007.

+
+

Fischer, David S., Anna K. Fiedler, Eric Kernfeld, Ryan M. J. Genga, Aimée Bastidas-Ponce, Mostafa Bakhti, Heiko Lickert, Jan Hasenauer, Rene Maehr, and Fabian J. Theis. 2019. “Inferring Population Dynamics from Single-Cell Rna-Sequencing Time Series Data.” Nature Biotechnology 37: 461–68. https://doi.org/10.1038/s41587-019-0088-0.

+

Gregg, Robert W, Saumendra N Sarkar, and Jason E Shoemaker. 2019. “Mathematical Modeling of the cGAS Pathway Reveals Robustness of Dna Sensing to Trex1 Feedback.” Journal of Theoretical Biology 462 (February): 148–57. https://doi.org/10.1016/j.jtbi.2018.11.001.

-
+
+

Kapfer, Eva-Maria, Paul Stapor, and Jan Hasenauer. 2019. “Challenges in the Calibration of Large-Scale Ordinary Differential Equation Models.” Accepted for Publication in Proc. Of the Foundations of Syst. Biol. In Engin. (FOSBE).

+
+
+

Lines, Glenn Terje, Lukasz Paszkowski, Leonard Schmiester, Daniel Weindl, Paul Stapor, and Jan Hasenauer. 2019. “Efficient Computation of Steady States in Large-Scale Ode Models of Biochemical Reaction Networks.” Accepted for Publication in Proc. Of the Foundations of Syst. Biol. In Engin. (FOSBE).

+
+

Nousiainen, Kari, Jukka Intosalmi, and Harri Lähdesmäki. 2019. “A Mathematical Model for Enhancer Activation Kinetics During Cell Differentiation.” In Algorithms for Computational Biology, edited by Ian Holmes, Carlos Martín-Vide, and Miguel A. Vega-Rodríguez, 191–202. Cham: Springer International Publishing.

Pitt, Jake Alan, and Julio R Banga. 2019. “Parameter Estimation in Models of Biological Oscillators: An Automated Regularised Estimation Approach.” BMC Bioinformatics 20 (1): 82. https://doi.org/10.1186/s12859-019-2630-y.

-

Schmiester, Leonard, Yannik Schaelte, Fabian Froehlich, Jan Hasenauer, and Daniel Weindl. 2019. “Efficient Parameterization of Large-Scale Dynamic Models Based on Relative Measurements.” bioRxiv. Cold Spring Harbor Laboratory. https://doi.org/10.1101/579045.

+

Schmiester, Leonard, Yannik Schälte, Fabian Fröhlich, Jan Hasenauer, and Daniel Weindl. 2019. “Efficient parameterization of large-scale dynamic models based on relative measurements.” Bioinformatics, July. https://doi.org/10.1093/bioinformatics/btz581.

+
+
+

Villaverde, Alejandro F., Elba Raimúndez, Jan Hasenauer, and Julio R. Banga. 2019. “A Comparison of Methods for Quantifying Prediction Uncertainty in Systems Biology.” Accepted for Publication in Proc. Of the Foundations of Syst. Biol. In Engin. (FOSBE).

+
+
+

Wang, Dantong, Paul Stapor, and Jan Hasenauer. 2019. “Dirac Mixture Distributions for the Approximation of Mixed Effects Models.” Accepted for Publication in Proc. Of the Foundations of Syst. Biol. In Engin. (FOSBE).

2018

@@ -41,7 +56,7 @@ List of publications using AMICI. Total number is 28.

Loos, Carolin, Katharina Moeller, Fabian Fröhlich, Tim Hucho, and Jan Hasenauer. 2018. “A Hierarchical, Data-Driven Approach to Modeling Single-Cell Populations Predicts Latent Causes of Cell-to-Cell Variability.” Cell Systems 6 (5). Elsevier: 593–603. https://doi.org/10.1016/j.cels.2018.04.008.

-

Schälte, Y., P. Stapor, and J. Hasenauer. 2018. “Evaluation of Derivative-Free Optimizers for Parameter Estimation in Systems Biology.” To Appear in Proc. Of the Foundations of Syst. Biol. In Engin. (FOSBE).

+

Schälte, Y., P. Stapor, and J. Hasenauer. 2018. “Evaluation of Derivative-Free Optimizers for Parameter Estimation in Systems Biology.” FAC-PapersOnLine 51 (19): 98–101.

Stapor, Paul, Fabian Fröhlich, and Jan Hasenauer. 2018. “Optimization and Profile Calculation of ODE Models Using Second Order Adjoint Sensitivity Analysis.” Bioinformatics 34 (13). Oxford University Press: i151–i159.

@@ -55,9 +70,6 @@ List of publications using AMICI. Total number is 28.

Ballnus, B., S. Hug, K. Hatz, L. Görlitz, J. Hasenauer, and F. J. Theis. 2017. “Comprehensive Benchmarking of Markov Chain Monte Carlo Methods for Dynamical Systems.” BMC Syst. Biol. 11 (63). https://doi.org/10.1186/s12918-017-0433-1.

-
-

Fischer, David S., Anna K. Fiedler, Eric Kernfeld, Ryan M. J. Genga, Jan Hasenauer, Rene Maehr, and Fabian J. Theis. 2017. “Beyond Pseudotime: Following T-Cell Maturation in Single-Cell RNAseq Time Series.” bioRxiv. Cold Spring Harbor Laboratory. https://doi.org/10.1101/219188.

-

Fröhlich, Fabian, Thomas Kessler, Daniel Weindl, Alexey Shadrin, Leonard Schmiester, Hendrik Hache, Artur Muradyan, et al. 2017. “Efficient Parameterization of Large-Scale Mechanistic Models Enables Drug Response Prediction for Cancer Cell Lines.” bioRxiv. Cold Spring Harbor Labs Journals. https://doi.org/10.1101/174094.

From 72479d97ef278f4775f28898818aadd1d80fe287 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Fri, 26 Jul 2019 12:01:04 +0200 Subject: [PATCH 02/13] Allow overriding cmake executable with environment variables in build scripts (Closes #738) --- INSTALL.md | 5 +++++ scripts/buildAmici.sh | 8 +++++--- scripts/buildCpputest.sh | 7 +++++-- scripts/buildModel.sh | 7 +++++-- scripts/buildSundials.sh | 9 ++++++--- scripts/buildXcode.sh | 7 +++++-- 6 files changed, 31 insertions(+), 12 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 26fc235574..48592f2811 100755 --- a/INSTALL.md +++ b/INSTALL.md @@ -219,6 +219,11 @@ To use AMICI from C++, run the script to compile AMICI library. +**NOTE**: On some systems, the CMake executable may be named something +other than `cmake`. In this case, set the `CMAKE` environment variable +to the correct name (e.g. `export CMAKE=cmake3`, in case you have CMake +available as `cmake3`). + The static library file can then be linked from ./build/libamici.a diff --git a/scripts/buildAmici.sh b/scripts/buildAmici.sh index 19a5ca89c3..82d9e7b084 100755 --- a/scripts/buildAmici.sh +++ b/scripts/buildAmici.sh @@ -3,6 +3,8 @@ # Build libamici # set -e +CMAKE=${CMAKE:-cmake} +MAKE=${MAKE:-make} SCRIPT_PATH=$(dirname $BASH_SOURCE) AMICI_PATH=$(cd $SCRIPT_PATH/.. && pwd) @@ -10,8 +12,8 @@ AMICI_PATH=$(cd $SCRIPT_PATH/.. && pwd) mkdir -p ${AMICI_PATH}/build cd ${AMICI_PATH}/build CPPUTEST_BUILD_DIR=${AMICI_PATH}/ThirdParty/cpputest-master/build/ -CppUTest_DIR=${CPPUTEST_BUILD_DIR} cmake -DCMAKE_BUILD_TYPE=Debug .. -make +CppUTest_DIR=${CPPUTEST_BUILD_DIR} ${CMAKE} -DCMAKE_BUILD_TYPE=Debug .. +${MAKE} -make python-sdist +${MAKE} python-sdist set -x diff --git a/scripts/buildCpputest.sh b/scripts/buildCpputest.sh index b29bde70b0..cee5f0b149 100755 --- a/scripts/buildCpputest.sh +++ b/scripts/buildCpputest.sh @@ -7,6 +7,9 @@ set -e SCRIPT_PATH=$(dirname $BASH_SOURCE) AMICI_PATH=$(cd $SCRIPT_PATH/.. && pwd) +CMAKE=${CMAKE:-cmake} +MAKE=${MAKE:-make} + # Cpputest mkdir -p ${AMICI_PATH}/ThirdParty cd ${AMICI_PATH}/ThirdParty @@ -23,6 +26,6 @@ fi cd cpputest-master mkdir -p build cd build -cmake -DTESTS=OFF -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DC++11=ON -DMEMORY_LEAK_DETECTION=OFF .. -make -j4 +${CMAKE} -DTESTS=OFF -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DC++11=ON -DMEMORY_LEAK_DETECTION=OFF .. +${MAKE} -j4 diff --git a/scripts/buildModel.sh b/scripts/buildModel.sh index f2c235b936..617c962fd0 100755 --- a/scripts/buildModel.sh +++ b/scripts/buildModel.sh @@ -7,8 +7,11 @@ set -e SCRIPT_PATH=$(dirname $BASH_SOURCE) AMICI_PATH=$(cd $SCRIPT_PATH/.. && pwd) +CMAKE=${CMAKE:-cmake} +MAKE=${MAKE:-make} + mkdir -p ${AMICI_PATH}/models/$1/build cd ${AMICI_PATH}/models/$1/build -cmake -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_BUILD_TYPE=Release .. -make +${CMAKE} -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_BUILD_TYPE=Release .. +${MAKE} diff --git a/scripts/buildSundials.sh b/scripts/buildSundials.sh index 3fa05920cf..173e7c7b33 100755 --- a/scripts/buildSundials.sh +++ b/scripts/buildSundials.sh @@ -10,6 +10,9 @@ AMICI_PATH=$(cd $SCRIPT_PATH/.. && pwd) SUITESPARSE_ROOT="${AMICI_PATH}/ThirdParty/SuiteSparse" SUNDIALS_BUILD_PATH="${AMICI_PATH}/ThirdParty/sundials/build/" +CMAKE=${CMAKE:-cmake} +MAKE=${MAKE:-make} + # enable SuperLUMT support if library exists SuperLUMT="" if [[ -f ${AMICI_PATH}/ThirdParty/SuperLU_MT_3.1/lib/libsuperlu_mt_PTHREAD.a ]] @@ -22,7 +25,7 @@ fi mkdir -p ${SUNDIALS_BUILD_PATH} cd ${SUNDIALS_BUILD_PATH} -cmake -DCMAKE_INSTALL_PREFIX="${SUNDIALS_BUILD_PATH}" \ +${CMAKE} -DCMAKE_INSTALL_PREFIX="${SUNDIALS_BUILD_PATH}" \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DBUILD_ARKODE=OFF \ @@ -39,5 +42,5 @@ cmake -DCMAKE_INSTALL_PREFIX="${SUNDIALS_BUILD_PATH}" \ ${SuperLUMT} \ .. -make -make install +${MAKE} +${MAKE} install diff --git a/scripts/buildXcode.sh b/scripts/buildXcode.sh index 6bfcba9092..d78edde4bd 100755 --- a/scripts/buildXcode.sh +++ b/scripts/buildXcode.sh @@ -7,6 +7,8 @@ set -e SCRIPT_PATH=$(dirname $BASH_SOURCE) AMICI_PATH=$(cd $SCRIPT_PATH/.. && pwd) +CMAKE=${CMAKE:-cmake} + ${AMICI_PATH}/scripts/buildSuiteSparse.sh ${AMICI_PATH}/scripts/buildSundials.sh ${AMICI_PATH}/scripts/buildAmici.sh @@ -18,9 +20,10 @@ cp ${AMICI_PATH}/tests/cpputest/expectedResults.h5 ./expectedResults.h5 mkdir -p ${AMICI_PATH}/build_xcode cd ${AMICI_PATH}/build_xcode CPPUTEST_BUILD_DIR=${AMICI_PATH}/ThirdParty/cpputest-master/build/ -CppUTest_DIR=${CPPUTEST_BUILD_DIR} cmake -G"Xcode" -DCMAKE_BUILD_TYPE=Debug .. +CppUTest_DIR=${CPPUTEST_BUILD_DIR} ${CMAKE} -G"Xcode" -DCMAKE_BUILD_TYPE=Debug .. for model in steadystate robertson neuron neuron_o2 jakstat_adjoint jakstat_adjoint_o2 dirac events nested_events do - cp ${AMICI_PATH}/build/tests/cpputest/external_model_${model}-prefix/src/external_model_${model}-build/libmodel_${model}.a ${AMICI_PATH}/build_xcode/tests/cpputest/external_model_${model}-prefix/src/external_model_${model}-build/libmodel_${model}.a + cp ${AMICI_PATH}/build/tests/cpputest/external_model_${model}-prefix/src/external_model_${model}-build/libmodel_${model}.a \ + ${AMICI_PATH}/build_xcode/tests/cpputest/external_model_${model}-prefix/src/external_model_${model}-build/libmodel_${model}.a done From 4a1752fd72d6b4fd6653a98cf8199f57c5af52e9 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Fri, 26 Jul 2019 12:32:55 +0200 Subject: [PATCH 03/13] Document environment variables for model/core compilation (Closes #737) --- INSTALL.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index 48592f2811..b1235ee586 100755 --- a/INSTALL.md +++ b/INSTALL.md @@ -47,6 +47,8 @@ You can now import it as python module: import amici +For cases where this installation fails, check below for special setups +and custom installations. For Python-AMICI usage see [https://github.com/ICB-DCM/AMICI/blob/master/documentation/PYTHON.md](https://github.com/ICB-DCM/AMICI/blob/master/documentation/PYTHON.md). @@ -181,6 +183,21 @@ Possible sources of errors: [DependencyWalker](http://www.dependencywalker.com/) will show you which ones. +### Custom installation + +AMICI Python package installation can be customized using a number of +environment variables: + +|Variable | Purpose | Example | +|---|---|---| +|`CC`| Setting the C(++) compiler | `CC=/usr/bin/g++`| +|`CFLAGS`| Extra compiler flags used in every compiler call | | +|`BLAS_CFLAGS`| Compiler flags for, e.g. BLAS include directories | | +|`BLAS_LIBS`| Flags for linking BLAS | | +|`ENABLE_GCOV_COVERAGE`| Set to build AMICI to provide code coverage information | `ENABLE_GCOV_COVERAGE=TRUE`| +|`ENABLE_AMICI_DEBUGGING`| Set to build AMICI with debugging symbols | `ENABLE_AMICI_DEBUGGING=TRUE`| +|`AMICI_PARALLEL_COMPILE`| Set to the number of parallel processes to be used for C(++) file compilation (defaults to 1)| `AMICI_PARALLEL_COMPILE=4`| + ## MATLAB From 787365662b27c3e34f0525844fed841d2a755f2b Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 30 Jul 2019 09:18:48 +0200 Subject: [PATCH 04/13] Find / build SWIG (#744) * Add SWIG download and build script * Improve finding swig executable and allow user override via SWIG environment variable Provide installation hints if no SWIG found (Closes #724) * Update doc for SWIG build and custom SWIG location. --- .gitignore | 1 + INSTALL.md | 18 ++++++++++--- python/amici/setuptools.py | 16 +++-------- python/sdist/amici/swig.py | 47 +++++++++++++++++++++++++++++++++ scripts/downloadAndBuildSwig.sh | 36 +++++++++++++++++++++++++ 5 files changed, 102 insertions(+), 16 deletions(-) create mode 100644 python/sdist/amici/swig.py create mode 100755 scripts/downloadAndBuildSwig.sh diff --git a/.gitignore b/.gitignore index 0eab397543..772a153645 100644 --- a/.gitignore +++ b/.gitignore @@ -160,3 +160,4 @@ ThirdParty/SuiteSparse/lib/* ThirdParty/SuiteSparse/share/* ThirdParty/SuperLU_MT_3.1/ ThirdParty/superlu_mt_3.1.tar.gz +ThirdParty/swig-* diff --git a/INSTALL.md b/INSTALL.md index b1235ee586..e8ddcee092 100755 --- a/INSTALL.md +++ b/INSTALL.md @@ -333,8 +333,9 @@ or #### SWIG The python interface requires [SWIG](http://www.swig.org), which has to -be installed by the user. Swig can be installed using package managers -such as [brew](https://brew.sh) or [apt](https://wiki.debian.org/Apt): +be installed by the user. As root user, SWIG can be installed using +package managers such as [brew](https://brew.sh) or +[apt](https://wiki.debian.org/Apt): brew install swig @@ -342,12 +343,23 @@ or apt-get install swig3.0 +Or by non-root users, using `scripts/downloadAndBuildSwig.sh` from the +AMICI repository (not included in the PyPI package). The binary +directory has to be added to the `PATH` environment variable, or `SWIG` +has to be set as described in the following section. + + +##### Using a non-default SWIG executable + We note here that some linux package managers may provide swig executables as `swig3.0`, but installation as `swig` is required. This -can be fixed using, e.g., symbolic links: +can be fixed as root user using, e.g., symbolic links: mkdir -p ~/bin/ && ln -s $(which swig3.0) ~/bin/swig && export PATH=~/bin/:$PATH +Non-root users can set the `SWIG` environment variable to the full +path of the desired SWIG executable. This variable has be set during +AMICI package installation as well as during model compilation. ### Matlab diff --git a/python/amici/setuptools.py b/python/amici/setuptools.py index f912ebcad0..fa15b8580a 100644 --- a/python/amici/setuptools.py +++ b/python/amici/setuptools.py @@ -3,10 +3,11 @@ import os import platform import shlex -import sys import subprocess import shutil +from .swig import find_swig + try: import pkgconfig # optional # pkgconfig python module might be installed without pkg-config binary being available @@ -165,7 +166,7 @@ def generateSwigInterfaceFiles(): """Compile the swig python interface to amici """ swig_outdir = '%s/amici' % os.path.abspath(os.getcwd()) - swig_cmd = findSwig() + swig_cmd = find_swig() sp = subprocess.run([swig_cmd, '-c++', '-python', @@ -185,14 +186,3 @@ def generateSwigInterfaceFiles(): '-o', 'amici/amici_wrap.cxx', 'amici/swig/amici.i']) assert (sp.returncode == 0) - - -def findSwig(): - """Get name of SWIG executable - - We need version 3.0. - Probably we should try some default paths and names, but this should do the trick for now. - Debian/Ubuntu systems have swig3.0 ('swig' is older versions), OSX has swig 3.0 as 'swig'.""" - if sys.platform != 'linux': - return 'swig' - return 'swig3.0' diff --git a/python/sdist/amici/swig.py b/python/sdist/amici/swig.py new file mode 100644 index 0000000000..c0e5bdf7da --- /dev/null +++ b/python/sdist/amici/swig.py @@ -0,0 +1,47 @@ +"""Functions for downloading/building/finding SWIG""" + +import sys +import os +import subprocess + + +def find_swig(): + """Get name of SWIG executable + + We need version >=3.0. Probably we should try some default paths and names, + but this should do the trick for now. + + Debian/Ubuntu systems have swig3.0 ('swig' is older versions), + OSX has swig 3.0 as 'swig'.""" + + candidates = ['swig4.0', 'swig3.0', 'swig'] + # Environment variable has priority + if 'SWIG' in os.environ: + candidates.insert(0, os.environ['SWIG']) + + for candidate in candidates: + if swig_works(candidate): + return candidate + + raise RuntimeError("Unable to find SWIG executable with default names." + "Ensure you have SWIG installed, e.g. by " + "`sudo apt install swig3.0` or `brew install swig`." + "As non-root user, you can install SWIG using " + "https://github.com/ICB-DCM/AMICI/blob/master/scripts/" + "downloadAndBuildSwig.sh, or by following the " + "instructions at http://www.swig.org/Doc4.0/" + "SWIGDocumentation.html#Preface_installation." + "If was not found despite being installed, set the SWIG" + " environment variable to the full path of the correct" + "executable.") + + +def swig_works(swig): + """Test if `swig` looks like a working SWIG executable.""" + + try: + result = subprocess.run([swig, '-version'], capture_output=True) + except FileNotFoundError: + return False + + return result.returncode == 0 diff --git a/scripts/downloadAndBuildSwig.sh b/scripts/downloadAndBuildSwig.sh new file mode 100755 index 0000000000..83dd5305d0 --- /dev/null +++ b/scripts/downloadAndBuildSwig.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# Download and build SWIG +set -e + +SCRIPT_PATH=$(dirname $BASH_SOURCE) +AMICI_PATH=$(cd $SCRIPT_PATH/.. && pwd) + +SWIG_URL='http://prdownloads.sourceforge.net/swig/swig-4.0.0.tar.gz' +SWIG_ARCHIVE='swig-4.0.0.tar.gz' +SWIG_DIR='swig-4.0.0' +PREFIX=${AMICI_PATH}/ThirdParty/${SWIG_DIR}/install +SWIG_BIN_DIR=${PREFIX}/bin + +cd ${AMICI_PATH}/ThirdParty/ + +if [[ ! -d ${SWIG_DIR} ]]; then + if [[ ! -f ${SWIG_ARCHIVE} ]] + then wget ${SWIG_URL} + fi + + tar -xzf ${SWIG_ARCHIVE} +fi + +cd ${SWIG_DIR} +./configure --prefix=${PREFIX} +make +make install + +echo +echo "================" +echo "SWIG installation successful" +echo +echo "To use this version of SWIG, add directory ${SWIG_BIN_DIR} to your PATH," +echo "e.g. adding the following line to your .bashrc:" +echo " export PATH=\$PATH:${SWIG_BIN_DIR}" +echo "================" From f9ad19512ec1ecc833cb431982662d1dcc9e1040 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 30 Jul 2019 13:03:46 +0200 Subject: [PATCH 05/13] Handle OSTYPE==linux in scripts/buildBNGL.sh (Fixes #751) --- scripts/buildBNGL.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/buildBNGL.sh b/scripts/buildBNGL.sh index 5140a021f8..ce36921c00 100755 --- a/scripts/buildBNGL.sh +++ b/scripts/buildBNGL.sh @@ -12,7 +12,7 @@ cd ${AMICI_PATH}/ThirdParty if [ ! -d "BioNetGen-2.3.2" ]; then if [ ! -e "bionetgen.tar.gz" ]; then - if [[ "$OSTYPE" == "linux-gnu" ]]; then + if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]]; then wget -q -O bionetgen.tar.gz https://bintray.com/jczech/bionetgen/download_file?file_path=BioNetGen-2.3.2-linux.tar.gz elif [[ "$OSTYPE" == "darwin"* ]]; then wget -q -O bionetgen.tar.gz https://bintray.com/jczech/bionetgen/download_file?file_path=BioNetGen-2.3.2-osx.tar.gz From 5071b345365acb5d7bbc38ba1928765803749f52 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 30 Jul 2019 17:50:05 +0200 Subject: [PATCH 06/13] Fix system-dependent sundials library directory (Fixes #749) (#750) --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b6f0d78d7c..774b36611d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,7 @@ foreach(FLAG ${MY_CXX_FLAGS}) endforeach(FLAG) # find dependencies +include(GNUInstallDirs) find_package(HDF5 COMPONENTS C HL CXX REQUIRED) set(HDF5_LIBRARIES ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES} ${HDF5_CXX_LIBRARIES}) set(SUITESPARSE_DIR "${CMAKE_SOURCE_DIR}/ThirdParty/SuiteSparse/") @@ -48,7 +49,7 @@ set(SUITESPARSE_LIBRARIES ${SUITESPARSE_DIR}/SuiteSparse_config/libsuitesparseconfig${CMAKE_STATIC_LIBRARY_SUFFIX} ) -set(SUNDIALS_LIB_DIR "${CMAKE_SOURCE_DIR}/ThirdParty/sundials/build/lib") +set(SUNDIALS_LIB_DIR "${CMAKE_SOURCE_DIR}/ThirdParty/sundials/build/${CMAKE_INSTALL_LIBDIR}") set(SUNDIALS_LIBRARIES ${SUNDIALS_LIB_DIR}/libsundials_nvecserial${CMAKE_STATIC_LIBRARY_SUFFIX} ${SUNDIALS_LIB_DIR}/libsundials_sunlinsolband${CMAKE_STATIC_LIBRARY_SUFFIX} @@ -178,7 +179,6 @@ set(AUTHORS "Fabian Froehlich, Jan Hasenauer, Daniel Weindl and Paul Stapor") set(AUTHOR_EMAIL "fabian.froehlich@helmholtz-muenchen.de") # -include(GNUInstallDirs) install(TARGETS ${PROJECT_NAME} EXPORT AmiciTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} From 54ba534245d153747374163cbb19354d01be77bf Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 30 Jul 2019 19:26:15 +0200 Subject: [PATCH 07/13] Update BLAS and HDF5 detection from Python (#741) * Do not always add 'cblas' library since users may want to override that by a cblas-compatible library with a different name (closes #736) * Update HDF5 path hints; use shared library if static is not available. * Fall back to -lcblas * Check for HDF5_BASE from environment module --- python/amici/setuptools.py | 50 +++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/python/amici/setuptools.py b/python/amici/setuptools.py index fa15b8580a..78206a8569 100644 --- a/python/amici/setuptools.py +++ b/python/amici/setuptools.py @@ -36,15 +36,7 @@ def getBlasConfig(): 'extra_link_args': [] } - if platform.system() in ['Linux', 'Darwin']: - blaspkgcfg['libraries'] = ['cblas'] - - if pkgconfig: - if pkgconfig.exists('cblas'): - blaspkgcfg = pkgconfig.parse('cblas') - blaspkgcfg['extra_compile_args'] = [pkgconfig.cflags('cblas')] - blaspkgcfg['extra_link_args'] = [pkgconfig.libs('cblas')] - + # Check environment variables if 'BLAS_CFLAGS' in os.environ: blaspkgcfg['extra_compile_args'].extend( shlex.split(os.environ['BLAS_CFLAGS']) @@ -55,6 +47,23 @@ def getBlasConfig(): shlex.split(os.environ['BLAS_LIBS']) ) + if 'BLAS_CFLAGS' in os.environ or 'BLAS_LIBS' in os.environ: + # If options have been provided by the user, we don't try to detect + # anything by ourselves + return blaspkgcfg + + # Try pkgconfig + if pkgconfig: + if pkgconfig.exists('cblas'): + blaspkgcfg = pkgconfig.parse('cblas') + blaspkgcfg['extra_compile_args'] = [pkgconfig.cflags('cblas')] + blaspkgcfg['extra_link_args'] = [pkgconfig.libs('cblas')] + + return blaspkgcfg + + # If none of the previous worked, fall back to libcblas in default paths + blaspkgcfg['libraries'] = ['cblas'] + return blaspkgcfg @@ -91,16 +100,24 @@ def getHdf5Config(): hdf5_include_dir_hints = [ '/usr/include/hdf5/serial', '/usr/local/include', - '/usr/include', # travis ubuntu xenial + '/usr/include', # travis ubuntu xenial, centos '/usr/local/Cellar/hdf5/1.10.2_1/include' # travis macOS ] hdf5_library_dir_hints = [ '/usr/lib/x86_64-linux-gnu/', # travis ubuntu xenial '/usr/lib/x86_64-linux-gnu/hdf5/serial', '/usr/local/lib', + '/usr/lib64/', # CentOS '/usr/local/Cellar/hdf5/1.10.2_1/lib' # travis macOS ] + # Check for Environment Modules variables + if 'HDF5_BASE' in os.environ: + hdf5_include_dir_hints.insert( + 0, os.path.join(os.environ['HDF5_BASE'], 'include')) + hdf5_library_dir_hints.insert( + 0, os.path.join(os.environ['HDF5_BASE'], 'lib')) + for hdf5_include_dir_hint in hdf5_include_dir_hints: hdf5_include_dir_found = os.path.isfile( os.path.join(hdf5_include_dir_hint, 'hdf5.h')) @@ -110,11 +127,16 @@ def getHdf5Config(): break for hdf5_library_dir_hint in hdf5_library_dir_hints: - hdf5_library_dir_found = os.path.isfile( - os.path.join(hdf5_library_dir_hint, 'libhdf5.a')) + # check for static or shared library + for lib_filename in ['libhdf5.a', 'libhdf5.so']: + hdf5_library_dir_found = os.path.isfile( + os.path.join(hdf5_library_dir_hint, lib_filename)) + if hdf5_library_dir_found: + print(f'{lib_filename} found in {hdf5_library_dir_hint}') + h5pkgcfg['library_dirs'] = [hdf5_library_dir_hint] + break if hdf5_library_dir_found: - print('libhdf5.a found in %s' % hdf5_library_dir_hint) - h5pkgcfg['library_dirs'] = [hdf5_library_dir_hint] + # break to not override hdf5_library_dir_found break h5pkgcfg['found'] = hdf5_include_dir_found and hdf5_library_dir_found From 44e49cb4e315742cbbd86f714953dada605497f9 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 30 Jul 2019 22:33:54 +0200 Subject: [PATCH 08/13] Simplify AMICI installation (#753) * cmake: Use package_ROOT environment variables * fix(cmake) Fix finding version.txt * cmake: Auto-detect loaded MKL environment module * cmake: Use new FindPython3 modules where possible * fix(python) Restore python3.6 compatibility * Inside venv, use pip instead of pip3 which should point to the correct version * fix(python) Workaround for missing ensurepip during venv creation [ci skip] * feature(python) Use MKL from environment modules to provide cblas * fix(python) Fix define_macros not being passed to setuptools for Extension * fix(python) Fix define_macros not being passed to setuptools for clibs * Regenerate matlab models --- CMakeLists.txt | 20 +++++++++++--- cmake/version.cmake | 6 ++++- models/model_calvetti/CMakeLists.txt | 2 +- models/model_calvetti/model_calvetti.h | 4 +-- models/model_calvetti/swig/CMakeLists.txt | 27 +++++++++++++++---- models/model_dirac/CMakeLists.txt | 3 ++- models/model_dirac/model_dirac.h | 4 +-- models/model_dirac/swig/CMakeLists.txt | 27 +++++++++++++++---- models/model_events/CMakeLists.txt | 3 ++- models/model_events/model_events.h | 4 +-- models/model_events/swig/CMakeLists.txt | 27 +++++++++++++++---- models/model_jakstat_adjoint/CMakeLists.txt | 3 ++- .../model_jakstat_adjoint.h | 4 +-- .../model_jakstat_adjoint/swig/CMakeLists.txt | 27 +++++++++++++++---- .../model_jakstat_adjoint_o2/CMakeLists.txt | 3 ++- .../model_jakstat_adjoint_o2.h | 4 +-- .../swig/CMakeLists.txt | 27 +++++++++++++++---- models/model_nested_events/CMakeLists.txt | 3 ++- .../model_nested_events/model_nested_events.h | 4 +-- .../model_nested_events/swig/CMakeLists.txt | 27 +++++++++++++++---- models/model_neuron/CMakeLists.txt | 3 ++- models/model_neuron/model_neuron.h | 4 +-- models/model_neuron/model_neuron_deltaqB.cpp | 4 +-- models/model_neuron/swig/CMakeLists.txt | 27 +++++++++++++++---- models/model_neuron_o2/CMakeLists.txt | 3 ++- models/model_neuron_o2/model_neuron_o2.h | 4 +-- .../model_neuron_o2_deltaqB.cpp | 8 +++--- models/model_neuron_o2/swig/CMakeLists.txt | 27 +++++++++++++++---- models/model_robertson/CMakeLists.txt | 3 ++- models/model_robertson/model_robertson.h | 4 +-- models/model_robertson/swig/CMakeLists.txt | 27 +++++++++++++++---- models/model_steadystate/CMakeLists.txt | 3 ++- models/model_steadystate/model_steadystate.h | 4 +-- models/model_steadystate/swig/CMakeLists.txt | 27 +++++++++++++++---- python/CMakeLists.txt | 20 +++++++++----- python/amici/setuptools.py | 15 +++++++++++ python/sdist/amici/swig.py | 7 +++-- python/sdist/setup.py | 2 ++ python/sdist/setup_clibs.py | 13 +++++++-- scripts/installAmiciArchive.sh | 19 ++++++++++--- scripts/installAmiciSource.sh | 21 ++++++++++++--- swig/CMakeLists_model.cmake | 27 +++++++++++++++---- 42 files changed, 387 insertions(+), 114 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 774b36611d..7311600352 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,10 @@ endif(POLICY CMP0065) if(POLICY CMP0077) cmake_policy(SET CMP0077 NEW) endif(POLICY CMP0077) +if(POLICY CMP0074) + # Use package_ROOT environment variables + cmake_policy(SET CMP0074 NEW) +endif(POLICY CMP0074) project(amici) @@ -84,14 +88,22 @@ set(GSL_LITE_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/ThirdParty/gsl") # 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") -add_definitions(-DAMICI_BLAS_${BLAS}) -if(${BLAS} STREQUAL "MKL") - set(BLAS_INCLUDE_DIRS "" CACHE STRING "") - set(BLAS_LIBRARIES -lmkl CACHE STRING "") +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() else() set(BLAS_INCLUDE_DIRS "" CACHE STRING "") set(BLAS_LIBRARIES -lcblas CACHE STRING "") endif() +add_definitions(-DAMICI_BLAS_${BLAS}) # Add target to create version file add_custom_target( diff --git a/cmake/version.cmake b/cmake/version.cmake index 6e16787f96..ebc391e576 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -6,7 +6,11 @@ if(Git_FOUND) ) endif() +# get project root directory +get_filename_component(CMAKE_PARENT_LIST_DIR ${CMAKE_PARENT_LIST_FILE} DIRECTORY) +get_filename_component(CMAKE_PARENT_LIST_DIR ${CMAKE_PARENT_LIST_DIR} DIRECTORY) + execute_process(COMMAND sh -c "cat version.txt | tr -d '\n'" - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + WORKING_DIRECTORY "${CMAKE_PARENT_LIST_DIR}" OUTPUT_VARIABLE PROJECT_VERSION ) diff --git a/models/model_calvetti/CMakeLists.txt b/models/model_calvetti/CMakeLists.txt index 854aec73a2..26b63a33a9 100644 --- a/models/model_calvetti/CMakeLists.txt +++ b/models/model_calvetti/CMakeLists.txt @@ -23,7 +23,7 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) diff --git a/models/model_calvetti/model_calvetti.h b/models/model_calvetti/model_calvetti.h index 97d201b047..bffbd0ffd4 100644 --- a/models/model_calvetti/model_calvetti.h +++ b/models/model_calvetti/model_calvetti.h @@ -1,6 +1,6 @@ #ifndef _amici_model_calvetti_h #define _amici_model_calvetti_h -/* Generated by amiwrap (R2017b) 6a604c72d192e6f8726862b089ad2c0adb456a38 */ +/* Generated by amiwrap (R2017b) 5afd3fccf92ca20486e1bbaa4a50343b107e239c */ #include #include #include "amici/defines.h" @@ -61,7 +61,7 @@ class Model_model_calvetti : public amici::Model_DAE { virtual amici::Model* clone() const override { return new Model_model_calvetti(*this); }; - const std::string getAmiciCommit() const override { return "6a604c72d192e6f8726862b089ad2c0adb456a38"; }; + const std::string getAmiciCommit() const override { return "5afd3fccf92ca20486e1bbaa4a50343b107e239c"; }; virtual void fJ(realtype *J, const realtype t, const realtype *x, const double *p, const double *k, const realtype *h, const realtype cj, const realtype *dx, const realtype *w, const realtype *dwdx) override { J_model_calvetti(J, t, x, p, k, h, cj, dx, w, dwdx); diff --git a/models/model_calvetti/swig/CMakeLists.txt b/models/model_calvetti/swig/CMakeLists.txt index 616cf5e437..af0f64a76e 100644 --- a/models/model_calvetti/swig/CMakeLists.txt +++ b/models/model_calvetti/swig/CMakeLists.txt @@ -3,12 +3,26 @@ cmake_minimum_required(VERSION 3.8) # swig_add_library if(POLICY CMP0078) cmake_policy(SET CMP0078 OLD) endif(POLICY CMP0078) +if(POLICY CMP0074) + # Use package_ROOT environment variables + cmake_policy(SET CMP0074 NEW) +endif(POLICY CMP0074) +if(POLICY CMP0086) + cmake_policy(SET CMP0086 NEW) +endif(POLICY CMP0086) + find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(PythonLibs REQUIRED) -include_directories(${PYTHON_INCLUDE_DIRS}) +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + find_package(PythonLibs REQUIRED) + include_directories(${PYTHON_INCLUDE_DIRS}) + set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) +else() + find_package (Python3 COMPONENTS Development) + include_directories(${Python3_INCLUDE_DIRS}) +endif() set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") @@ -18,11 +32,14 @@ set_source_files_properties(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) include_directories(${AMICI_INCLUDE_DIRS} ..) -swig_add_library(${PROJECT_NAME} TYPE MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) +swig_add_library(${PROJECT_NAME} + TYPE MODULE + LANGUAGE python + SOURCES ${PROJECT_NAME}.i) swig_link_libraries(${PROJECT_NAME} - ${PYTHON_LIBRARIES} - model) + ${Python3_LIBRARIES} + model) # configure module setup script set(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) diff --git a/models/model_dirac/CMakeLists.txt b/models/model_dirac/CMakeLists.txt index 79fe6eff98..2fbbab79a1 100644 --- a/models/model_dirac/CMakeLists.txt +++ b/models/model_dirac/CMakeLists.txt @@ -23,7 +23,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) diff --git a/models/model_dirac/model_dirac.h b/models/model_dirac/model_dirac.h index c239e42acb..839b28bb78 100644 --- a/models/model_dirac/model_dirac.h +++ b/models/model_dirac/model_dirac.h @@ -1,6 +1,6 @@ #ifndef _amici_model_dirac_h #define _amici_model_dirac_h -/* Generated by amiwrap (R2017b) d43d87529b7be0983c74fe22a73d8cf2b64bc286 */ +/* Generated by amiwrap (R2017b) 5afd3fccf92ca20486e1bbaa4a50343b107e239c */ #include #include #include "amici/defines.h" @@ -61,7 +61,7 @@ class Model_model_dirac : public amici::Model_ODE { virtual amici::Model* clone() const override { return new Model_model_dirac(*this); }; - const std::string getAmiciCommit() const override { return "d43d87529b7be0983c74fe22a73d8cf2b64bc286"; }; + const std::string getAmiciCommit() const override { return "5afd3fccf92ca20486e1bbaa4a50343b107e239c"; }; virtual void fJ(realtype *J, const realtype t, const realtype *x, const double *p, const double *k, const realtype *h, const realtype *w, const realtype *dwdx) override { J_model_dirac(J, t, x, p, k, h, w, dwdx); diff --git a/models/model_dirac/swig/CMakeLists.txt b/models/model_dirac/swig/CMakeLists.txt index 616cf5e437..af0f64a76e 100644 --- a/models/model_dirac/swig/CMakeLists.txt +++ b/models/model_dirac/swig/CMakeLists.txt @@ -3,12 +3,26 @@ cmake_minimum_required(VERSION 3.8) # swig_add_library if(POLICY CMP0078) cmake_policy(SET CMP0078 OLD) endif(POLICY CMP0078) +if(POLICY CMP0074) + # Use package_ROOT environment variables + cmake_policy(SET CMP0074 NEW) +endif(POLICY CMP0074) +if(POLICY CMP0086) + cmake_policy(SET CMP0086 NEW) +endif(POLICY CMP0086) + find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(PythonLibs REQUIRED) -include_directories(${PYTHON_INCLUDE_DIRS}) +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + find_package(PythonLibs REQUIRED) + include_directories(${PYTHON_INCLUDE_DIRS}) + set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) +else() + find_package (Python3 COMPONENTS Development) + include_directories(${Python3_INCLUDE_DIRS}) +endif() set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") @@ -18,11 +32,14 @@ set_source_files_properties(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) include_directories(${AMICI_INCLUDE_DIRS} ..) -swig_add_library(${PROJECT_NAME} TYPE MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) +swig_add_library(${PROJECT_NAME} + TYPE MODULE + LANGUAGE python + SOURCES ${PROJECT_NAME}.i) swig_link_libraries(${PROJECT_NAME} - ${PYTHON_LIBRARIES} - model) + ${Python3_LIBRARIES} + model) # configure module setup script set(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) diff --git a/models/model_events/CMakeLists.txt b/models/model_events/CMakeLists.txt index 043832a98a..c60998f9e6 100644 --- a/models/model_events/CMakeLists.txt +++ b/models/model_events/CMakeLists.txt @@ -23,7 +23,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) diff --git a/models/model_events/model_events.h b/models/model_events/model_events.h index 053b359cbb..1ea53269cf 100644 --- a/models/model_events/model_events.h +++ b/models/model_events/model_events.h @@ -1,6 +1,6 @@ #ifndef _amici_model_events_h #define _amici_model_events_h -/* Generated by amiwrap (R2017b) d43d87529b7be0983c74fe22a73d8cf2b64bc286 */ +/* Generated by amiwrap (R2017b) 5afd3fccf92ca20486e1bbaa4a50343b107e239c */ #include #include #include "amici/defines.h" @@ -75,7 +75,7 @@ class Model_model_events : public amici::Model_ODE { virtual amici::Model* clone() const override { return new Model_model_events(*this); }; - const std::string getAmiciCommit() const override { return "d43d87529b7be0983c74fe22a73d8cf2b64bc286"; }; + const std::string getAmiciCommit() const override { return "5afd3fccf92ca20486e1bbaa4a50343b107e239c"; }; virtual void fJ(realtype *J, const realtype t, const realtype *x, const double *p, const double *k, const realtype *h, const realtype *w, const realtype *dwdx) override { J_model_events(J, t, x, p, k, h, w, dwdx); diff --git a/models/model_events/swig/CMakeLists.txt b/models/model_events/swig/CMakeLists.txt index 616cf5e437..af0f64a76e 100644 --- a/models/model_events/swig/CMakeLists.txt +++ b/models/model_events/swig/CMakeLists.txt @@ -3,12 +3,26 @@ cmake_minimum_required(VERSION 3.8) # swig_add_library if(POLICY CMP0078) cmake_policy(SET CMP0078 OLD) endif(POLICY CMP0078) +if(POLICY CMP0074) + # Use package_ROOT environment variables + cmake_policy(SET CMP0074 NEW) +endif(POLICY CMP0074) +if(POLICY CMP0086) + cmake_policy(SET CMP0086 NEW) +endif(POLICY CMP0086) + find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(PythonLibs REQUIRED) -include_directories(${PYTHON_INCLUDE_DIRS}) +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + find_package(PythonLibs REQUIRED) + include_directories(${PYTHON_INCLUDE_DIRS}) + set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) +else() + find_package (Python3 COMPONENTS Development) + include_directories(${Python3_INCLUDE_DIRS}) +endif() set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") @@ -18,11 +32,14 @@ set_source_files_properties(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) include_directories(${AMICI_INCLUDE_DIRS} ..) -swig_add_library(${PROJECT_NAME} TYPE MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) +swig_add_library(${PROJECT_NAME} + TYPE MODULE + LANGUAGE python + SOURCES ${PROJECT_NAME}.i) swig_link_libraries(${PROJECT_NAME} - ${PYTHON_LIBRARIES} - model) + ${Python3_LIBRARIES} + model) # configure module setup script set(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) diff --git a/models/model_jakstat_adjoint/CMakeLists.txt b/models/model_jakstat_adjoint/CMakeLists.txt index 0934dde607..27f5fd7c62 100644 --- a/models/model_jakstat_adjoint/CMakeLists.txt +++ b/models/model_jakstat_adjoint/CMakeLists.txt @@ -23,7 +23,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint.h b/models/model_jakstat_adjoint/model_jakstat_adjoint.h index ccc2c19954..e512ee9394 100644 --- a/models/model_jakstat_adjoint/model_jakstat_adjoint.h +++ b/models/model_jakstat_adjoint/model_jakstat_adjoint.h @@ -1,6 +1,6 @@ #ifndef _amici_model_jakstat_adjoint_h #define _amici_model_jakstat_adjoint_h -/* Generated by amiwrap (R2017b) d43d87529b7be0983c74fe22a73d8cf2b64bc286 */ +/* Generated by amiwrap (R2017b) 5afd3fccf92ca20486e1bbaa4a50343b107e239c */ #include #include #include "amici/defines.h" @@ -64,7 +64,7 @@ class Model_model_jakstat_adjoint : public amici::Model_ODE { virtual amici::Model* clone() const override { return new Model_model_jakstat_adjoint(*this); }; - const std::string getAmiciCommit() const override { return "d43d87529b7be0983c74fe22a73d8cf2b64bc286"; }; + const std::string getAmiciCommit() const override { return "5afd3fccf92ca20486e1bbaa4a50343b107e239c"; }; virtual void fJ(realtype *J, const realtype t, const realtype *x, const double *p, const double *k, const realtype *h, const realtype *w, const realtype *dwdx) override { J_model_jakstat_adjoint(J, t, x, p, k, h, w, dwdx); diff --git a/models/model_jakstat_adjoint/swig/CMakeLists.txt b/models/model_jakstat_adjoint/swig/CMakeLists.txt index 616cf5e437..af0f64a76e 100644 --- a/models/model_jakstat_adjoint/swig/CMakeLists.txt +++ b/models/model_jakstat_adjoint/swig/CMakeLists.txt @@ -3,12 +3,26 @@ cmake_minimum_required(VERSION 3.8) # swig_add_library if(POLICY CMP0078) cmake_policy(SET CMP0078 OLD) endif(POLICY CMP0078) +if(POLICY CMP0074) + # Use package_ROOT environment variables + cmake_policy(SET CMP0074 NEW) +endif(POLICY CMP0074) +if(POLICY CMP0086) + cmake_policy(SET CMP0086 NEW) +endif(POLICY CMP0086) + find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(PythonLibs REQUIRED) -include_directories(${PYTHON_INCLUDE_DIRS}) +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + find_package(PythonLibs REQUIRED) + include_directories(${PYTHON_INCLUDE_DIRS}) + set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) +else() + find_package (Python3 COMPONENTS Development) + include_directories(${Python3_INCLUDE_DIRS}) +endif() set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") @@ -18,11 +32,14 @@ set_source_files_properties(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) include_directories(${AMICI_INCLUDE_DIRS} ..) -swig_add_library(${PROJECT_NAME} TYPE MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) +swig_add_library(${PROJECT_NAME} + TYPE MODULE + LANGUAGE python + SOURCES ${PROJECT_NAME}.i) swig_link_libraries(${PROJECT_NAME} - ${PYTHON_LIBRARIES} - model) + ${Python3_LIBRARIES} + model) # configure module setup script set(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) diff --git a/models/model_jakstat_adjoint_o2/CMakeLists.txt b/models/model_jakstat_adjoint_o2/CMakeLists.txt index 4af79edfd6..3fad280043 100644 --- a/models/model_jakstat_adjoint_o2/CMakeLists.txt +++ b/models/model_jakstat_adjoint_o2/CMakeLists.txt @@ -23,7 +23,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2.h b/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2.h index 4ea6082568..52f25fccd9 100644 --- a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2.h +++ b/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2.h @@ -1,6 +1,6 @@ #ifndef _amici_model_jakstat_adjoint_o2_h #define _amici_model_jakstat_adjoint_o2_h -/* Generated by amiwrap (R2017b) d43d87529b7be0983c74fe22a73d8cf2b64bc286 */ +/* Generated by amiwrap (R2017b) 5afd3fccf92ca20486e1bbaa4a50343b107e239c */ #include #include #include "amici/defines.h" @@ -64,7 +64,7 @@ class Model_model_jakstat_adjoint_o2 : public amici::Model_ODE { virtual amici::Model* clone() const override { return new Model_model_jakstat_adjoint_o2(*this); }; - const std::string getAmiciCommit() const override { return "d43d87529b7be0983c74fe22a73d8cf2b64bc286"; }; + const std::string getAmiciCommit() const override { return "5afd3fccf92ca20486e1bbaa4a50343b107e239c"; }; virtual void fJ(realtype *J, const realtype t, const realtype *x, const double *p, const double *k, const realtype *h, const realtype *w, const realtype *dwdx) override { J_model_jakstat_adjoint_o2(J, t, x, p, k, h, w, dwdx); diff --git a/models/model_jakstat_adjoint_o2/swig/CMakeLists.txt b/models/model_jakstat_adjoint_o2/swig/CMakeLists.txt index 616cf5e437..af0f64a76e 100644 --- a/models/model_jakstat_adjoint_o2/swig/CMakeLists.txt +++ b/models/model_jakstat_adjoint_o2/swig/CMakeLists.txt @@ -3,12 +3,26 @@ cmake_minimum_required(VERSION 3.8) # swig_add_library if(POLICY CMP0078) cmake_policy(SET CMP0078 OLD) endif(POLICY CMP0078) +if(POLICY CMP0074) + # Use package_ROOT environment variables + cmake_policy(SET CMP0074 NEW) +endif(POLICY CMP0074) +if(POLICY CMP0086) + cmake_policy(SET CMP0086 NEW) +endif(POLICY CMP0086) + find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(PythonLibs REQUIRED) -include_directories(${PYTHON_INCLUDE_DIRS}) +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + find_package(PythonLibs REQUIRED) + include_directories(${PYTHON_INCLUDE_DIRS}) + set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) +else() + find_package (Python3 COMPONENTS Development) + include_directories(${Python3_INCLUDE_DIRS}) +endif() set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") @@ -18,11 +32,14 @@ set_source_files_properties(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) include_directories(${AMICI_INCLUDE_DIRS} ..) -swig_add_library(${PROJECT_NAME} TYPE MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) +swig_add_library(${PROJECT_NAME} + TYPE MODULE + LANGUAGE python + SOURCES ${PROJECT_NAME}.i) swig_link_libraries(${PROJECT_NAME} - ${PYTHON_LIBRARIES} - model) + ${Python3_LIBRARIES} + model) # configure module setup script set(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) diff --git a/models/model_nested_events/CMakeLists.txt b/models/model_nested_events/CMakeLists.txt index caf73c932e..b5fa8de311 100644 --- a/models/model_nested_events/CMakeLists.txt +++ b/models/model_nested_events/CMakeLists.txt @@ -23,7 +23,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) diff --git a/models/model_nested_events/model_nested_events.h b/models/model_nested_events/model_nested_events.h index 76a87961e8..76a3c9b80f 100644 --- a/models/model_nested_events/model_nested_events.h +++ b/models/model_nested_events/model_nested_events.h @@ -1,6 +1,6 @@ #ifndef _amici_model_nested_events_h #define _amici_model_nested_events_h -/* Generated by amiwrap (R2017b) d43d87529b7be0983c74fe22a73d8cf2b64bc286 */ +/* Generated by amiwrap (R2017b) 5afd3fccf92ca20486e1bbaa4a50343b107e239c */ #include #include #include "amici/defines.h" @@ -64,7 +64,7 @@ class Model_model_nested_events : public amici::Model_ODE { virtual amici::Model* clone() const override { return new Model_model_nested_events(*this); }; - const std::string getAmiciCommit() const override { return "d43d87529b7be0983c74fe22a73d8cf2b64bc286"; }; + const std::string getAmiciCommit() const override { return "5afd3fccf92ca20486e1bbaa4a50343b107e239c"; }; virtual void fJ(realtype *J, const realtype t, const realtype *x, const double *p, const double *k, const realtype *h, const realtype *w, const realtype *dwdx) override { J_model_nested_events(J, t, x, p, k, h, w, dwdx); diff --git a/models/model_nested_events/swig/CMakeLists.txt b/models/model_nested_events/swig/CMakeLists.txt index 616cf5e437..af0f64a76e 100644 --- a/models/model_nested_events/swig/CMakeLists.txt +++ b/models/model_nested_events/swig/CMakeLists.txt @@ -3,12 +3,26 @@ cmake_minimum_required(VERSION 3.8) # swig_add_library if(POLICY CMP0078) cmake_policy(SET CMP0078 OLD) endif(POLICY CMP0078) +if(POLICY CMP0074) + # Use package_ROOT environment variables + cmake_policy(SET CMP0074 NEW) +endif(POLICY CMP0074) +if(POLICY CMP0086) + cmake_policy(SET CMP0086 NEW) +endif(POLICY CMP0086) + find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(PythonLibs REQUIRED) -include_directories(${PYTHON_INCLUDE_DIRS}) +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + find_package(PythonLibs REQUIRED) + include_directories(${PYTHON_INCLUDE_DIRS}) + set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) +else() + find_package (Python3 COMPONENTS Development) + include_directories(${Python3_INCLUDE_DIRS}) +endif() set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") @@ -18,11 +32,14 @@ set_source_files_properties(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) include_directories(${AMICI_INCLUDE_DIRS} ..) -swig_add_library(${PROJECT_NAME} TYPE MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) +swig_add_library(${PROJECT_NAME} + TYPE MODULE + LANGUAGE python + SOURCES ${PROJECT_NAME}.i) swig_link_libraries(${PROJECT_NAME} - ${PYTHON_LIBRARIES} - model) + ${Python3_LIBRARIES} + model) # configure module setup script set(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) diff --git a/models/model_neuron/CMakeLists.txt b/models/model_neuron/CMakeLists.txt index 69fecd552f..b7af8a3d7d 100644 --- a/models/model_neuron/CMakeLists.txt +++ b/models/model_neuron/CMakeLists.txt @@ -23,7 +23,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) diff --git a/models/model_neuron/model_neuron.h b/models/model_neuron/model_neuron.h index 725647012c..ddf2f6e014 100644 --- a/models/model_neuron/model_neuron.h +++ b/models/model_neuron/model_neuron.h @@ -1,6 +1,6 @@ #ifndef _amici_model_neuron_h #define _amici_model_neuron_h -/* Generated by amiwrap (R2017b) d43d87529b7be0983c74fe22a73d8cf2b64bc286 */ +/* Generated by amiwrap (R2017b) 5afd3fccf92ca20486e1bbaa4a50343b107e239c */ #include #include #include "amici/defines.h" @@ -78,7 +78,7 @@ class Model_model_neuron : public amici::Model_ODE { virtual amici::Model* clone() const override { return new Model_model_neuron(*this); }; - const std::string getAmiciCommit() const override { return "d43d87529b7be0983c74fe22a73d8cf2b64bc286"; }; + const std::string getAmiciCommit() const override { return "5afd3fccf92ca20486e1bbaa4a50343b107e239c"; }; virtual void fJ(realtype *J, const realtype t, const realtype *x, const double *p, const double *k, const realtype *h, const realtype *w, const realtype *dwdx) override { J_model_neuron(J, t, x, p, k, h, w, dwdx); diff --git a/models/model_neuron/model_neuron_deltaqB.cpp b/models/model_neuron/model_neuron_deltaqB.cpp index e72af5e55c..add8529e4a 100644 --- a/models/model_neuron/model_neuron_deltaqB.cpp +++ b/models/model_neuron/model_neuron_deltaqB.cpp @@ -11,7 +11,7 @@ switch (ip) { case 2: { switch(ie) { case 0: { - deltaqB[ip+0] = xB[0]; + deltaqB[0] = xB[0]; } break; @@ -22,7 +22,7 @@ switch (ip) { case 3: { switch(ie) { case 0: { - deltaqB[ip+0] = -xB[1]; + deltaqB[0] = -xB[1]; } break; diff --git a/models/model_neuron/swig/CMakeLists.txt b/models/model_neuron/swig/CMakeLists.txt index 616cf5e437..af0f64a76e 100644 --- a/models/model_neuron/swig/CMakeLists.txt +++ b/models/model_neuron/swig/CMakeLists.txt @@ -3,12 +3,26 @@ cmake_minimum_required(VERSION 3.8) # swig_add_library if(POLICY CMP0078) cmake_policy(SET CMP0078 OLD) endif(POLICY CMP0078) +if(POLICY CMP0074) + # Use package_ROOT environment variables + cmake_policy(SET CMP0074 NEW) +endif(POLICY CMP0074) +if(POLICY CMP0086) + cmake_policy(SET CMP0086 NEW) +endif(POLICY CMP0086) + find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(PythonLibs REQUIRED) -include_directories(${PYTHON_INCLUDE_DIRS}) +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + find_package(PythonLibs REQUIRED) + include_directories(${PYTHON_INCLUDE_DIRS}) + set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) +else() + find_package (Python3 COMPONENTS Development) + include_directories(${Python3_INCLUDE_DIRS}) +endif() set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") @@ -18,11 +32,14 @@ set_source_files_properties(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) include_directories(${AMICI_INCLUDE_DIRS} ..) -swig_add_library(${PROJECT_NAME} TYPE MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) +swig_add_library(${PROJECT_NAME} + TYPE MODULE + LANGUAGE python + SOURCES ${PROJECT_NAME}.i) swig_link_libraries(${PROJECT_NAME} - ${PYTHON_LIBRARIES} - model) + ${Python3_LIBRARIES} + model) # configure module setup script set(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) diff --git a/models/model_neuron_o2/CMakeLists.txt b/models/model_neuron_o2/CMakeLists.txt index 6c2a9f9513..7ad5944d56 100644 --- a/models/model_neuron_o2/CMakeLists.txt +++ b/models/model_neuron_o2/CMakeLists.txt @@ -23,7 +23,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) diff --git a/models/model_neuron_o2/model_neuron_o2.h b/models/model_neuron_o2/model_neuron_o2.h index 15428acbf7..ef16e543d1 100644 --- a/models/model_neuron_o2/model_neuron_o2.h +++ b/models/model_neuron_o2/model_neuron_o2.h @@ -1,6 +1,6 @@ #ifndef _amici_model_neuron_o2_h #define _amici_model_neuron_o2_h -/* Generated by amiwrap (R2017b) d43d87529b7be0983c74fe22a73d8cf2b64bc286 */ +/* Generated by amiwrap (R2017b) 5afd3fccf92ca20486e1bbaa4a50343b107e239c */ #include #include #include "amici/defines.h" @@ -80,7 +80,7 @@ class Model_model_neuron_o2 : public amici::Model_ODE { virtual amici::Model* clone() const override { return new Model_model_neuron_o2(*this); }; - const std::string getAmiciCommit() const override { return "d43d87529b7be0983c74fe22a73d8cf2b64bc286"; }; + const std::string getAmiciCommit() const override { return "5afd3fccf92ca20486e1bbaa4a50343b107e239c"; }; virtual void fJ(realtype *J, const realtype t, const realtype *x, const double *p, const double *k, const realtype *h, const realtype *w, const realtype *dwdx) override { J_model_neuron_o2(J, t, x, p, k, h, w, dwdx); diff --git a/models/model_neuron_o2/model_neuron_o2_deltaqB.cpp b/models/model_neuron_o2/model_neuron_o2_deltaqB.cpp index 5ab5b40ae8..2030ebd41c 100644 --- a/models/model_neuron_o2/model_neuron_o2_deltaqB.cpp +++ b/models/model_neuron_o2/model_neuron_o2_deltaqB.cpp @@ -11,7 +11,7 @@ switch (ip) { case 0: { switch(ie) { case 0: { - deltaqB[ip+0] = (x[2]*xB[3]*(p[3]+p[1]*p[2]+p[1]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[4]*xB[5]*(p[3]+p[1]*p[2]+p[1]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[6]*xB[7]*(p[3]+p[1]*p[2]+p[1]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[8]*xB[9]*(p[3]+p[1]*p[2]+p[1]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2); + deltaqB[0] = (x[2]*xB[3]*(p[3]+p[1]*p[2]+p[1]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[4]*xB[5]*(p[3]+p[1]*p[2]+p[1]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[6]*xB[7]*(p[3]+p[1]*p[2]+p[1]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[8]*xB[9]*(p[3]+p[1]*p[2]+p[1]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2); } break; @@ -22,7 +22,7 @@ switch (ip) { case 1: { switch(ie) { case 0: { - deltaqB[ip+0] = (x[2]*xB[3]*(p[0]*p[2]+p[0]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[4]*xB[5]*(p[0]*p[2]+p[0]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[6]*xB[7]*(p[0]*p[2]+p[0]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[8]*xB[9]*(p[0]*p[2]+p[0]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2); + deltaqB[0] = (x[2]*xB[3]*(p[0]*p[2]+p[0]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[4]*xB[5]*(p[0]*p[2]+p[0]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[6]*xB[7]*(p[0]*p[2]+p[0]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[8]*xB[9]*(p[0]*p[2]+p[0]*x[0]))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2); } break; @@ -33,7 +33,7 @@ switch (ip) { case 2: { switch(ie) { case 0: { - deltaqB[ip+0] = xB[0]-(x[2]*xB[2]*(p[2]*(2.0/2.5E1)-5.0))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)-(x[4]*xB[4]*(p[2]*(2.0/2.5E1)-5.0))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)-(x[6]*xB[6]*(p[2]*(2.0/2.5E1)-5.0))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)-(x[8]*xB[8]*(p[2]*(2.0/2.5E1)-5.0))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*p[1]*x[2]*xB[3])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*p[1]*x[4]*xB[5])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*p[1]*x[6]*xB[7])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*p[1]*x[8]*xB[9])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2); + deltaqB[0] = xB[0]-(x[2]*xB[2]*(p[2]*(2.0/2.5E1)-5.0))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)-(x[4]*xB[4]*(p[2]*(2.0/2.5E1)-5.0))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)-(x[6]*xB[6]*(p[2]*(2.0/2.5E1)-5.0))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)-(x[8]*xB[8]*(p[2]*(2.0/2.5E1)-5.0))/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*p[1]*x[2]*xB[3])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*p[1]*x[4]*xB[5])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*p[1]*x[6]*xB[7])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*p[1]*x[8]*xB[9])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2); } break; @@ -44,7 +44,7 @@ switch (ip) { case 3: { switch(ie) { case 0: { - deltaqB[ip+0] = -xB[1]+(x[2]*xB[2])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[4]*xB[4])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[6]*xB[6])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[8]*xB[8])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*x[2]*xB[3])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*x[4]*xB[5])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*x[6]*xB[7])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*x[8]*xB[9])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2); + deltaqB[0] = -xB[1]+(x[2]*xB[2])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[4]*xB[4])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[6]*xB[6])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(x[8]*xB[8])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*x[2]*xB[3])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*x[4]*xB[5])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*x[6]*xB[7])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2)+(p[0]*x[8]*xB[9])/(k[1]+x[0]*5.0-x[1]+(x[0]*x[0])*(1.0/2.5E1)+1.4E2); } break; diff --git a/models/model_neuron_o2/swig/CMakeLists.txt b/models/model_neuron_o2/swig/CMakeLists.txt index 616cf5e437..af0f64a76e 100644 --- a/models/model_neuron_o2/swig/CMakeLists.txt +++ b/models/model_neuron_o2/swig/CMakeLists.txt @@ -3,12 +3,26 @@ cmake_minimum_required(VERSION 3.8) # swig_add_library if(POLICY CMP0078) cmake_policy(SET CMP0078 OLD) endif(POLICY CMP0078) +if(POLICY CMP0074) + # Use package_ROOT environment variables + cmake_policy(SET CMP0074 NEW) +endif(POLICY CMP0074) +if(POLICY CMP0086) + cmake_policy(SET CMP0086 NEW) +endif(POLICY CMP0086) + find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(PythonLibs REQUIRED) -include_directories(${PYTHON_INCLUDE_DIRS}) +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + find_package(PythonLibs REQUIRED) + include_directories(${PYTHON_INCLUDE_DIRS}) + set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) +else() + find_package (Python3 COMPONENTS Development) + include_directories(${Python3_INCLUDE_DIRS}) +endif() set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") @@ -18,11 +32,14 @@ set_source_files_properties(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) include_directories(${AMICI_INCLUDE_DIRS} ..) -swig_add_library(${PROJECT_NAME} TYPE MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) +swig_add_library(${PROJECT_NAME} + TYPE MODULE + LANGUAGE python + SOURCES ${PROJECT_NAME}.i) swig_link_libraries(${PROJECT_NAME} - ${PYTHON_LIBRARIES} - model) + ${Python3_LIBRARIES} + model) # configure module setup script set(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) diff --git a/models/model_robertson/CMakeLists.txt b/models/model_robertson/CMakeLists.txt index d517e9b9e5..072011db85 100644 --- a/models/model_robertson/CMakeLists.txt +++ b/models/model_robertson/CMakeLists.txt @@ -23,7 +23,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) diff --git a/models/model_robertson/model_robertson.h b/models/model_robertson/model_robertson.h index a7203c6a8a..556cea6e75 100644 --- a/models/model_robertson/model_robertson.h +++ b/models/model_robertson/model_robertson.h @@ -1,6 +1,6 @@ #ifndef _amici_model_robertson_h #define _amici_model_robertson_h -/* Generated by amiwrap (R2017b) d43d87529b7be0983c74fe22a73d8cf2b64bc286 */ +/* Generated by amiwrap (R2017b) 5afd3fccf92ca20486e1bbaa4a50343b107e239c */ #include #include #include "amici/defines.h" @@ -62,7 +62,7 @@ class Model_model_robertson : public amici::Model_DAE { virtual amici::Model* clone() const override { return new Model_model_robertson(*this); }; - const std::string getAmiciCommit() const override { return "d43d87529b7be0983c74fe22a73d8cf2b64bc286"; }; + const std::string getAmiciCommit() const override { return "5afd3fccf92ca20486e1bbaa4a50343b107e239c"; }; virtual void fJ(realtype *J, const realtype t, const realtype *x, const double *p, const double *k, const realtype *h, const realtype cj, const realtype *dx, const realtype *w, const realtype *dwdx) override { J_model_robertson(J, t, x, p, k, h, cj, dx, w, dwdx); diff --git a/models/model_robertson/swig/CMakeLists.txt b/models/model_robertson/swig/CMakeLists.txt index 616cf5e437..af0f64a76e 100644 --- a/models/model_robertson/swig/CMakeLists.txt +++ b/models/model_robertson/swig/CMakeLists.txt @@ -3,12 +3,26 @@ cmake_minimum_required(VERSION 3.8) # swig_add_library if(POLICY CMP0078) cmake_policy(SET CMP0078 OLD) endif(POLICY CMP0078) +if(POLICY CMP0074) + # Use package_ROOT environment variables + cmake_policy(SET CMP0074 NEW) +endif(POLICY CMP0074) +if(POLICY CMP0086) + cmake_policy(SET CMP0086 NEW) +endif(POLICY CMP0086) + find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(PythonLibs REQUIRED) -include_directories(${PYTHON_INCLUDE_DIRS}) +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + find_package(PythonLibs REQUIRED) + include_directories(${PYTHON_INCLUDE_DIRS}) + set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) +else() + find_package (Python3 COMPONENTS Development) + include_directories(${Python3_INCLUDE_DIRS}) +endif() set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") @@ -18,11 +32,14 @@ set_source_files_properties(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) include_directories(${AMICI_INCLUDE_DIRS} ..) -swig_add_library(${PROJECT_NAME} TYPE MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) +swig_add_library(${PROJECT_NAME} + TYPE MODULE + LANGUAGE python + SOURCES ${PROJECT_NAME}.i) swig_link_libraries(${PROJECT_NAME} - ${PYTHON_LIBRARIES} - model) + ${Python3_LIBRARIES} + model) # configure module setup script set(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) diff --git a/models/model_steadystate/CMakeLists.txt b/models/model_steadystate/CMakeLists.txt index 902f919fde..0537b4b5b1 100644 --- a/models/model_steadystate/CMakeLists.txt +++ b/models/model_steadystate/CMakeLists.txt @@ -23,7 +23,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) diff --git a/models/model_steadystate/model_steadystate.h b/models/model_steadystate/model_steadystate.h index 70c1d08538..06a1c2773b 100644 --- a/models/model_steadystate/model_steadystate.h +++ b/models/model_steadystate/model_steadystate.h @@ -1,6 +1,6 @@ #ifndef _amici_model_steadystate_h #define _amici_model_steadystate_h -/* Generated by amiwrap (R2017b) d43d87529b7be0983c74fe22a73d8cf2b64bc286 */ +/* Generated by amiwrap (R2017b) 5afd3fccf92ca20486e1bbaa4a50343b107e239c */ #include #include #include "amici/defines.h" @@ -61,7 +61,7 @@ class Model_model_steadystate : public amici::Model_ODE { virtual amici::Model* clone() const override { return new Model_model_steadystate(*this); }; - const std::string getAmiciCommit() const override { return "d43d87529b7be0983c74fe22a73d8cf2b64bc286"; }; + const std::string getAmiciCommit() const override { return "5afd3fccf92ca20486e1bbaa4a50343b107e239c"; }; virtual void fJ(realtype *J, const realtype t, const realtype *x, const double *p, const double *k, const realtype *h, const realtype *w, const realtype *dwdx) override { J_model_steadystate(J, t, x, p, k, h, w, dwdx); diff --git a/models/model_steadystate/swig/CMakeLists.txt b/models/model_steadystate/swig/CMakeLists.txt index 616cf5e437..af0f64a76e 100644 --- a/models/model_steadystate/swig/CMakeLists.txt +++ b/models/model_steadystate/swig/CMakeLists.txt @@ -3,12 +3,26 @@ cmake_minimum_required(VERSION 3.8) # swig_add_library if(POLICY CMP0078) cmake_policy(SET CMP0078 OLD) endif(POLICY CMP0078) +if(POLICY CMP0074) + # Use package_ROOT environment variables + cmake_policy(SET CMP0074 NEW) +endif(POLICY CMP0074) +if(POLICY CMP0086) + cmake_policy(SET CMP0086 NEW) +endif(POLICY CMP0086) + find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(PythonLibs REQUIRED) -include_directories(${PYTHON_INCLUDE_DIRS}) +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + find_package(PythonLibs REQUIRED) + include_directories(${PYTHON_INCLUDE_DIRS}) + set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) +else() + find_package (Python3 COMPONENTS Development) + include_directories(${Python3_INCLUDE_DIRS}) +endif() set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") @@ -18,11 +32,14 @@ set_source_files_properties(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) include_directories(${AMICI_INCLUDE_DIRS} ..) -swig_add_library(${PROJECT_NAME} TYPE MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) +swig_add_library(${PROJECT_NAME} + TYPE MODULE + LANGUAGE python + SOURCES ${PROJECT_NAME}.i) swig_link_libraries(${PROJECT_NAME} - ${PYTHON_LIBRARIES} - model) + ${Python3_LIBRARIES} + model) # configure module setup script set(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 83bb0e3fd7..8d8d164a15 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,12 +1,18 @@ -if(DEFINED ENV{PYTHON_EXECUTABLE}) - set( PYTHON_EXECUTABLE $ENV{PYTHON_EXECUTABLE} ) +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + if(DEFINED ENV{PYTHON_EXECUTABLE}) + set( PYTHON_EXECUTABLE $ENV{PYTHON_EXECUTABLE} ) + endif() + find_package(PythonInterp 3.6 REQUIRED) + set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE}) +else() + find_package (Python3 COMPONENTS Interpreter) endif() -find_package(PythonInterp 3.6 REQUIRED) + add_custom_target(install-python COMMENT "Installing AMICI base python package" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/sdist - COMMAND ${PYTHON_EXECUTABLE} setup.py install --prefix= --user) + COMMAND ${Python3_EXECUTABLE} setup.py install --prefix= --user) # Create python wheel @@ -16,15 +22,15 @@ add_custom_target(install-python add_custom_target(python-wheel COMMENT "Creating wheel for AMICI base python package" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/sdist - COMMAND ${PYTHON_EXECUTABLE} setup.py build_ext - COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel --dist-dir=${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${Python3_EXECUTABLE} setup.py build_ext + COMMAND ${Python3_EXECUTABLE} setup.py bdist_wheel --dist-dir=${CMAKE_CURRENT_BINARY_DIR} ) add_custom_target(python-sdist COMMENT "Creating sdist for AMICI base python package" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/sdist - COMMAND ${PYTHON_EXECUTABLE} setup.py sdist --dist-dir=${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${Python3_EXECUTABLE} setup.py sdist --dist-dir=${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/python/amici/setuptools.py b/python/amici/setuptools.py index 78206a8569..e505afba61 100644 --- a/python/amici/setuptools.py +++ b/python/amici/setuptools.py @@ -52,6 +52,21 @@ def getBlasConfig(): # anything by ourselves return blaspkgcfg + # Try environment modules + # MKL + if 'MKLROOT' in os.environ: + if 'MKL_INC' in os.environ: + blaspkgcfg['extra_compile_args'].extend( + shlex.split(os.environ['MKL_INC']) + ) + if 'MKL_LIB' in os.environ: + blaspkgcfg['extra_link_args'].extend( + shlex.split(os.environ['MKL_LIB']) + ) + blaspkgcfg['define_macros'].append(('AMICI_BLAS_MKL', None),) + return blaspkgcfg + + # Try pkgconfig if pkgconfig: if pkgconfig.exists('cblas'): diff --git a/python/sdist/amici/swig.py b/python/sdist/amici/swig.py index c0e5bdf7da..75977ce52d 100644 --- a/python/sdist/amici/swig.py +++ b/python/sdist/amici/swig.py @@ -40,8 +40,11 @@ def swig_works(swig): """Test if `swig` looks like a working SWIG executable.""" try: - result = subprocess.run([swig, '-version'], capture_output=True) - except FileNotFoundError: + # For python3.6 compatibility no `capture_output=True` + result = subprocess.run([swig, '-version'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + except (FileNotFoundError, PermissionError): return False return result.returncode == 0 diff --git a/python/sdist/setup.py b/python/sdist/setup.py index 2858209bcd..e0cb42296b 100755 --- a/python/sdist/setup.py +++ b/python/sdist/setup.py @@ -66,6 +66,7 @@ def main(): amici_module_linker_flags.extend(blaspkgcfg['extra_link_args']) amici_module_linker_flags.extend( '-l%s' % l for l in blaspkgcfg['libraries']) + define_macros.extend(blaspkgcfg['define_macros']) h5pkgcfg = getHdf5Config() @@ -80,6 +81,7 @@ def main(): extension_sources = [ 'amici/amici_wrap.cxx', # swig interface ] + define_macros.extend(h5pkgcfg['define_macros']) else: print("HDF5 library NOT found. Building AMICI WITHOUT HDF5 support.") extension_sources = [ diff --git a/python/sdist/setup_clibs.py b/python/sdist/setup_clibs.py index 8eda0313e9..ea33f37b69 100644 --- a/python/sdist/setup_clibs.py +++ b/python/sdist/setup_clibs.py @@ -203,7 +203,9 @@ def getLibAmici(extra_compiler_flags=None, h5pkgcfg=None, blaspkgcfg=None): libamici = ('amici', { 'sources': getAmiciBaseSources( - withHDF5=(h5pkgcfg and 'include_dirs' in h5pkgcfg and h5pkgcfg['include_dirs']) + withHDF5=(h5pkgcfg + and 'include_dirs' in h5pkgcfg + and h5pkgcfg['include_dirs']) ), 'include_dirs': ['amici/include', 'amici/ThirdParty/SuiteSparse/KLU/Include/', @@ -216,15 +218,22 @@ def getLibAmici(extra_compiler_flags=None, h5pkgcfg=None, blaspkgcfg=None): 'amici/ThirdParty/sundials/src', 'amici/ThirdParty/gsl/', ], - 'cflags': ['-std=c++11', *extra_compiler_flags] + 'cflags': ['-std=c++11', *extra_compiler_flags], + 'macros': [], }) if h5pkgcfg and 'include_dirs' in h5pkgcfg: libamici[1]['include_dirs'].extend(h5pkgcfg['include_dirs']) + if h5pkgcfg and 'define_macros' in h5pkgcfg: + libamici[1]['macros'].extend(h5pkgcfg['define_macros']) + if blaspkgcfg and 'include_dirs' in blaspkgcfg: libamici[1]['include_dirs'].extend(blaspkgcfg['include_dirs']) + if blaspkgcfg and 'define_macros' in blaspkgcfg: + libamici[1]['macros'].extend(blaspkgcfg['define_macros']) + if blaspkgcfg and 'extra_compile_args' in blaspkgcfg: libamici[1]['cflags'].extend(blaspkgcfg['extra_compile_args']) diff --git a/scripts/installAmiciArchive.sh b/scripts/installAmiciArchive.sh index 2c655685e2..80995681bc 100755 --- a/scripts/installAmiciArchive.sh +++ b/scripts/installAmiciArchive.sh @@ -17,8 +17,21 @@ rm -f ${AMICI_PATH}/python/sdist/amici/amici.py rm -f ${AMICI_PATH}/python/sdist/amici/amici_without_hdf5.py # test install from archive +set +e python3 -m venv ${AMICI_PATH}/build/venvArchive --clear -source ${AMICI_PATH}/build/venvArchive/bin/activate -pip3 install --upgrade pip setuptools pkgconfig wheel -pip3 install $(ls -t ${AMICI_PATH}/build/python/amici-*.tar.gz | head -1) +# in case this fails (usually due to missing ensurepip, try getting pip +# manually +if [[ $? ]]; then + set -e + python3 -m venv ${AMICI_PATH}/build/venvArchive --clear --without-pip + source ${AMICI_PATH}/build/venvArchive/bin/activate + curl https://bootstrap.pypa.io/get-pip.py -o ${AMICI_PATH}/build/get-pip.py + python ${AMICI_PATH}/build/get-pip.py +else + set -e + source ${AMICI_PATH}/build/venvArchive/bin/activate +fi + +pip install --upgrade pip setuptools pkgconfig wheel +pip install $(ls -t ${AMICI_PATH}/build/python/amici-*.tar.gz | head -1) deactivate diff --git a/scripts/installAmiciSource.sh b/scripts/installAmiciSource.sh index 8db65157a2..c4b05e9bfd 100755 --- a/scripts/installAmiciSource.sh +++ b/scripts/installAmiciSource.sh @@ -20,10 +20,23 @@ rm -rf ${AMICI_PATH}/python/sdist/build/ # test install from setup.py +set +e python3 -m venv ${AMICI_PATH}/build/venv --clear -source ${AMICI_PATH}/build/venv/bin/activate +# in case this fails (usually due to missing ensurepip, try getting pip +# manually +if [[ $? ]]; then + set -e + python3 -m venv ${AMICI_PATH}/build/venv --clear --without-pip + source ${AMICI_PATH}/build/venv/bin/activate + curl https://bootstrap.pypa.io/get-pip.py -o ${AMICI_PATH}/build/get-pip.py + python ${AMICI_PATH}/build/get-pip.py +else + set -e + source ${AMICI_PATH}/build/venv/bin/activate +fi + # install wheel separately to prevent build_wheel fail in next step -pip3 install --upgrade wheel -pip3 install --upgrade pip setuptools pkgconfig scipy matplotlib pysb coverage -pip3 install --verbose -e ${AMICI_PATH}/python/sdist +pip install --upgrade wheel +pip install --upgrade pip setuptools pkgconfig scipy matplotlib pysb coverage +pip install --verbose -e ${AMICI_PATH}/python/sdist deactivate diff --git a/swig/CMakeLists_model.cmake b/swig/CMakeLists_model.cmake index 616cf5e437..af0f64a76e 100644 --- a/swig/CMakeLists_model.cmake +++ b/swig/CMakeLists_model.cmake @@ -3,12 +3,26 @@ cmake_minimum_required(VERSION 3.8) # swig_add_library if(POLICY CMP0078) cmake_policy(SET CMP0078 OLD) endif(POLICY CMP0078) +if(POLICY CMP0074) + # Use package_ROOT environment variables + cmake_policy(SET CMP0074 NEW) +endif(POLICY CMP0074) +if(POLICY CMP0086) + cmake_policy(SET CMP0086 NEW) +endif(POLICY CMP0086) + find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(PythonLibs REQUIRED) -include_directories(${PYTHON_INCLUDE_DIRS}) +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + find_package(PythonLibs REQUIRED) + include_directories(${PYTHON_INCLUDE_DIRS}) + set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) +else() + find_package (Python3 COMPONENTS Development) + include_directories(${Python3_INCLUDE_DIRS}) +endif() set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") @@ -18,11 +32,14 @@ set_source_files_properties(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) include_directories(${AMICI_INCLUDE_DIRS} ..) -swig_add_library(${PROJECT_NAME} TYPE MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) +swig_add_library(${PROJECT_NAME} + TYPE MODULE + LANGUAGE python + SOURCES ${PROJECT_NAME}.i) swig_link_libraries(${PROJECT_NAME} - ${PYTHON_LIBRARIES} - model) + ${Python3_LIBRARIES} + model) # configure module setup script set(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) From 9e25907c79f8c490209aac20a45a4d97c04cea0f Mon Sep 17 00:00:00 2001 From: Paul Stapor Date: Wed, 31 Jul 2019 10:46:16 +0200 Subject: [PATCH 09/13] added handling of abs function, since there seem to be problems with case sensitivity (#713) Closes #770 --- python/amici/sbml_import.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/amici/sbml_import.py b/python/amici/sbml_import.py index 1e04621298..7f38230350 100644 --- a/python/amici/sbml_import.py +++ b/python/amici/sbml_import.py @@ -1213,7 +1213,9 @@ def _parse_special_functions(sym): args = tuple(_parse_special_functions(arg) for arg in sym._args) # Do we have piecewise expressions? - if sym.__class__.__name__ == 'piecewise': + if sym.__class__.__name__ == 'abs': + return sp.Abs(sym._args[0]) + elif sym.__class__.__name__ == 'piecewise': # how many condition-expression pairs will we have? return sp.Piecewise(*grouper(args, 2, True)) elif isinstance(sym, (sp.Function, sp.Mul, sp.Add)): From b5ae68f2591db84e86caedda8a382946594c8fea Mon Sep 17 00:00:00 2001 From: MerktSimon <49190262+MerktSimon@users.noreply.github.com> Date: Mon, 5 Aug 2019 15:27:02 +0200 Subject: [PATCH 10/13] Small docu fixes and assignmentRules2obervables() fix (#777) * small docu fixes * fix use of python-docu use of assignmentRules2observables() --- documentation/PYTHON.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/documentation/PYTHON.md b/documentation/PYTHON.md index 644d689292..4935aada46 100644 --- a/documentation/PYTHON.md +++ b/documentation/PYTHON.md @@ -25,10 +25,10 @@ parameters that should be considered constants can be specified in a list of str ### Observables -assignment rules that should be considered as observables can extracted using the `amici.assignmentRules2observables` function +Assignment rules that should be considered as observables can extracted using the `amici.assignmentRules2observables` function. - observables = amici.assignmentRules2observables(sbml, filter=lambda variableId: - variableId.startswith('observable_') and not variableId.endswith('_sigma')) + observables = amici.assignmentRules2observables(sbml, filter_function=lambda variable: + variable.getId().startswith('observable_') and not variable.getId().endswith('_sigma')) ### Standard Deviations @@ -44,7 +44,7 @@ to compile the sbml as python module, the user has to call the method `amici.sbm sbmlImporter.sbml2amici('test', 'test', observables=observables, constantParameters=constantParameters, - sigmas=sigma) + sigmas=sigmas) Note: To build AMICI with OpenMP support, which allows to parallelize model simulations of multiple experimental conditions, set the environment variables `AMICI_CXXFLAGS` and `AMICI_LDFLAGS` to the From dc0b7ff8db7d5ae3f38085e3f884804e87b9b331 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 7 Aug 2019 16:31:45 +0200 Subject: [PATCH 11/13] More informative output during swig detection, fix typos (#778) * python swig detection: Fix typos; add debug output * More SWIG debug output --- python/amici/setuptools.py | 40 +++++++++++++++++++++++--------------- python/sdist/amici/swig.py | 19 +++++++++++++----- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/python/amici/setuptools.py b/python/amici/setuptools.py index e505afba61..3cdb44a428 100644 --- a/python/amici/setuptools.py +++ b/python/amici/setuptools.py @@ -203,23 +203,31 @@ def generateSwigInterfaceFiles(): """Compile the swig python interface to amici """ swig_outdir = '%s/amici' % os.path.abspath(os.getcwd()) - swig_cmd = find_swig() - sp = subprocess.run([swig_cmd, - '-c++', - '-python', - '-Iamici/swig', '-Iamici/include', - '-DAMICI_SWIG_WITHOUT_HDF5', - '-outdir', swig_outdir, - '-o', 'amici/amici_wrap_without_hdf5.cxx', - 'amici/swig/amici.i']) + swig_exe = find_swig() + + # Swig AMICI interface without HDF5 dependency + swig_cmd = [swig_exe, + '-c++', + '-python', + '-Iamici/swig', '-Iamici/include', + '-DAMICI_SWIG_WITHOUT_HDF5', + '-outdir', swig_outdir, + '-o', 'amici/amici_wrap_without_hdf5.cxx', + 'amici/swig/amici.i'] + print(f"Running SWIG: {' '.join(swig_cmd)}") + sp = subprocess.run(swig_cmd) assert (sp.returncode == 0) shutil.move(os.path.join(swig_outdir, 'amici.py'), os.path.join(swig_outdir, 'amici_without_hdf5.py')) - sp = subprocess.run([swig_cmd, - '-c++', - '-python', - '-Iamici/swig', '-Iamici/include', - '-outdir', swig_outdir, - '-o', 'amici/amici_wrap.cxx', - 'amici/swig/amici.i']) + + # Swig AMICI interface with HDF5 dependency + swig_cmd = [swig_exe, + '-c++', + '-python', + '-Iamici/swig', '-Iamici/include', + '-outdir', swig_outdir, + '-o', 'amici/amici_wrap.cxx', + 'amici/swig/amici.i'] + print(f"Running SWIG: {' '.join(swig_cmd)}") + sp = subprocess.run(swig_cmd) assert (sp.returncode == 0) diff --git a/python/sdist/amici/swig.py b/python/sdist/amici/swig.py index 75977ce52d..e00a83e64e 100644 --- a/python/sdist/amici/swig.py +++ b/python/sdist/amici/swig.py @@ -23,20 +23,20 @@ def find_swig(): if swig_works(candidate): return candidate - raise RuntimeError("Unable to find SWIG executable with default names." + raise RuntimeError("Unable to find SWIG executable with default names. " "Ensure you have SWIG installed, e.g. by " - "`sudo apt install swig3.0` or `brew install swig`." + "`sudo apt install swig3.0` or `brew install swig`. " "As non-root user, you can install SWIG using " "https://github.com/ICB-DCM/AMICI/blob/master/scripts/" "downloadAndBuildSwig.sh, or by following the " "instructions at http://www.swig.org/Doc4.0/" - "SWIGDocumentation.html#Preface_installation." + "SWIGDocumentation.html#Preface_installation. " "If was not found despite being installed, set the SWIG" - " environment variable to the full path of the correct" + " environment variable to the full path of the correct " "executable.") -def swig_works(swig): +def swig_works(swig, verbose = True): """Test if `swig` looks like a working SWIG executable.""" try: @@ -45,6 +45,15 @@ def swig_works(swig): stdout=subprocess.PIPE, stderr=subprocess.PIPE) except (FileNotFoundError, PermissionError): + if verbose: + print(f'Testing SWIG executable {swig}... FAILED.') return False + if verbose: + if result.returncode == 0: + print(f'Testing SWIG executable {swig}... SUCCEEDED.') + print(result.stdout.decode('utf-8')) + else: + print(f'Testing SWIG executable {swig}... FAILED.') + return result.returncode == 0 From afb4b030dd10a9217c96e7216232835d48f64da1 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 7 Aug 2019 16:53:45 +0200 Subject: [PATCH 12/13] Update travis ci images; fix failfast option in runAmiciSimulations; fixes for cppcheck update (#730) * Update travis ci images (ubuntu bionic, xcode11) * Run cppcheck on OSX as the version available for ubuntu bionic reports false positives * Fix cppcheck errors after cppcheck update * Test failed after fixing failfast option in previous commit. Fix test with failfast=False. --- .travis.yml | 10 +++--- include/amici/edata.h | 2 +- include/amici/solver.h | 10 +++--- include/amici/sundials_linsol_wrapper.h | 22 ++++++------- include/amici/sundials_matrix_wrapper.h | 4 +-- include/amici/vector.h | 4 +-- src/amici.cpp | 13 ++++---- src/newton_solver.cpp | 3 +- src/solver.cpp | 44 ++++++++----------------- src/sundials_matrix_wrapper.cpp | 4 +-- src/vector.cpp | 4 +-- tests/testModels.py | 3 +- 12 files changed, 54 insertions(+), 69 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4e2fc9a656..4e341c659c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ matrix: fast_finish: true include: - os: linux - dist: xenial + dist: bionic language: python python: 3.7 compiler: gcc @@ -23,7 +23,6 @@ matrix: - libboost-serialization-dev - swig3.0 - g++-5 - - cppcheck - libc6-dbg env: - ENABLE_GCOV_COVERAGE=TRUE @@ -44,7 +43,7 @@ matrix: tags: true - os: osx - osx_image: xcode10.1 + osx_image: xcode11 language: minimal compiler: clang env: @@ -55,6 +54,7 @@ matrix: - hdf5 - swig - gcc + - cppcheck update: true before_install: - travis_wait brew link --overwrite gcc # fix linker warning regarding /usr/local/include/c++ @@ -64,7 +64,7 @@ matrix: - cd $BASE_DIR # cd to base dir for correct relative path in deploy - os: osx - osx_image: xcode10.1 + osx_image: xcode11 language: minimal compiler: clang env: @@ -117,7 +117,7 @@ script: - if [[ "$TRAVIS_OS_NAME" != "linux" ]] && [[ "$CI_MODE" == "test" ]]; then $FOLD python-tests ./scripts/run-python-tests.sh; fi - if [[ "$TRAVIS_OS_NAME" != "linux" ]] && [[ "$CI_MODE" == "test" ]]; then $FOLD cmake ./tests/testCMakeCompilation.sh; fi - if [[ "$CI_MODE" == "deploy" ]]; then $FOLD doxygen ./scripts/run-doxygen.sh; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$CI_MODE" == "test" ]]; then $FOLD cppcheck ./scripts/run-cppcheck.sh; fi + - if [[ "$TRAVIS_OS_NAME" != "linux" ]] && [[ "$CI_MODE" == "test" ]]; then $FOLD cppcheck ./scripts/run-cppcheck.sh; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$CI_MODE" == "test" ]]; then $FOLD valgrind ./scripts/run-valgrind.sh; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$CI_MODE" == "test" ]]; then $FOLD codecov ./scripts/run-codecov.sh; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$TRAVIS_EVENT_TYPE" == "cron" ]]; then $FOLD sbmltestsuite ./scripts/run-SBMLTestsuite.sh; fi diff --git a/include/amici/edata.h b/include/amici/edata.h index 153c74252d..400b57d973 100644 --- a/include/amici/edata.h +++ b/include/amici/edata.h @@ -498,7 +498,7 @@ class ConditionContext { * @param model * @param edata */ - ConditionContext(Model *model, const ExpData *edata = nullptr); + explicit ConditionContext(Model *model, const ExpData *edata = nullptr); ~ConditionContext(); diff --git a/include/amici/solver.h b/include/amici/solver.h index 48d1d2e8cd..5a7ff728b4 100644 --- a/include/amici/solver.h +++ b/include/amici/solver.h @@ -630,13 +630,13 @@ class Solver { * @return t */ realtype gett() const; - + /** * @brief Reads out the cpu time needed for forward solve * @return cpu_time */ realtype getCpuTime() const; - + /** * @brief Reads out the cpu time needed for bavkward solve * @return cpu_timeB @@ -1424,10 +1424,10 @@ class Solver { /** relative tolerances for steadystate computation */ realtype ss_rtol_sensi = NAN; - + /** CPU time, forward solve */ mutable realtype cpu_time = 0.0; - + /** CPU time, backward solve */ mutable realtype cpu_timeB = 0.0; @@ -1455,7 +1455,7 @@ class Solver { mutable std::vector initializedQB{false}; /** number of checkpoints in the forward problem */ - mutable int ncheckPtr; + mutable int ncheckPtr = 0; }; bool operator==(const Solver &a, const Solver &b); diff --git a/include/amici/sundials_linsol_wrapper.h b/include/amici/sundials_linsol_wrapper.h index e7933a334c..1bcd7a30bb 100644 --- a/include/amici/sundials_linsol_wrapper.h +++ b/include/amici/sundials_linsol_wrapper.h @@ -380,8 +380,8 @@ class SUNLinSolSPBCGS : public SUNLinSolWrapper { * PREC_BOTH) * @param maxl Maximum number of solver iterations */ - SUNLinSolSPBCGS(N_Vector x, int pretype = PREC_NONE, - int maxl = SUNSPBCGS_MAXL_DEFAULT); + explicit SUNLinSolSPBCGS(N_Vector x, int pretype = PREC_NONE, + int maxl = SUNSPBCGS_MAXL_DEFAULT); /** * @brief SUNLinSolSPBCGS @@ -390,8 +390,8 @@ class SUNLinSolSPBCGS : public SUNLinSolWrapper { * PREC_BOTH) * @param maxl Maximum number of solver iterations */ - SUNLinSolSPBCGS(AmiVector const &x, int pretype = PREC_NONE, - int maxl = SUNSPBCGS_MAXL_DEFAULT); + explicit SUNLinSolSPBCGS(AmiVector const &x, int pretype = PREC_NONE, + int maxl = SUNSPBCGS_MAXL_DEFAULT); /** * @brief Sets the function pointer for ATimes @@ -523,8 +523,8 @@ class SUNLinSolSPGMR : public SUNLinSolWrapper { * PREC_BOTH) * @param maxl Maximum number of solver iterations */ - SUNLinSolSPGMR(AmiVector const &x, int pretype = PREC_NONE, - int maxl = SUNSPGMR_MAXL_DEFAULT); + explicit SUNLinSolSPGMR(AmiVector const &x, int pretype = PREC_NONE, + int maxl = SUNSPGMR_MAXL_DEFAULT); /** * @brief Sets the function pointer for ATimes @@ -590,8 +590,8 @@ class SUNLinSolSPTFQMR : public SUNLinSolWrapper { * PREC_BOTH) * @param maxl Maximum number of solver iterations */ - SUNLinSolSPTFQMR(N_Vector x, int pretype = PREC_NONE, - int maxl = SUNSPTFQMR_MAXL_DEFAULT); + explicit SUNLinSolSPTFQMR(N_Vector x, int pretype = PREC_NONE, + int maxl = SUNSPTFQMR_MAXL_DEFAULT); /** * @brief Create SPTFQMR solver @@ -600,8 +600,8 @@ class SUNLinSolSPTFQMR : public SUNLinSolWrapper { * PREC_BOTH) * @param maxl Maximum number of solver iterations */ - SUNLinSolSPTFQMR(AmiVector const &x, int pretype = PREC_NONE, - int maxl = SUNSPTFQMR_MAXL_DEFAULT); + explicit SUNLinSolSPTFQMR(AmiVector const &x, int pretype = PREC_NONE, + int maxl = SUNSPTFQMR_MAXL_DEFAULT); /** * @brief Sets the function pointer for ATimes @@ -837,7 +837,7 @@ class SUNNonLinSolFixedPoint : public SUNNonLinSolWrapper { * @param x template for cloning vectors needed within the solver. * @param m number of acceleration vectors to use */ - SUNNonLinSolFixedPoint(const_N_Vector x, int m = 0); + explicit SUNNonLinSolFixedPoint(const_N_Vector x, int m = 0); /** * @brief Create fixed-point solver for use with sensitivity analysis diff --git a/include/amici/sundials_matrix_wrapper.h b/include/amici/sundials_matrix_wrapper.h index f39c510129..59751425c5 100644 --- a/include/amici/sundials_matrix_wrapper.h +++ b/include/amici/sundials_matrix_wrapper.h @@ -76,7 +76,7 @@ class SUNMatrixWrapper { * @brief Move constructor * @param other */ - SUNMatrixWrapper(SUNMatrixWrapper &&other) noexcept; + SUNMatrixWrapper(SUNMatrixWrapper &&other); /** * @brief Copy assignment @@ -90,7 +90,7 @@ class SUNMatrixWrapper { * @param other * @return */ - SUNMatrixWrapper &operator=(SUNMatrixWrapper &&other) noexcept; + SUNMatrixWrapper &operator=(SUNMatrixWrapper &&other); /** * @brief Access raw data diff --git a/include/amici/vector.h b/include/amici/vector.h index daf8f6e002..1b18c746e7 100644 --- a/include/amici/vector.h +++ b/include/amici/vector.h @@ -38,10 +38,10 @@ class AmiVector { : vec(static_cast(length), 0.0), nvec(N_VMake_Serial(length, vec.data())) {} - /** Copies data from std::vector and constructs an nvec that points to the + /** Moves data from std::vector and constructs an nvec that points to the * data * @brief constructor from std::vector, - * @param rvec vector from which the data will be copied + * @param rvec vector from which the data will be moved * @return new AmiVector instance */ explicit AmiVector(std::vector rvec) diff --git a/src/amici.cpp b/src/amici.cpp index 4a3d290e00..d71a03c9eb 100644 --- a/src/amici.cpp +++ b/src/amici.cpp @@ -122,7 +122,9 @@ std::vector > runAmiciSimulations(const Solver &solv ) { std::vector > results(edatas.size()); - bool failed = false; + // is set to true if one simulation fails and we should skip the rest. + // shared across threads. + bool skipThrough = false; #if defined(_OPENMP) #pragma omp parallel for num_threads(num_threads) @@ -133,16 +135,15 @@ std::vector > runAmiciSimulations(const Solver &solv /* if we fail we need to write empty return datas for the python interface */ - if (failed) { + if (skipThrough) { ConditionContext conditionContext(myModel.get(), edatas[i]); results[i] = std::unique_ptr(new ReturnData(solver, model)); + } else { + results[i] = runAmiciSimulation(*mySolver, edatas[i], *myModel); } - results[i] = runAmiciSimulation(*mySolver, edatas[i], *myModel); - - if (results[i]->status < 0 && failfast) - failed = true; + skipThrough |= failfast && results[i]->status < 0; } return results; diff --git a/src/newton_solver.cpp b/src/newton_solver.cpp index c651ea0094..26d1247baa 100644 --- a/src/newton_solver.cpp +++ b/src/newton_solver.cpp @@ -254,7 +254,6 @@ void NewtonSolverIterative::linsolveSPBCG(int ntry, int nnewt, // ns_r = xdot - ns_Jv; N_VLinearSum(-1.0, ns_Jv.getNVector(), 1.0, xdot.getNVector(), ns_r.getNVector()); N_VDiv(ns_r.getNVector(), ns_Jdiag.getNVector(), ns_r.getNVector()); - double res = sqrt(N_VDotProd(ns_r.getNVector(), ns_r.getNVector())); ns_rt = ns_r; for (int i_linstep = 0; i_linstep < maxlinsteps; @@ -296,7 +295,7 @@ void NewtonSolverIterative::linsolveSPBCG(int ntry, int nnewt, // Compute the (unscaled) residual N_VProd(ns_r.getNVector(), ns_Jdiag.getNVector(), ns_r.getNVector()); - res = sqrt(N_VDotProd(ns_r.getNVector(), ns_r.getNVector())); + double res = sqrt(N_VDotProd(ns_r.getNVector(), ns_r.getNVector())); // Test convergence if (res < atol) { diff --git a/src/solver.cpp b/src/solver.cpp index e1433552ee..944c8ea911 100644 --- a/src/solver.cpp +++ b/src/solver.cpp @@ -14,36 +14,20 @@ namespace amici { extern msgIdAndTxtFp warnMsgIdAndTxt; -Solver::Solver(const Solver &other) : Solver() { - t = nan(""); - ncheckPtr = 0; - sensi = other.sensi; - atol = other.atol; - rtol = other.rtol; - atol_fsa = other.atol_fsa; - rtol_fsa = other.rtol_fsa; - atolB = other.atolB; - rtolB = other.rtolB; - quad_atol = other.quad_atol; - quad_rtol = other.quad_rtol; - ss_atol = other.ss_atol; - ss_rtol = other.ss_rtol; - ss_atol_sensi = other.ss_atol_sensi; - ss_rtol_sensi = other.ss_rtol_sensi; - maxsteps = other.maxsteps; - maxstepsB = other.maxstepsB; - newton_maxsteps = other.newton_maxsteps; - newton_maxlinsteps = other.newton_maxlinsteps; - newton_preeq = other.newton_preeq; - ism = other.ism; - sensi_meth = other.sensi_meth; - linsol = other.linsol; - interpType = other.interpType; - lmm = other.lmm; - iter = other.iter; - stldet = other.stldet; - ordering = other.ordering; -} +Solver::Solver(const Solver &other) + : ism(other.ism), lmm(other.lmm), iter(other.iter), + interpType(other.interpType), maxsteps(other.maxsteps), t(nan("")), + sensi_meth(other.sensi_meth), stldet(other.stldet), + ordering(other.ordering), newton_maxsteps(other.newton_maxsteps), + newton_maxlinsteps(other.newton_maxlinsteps), + newton_preeq(other.newton_preeq), linsol(other.linsol), + atol(other.atol), rtol(other.rtol), atol_fsa(other.atol_fsa), + rtol_fsa(other.rtol_fsa), atolB(other.atolB), rtolB(other.rtolB), + quad_atol(other.quad_atol), quad_rtol(other.quad_rtol), + ss_atol(other.ss_atol), ss_rtol(other.ss_rtol), + ss_atol_sensi(other.ss_atol_sensi), ss_rtol_sensi(other.ss_rtol_sensi), + maxstepsB(other.maxstepsB), sensi(other.sensi) +{} int Solver::run(const realtype tout) const { setStopTime(tout); diff --git a/src/sundials_matrix_wrapper.cpp b/src/sundials_matrix_wrapper.cpp index 6f5f7cb0e7..dd107c5efa 100644 --- a/src/sundials_matrix_wrapper.cpp +++ b/src/sundials_matrix_wrapper.cpp @@ -82,7 +82,7 @@ SUNMatrixWrapper::SUNMatrixWrapper(const SUNMatrixWrapper &other) { update_ptrs(); } -SUNMatrixWrapper::SUNMatrixWrapper(SUNMatrixWrapper &&other) noexcept { +SUNMatrixWrapper::SUNMatrixWrapper(SUNMatrixWrapper &&other) { std::swap(matrix, other.matrix); update_ptrs(); } @@ -94,7 +94,7 @@ SUNMatrixWrapper &SUNMatrixWrapper::operator=(const SUNMatrixWrapper &other) { } SUNMatrixWrapper &SUNMatrixWrapper:: -operator=(SUNMatrixWrapper &&other) noexcept { +operator=(SUNMatrixWrapper &&other) { std::swap(matrix, other.matrix); update_ptrs(); return *this; diff --git a/src/vector.cpp b/src/vector.cpp index 6462219db6..5d57dd9610 100644 --- a/src/vector.cpp +++ b/src/vector.cpp @@ -23,8 +23,8 @@ int AmiVector::getLength() const { return static_cast(vec.size()); } void AmiVector::reset() { set(0.0); } void AmiVector::minus() { - for (auto & it : vec) - it = -it; + std::transform(vec.begin(), vec.end(), + vec.begin(), std::negate()); } void AmiVector::set(realtype val) { std::fill(vec.begin(), vec.end(), val); } diff --git a/tests/testModels.py b/tests/testModels.py index 29f4bfba9e..527fc1b57a 100755 --- a/tests/testModels.py +++ b/tests/testModels.py @@ -126,7 +126,8 @@ def assert_fun(x): edatas = [edata.get(), edata.get()] rdatas = amici.runAmiciSimulations( - self.model, self.solver, edatas, num_threads=2 + self.model, self.solver, edatas, num_threads=2, + failfast=False ) verify_simulation_results( rdatas[0], From 6157014b257e4ada6b268114bfd87ce148549c52 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 7 Aug 2019 10:47:26 +0200 Subject: [PATCH 13/13] Bump version number (0.10.10) --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index f314d02022..ddf1d4ae68 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.10.9 +0.10.10