diff options
Diffstat (limited to 'docs/articles/web_only/compiled_models.html')
-rw-r--r-- | docs/articles/web_only/compiled_models.html | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/docs/articles/web_only/compiled_models.html b/docs/articles/web_only/compiled_models.html index 81d75821..a1fa69f5 100644 --- a/docs/articles/web_only/compiled_models.html +++ b/docs/articles/web_only/compiled_models.html @@ -1,18 +1,18 @@ <!DOCTYPE html> -<!-- Generated by pkgdown: do not edit by hand --><html> +<!-- Generated by pkgdown: do not edit by hand --><html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Performance benefit by using compiled model definitions in mkin • mkin</title> -<!-- jquery --><script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> -<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script><!-- Font Awesome icons --><link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> -<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js" integrity="sha384-cV+rhyOuRHc9Ub/91rihWcGmMmCXDeksTtCihMupQHSsi8GIIRDG0ThDc3HGQFJ3" crossorigin="anonymous"></script><!-- sticky kit --><script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../../pkgdown.css" rel="stylesheet"> +<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous"> +<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous"> +<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- sticky kit --><script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../../pkgdown.css" rel="stylesheet"> <script src="../../pkgdown.js"></script><meta property="og:title" content="Performance benefit by using compiled model definitions in mkin"> <meta property="og:description" content=""> <meta name="twitter:card" content="summary"> -<!-- mathjax --><script src="https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><!--[if lt IE 9]> +<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> @@ -22,14 +22,15 @@ <header><div class="navbar navbar-default navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> - <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false"> + <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <span class="navbar-brand"> <a class="navbar-link" href="../../index.html">mkin</a> - <span class="label label-default" data-toggle="tooltip" data-placement="bottom" title="Released package">0.9.47.6</span> + <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.47.6</span> </span> </div> @@ -84,7 +85,7 @@ <h1>Performance benefit by using compiled model definitions in mkin</h1> <h4 class="author">Johannes Ranke</h4> - <h4 class="date">2018-11-26</h4> + <h4 class="date">2019-01-31</h4> <div class="hidden name"><code>compiled_models.Rmd</code></div> @@ -97,18 +98,18 @@ <h2 class="hasAnchor"> <a href="#model-that-can-also-be-solved-with-eigenvalues" class="anchor"></a>Model that can also be solved with Eigenvalues</h2> <p>This evaluation is taken from the example section of mkinfit. When using an mkin version equal to or greater than 0.9-36 and a C compiler (gcc) is available, you will see a message that the model is being compiled from autogenerated C code when defining a model using mkinmod. The <code><a href="../../reference/mkinmod.html">mkinmod()</a></code> function checks for presence of the gcc compiler using</p> -<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw">Sys.which</span>(<span class="st">"gcc"</span>)</a></code></pre></div> +<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Sys.which">Sys.which</a></span>(<span class="st">"gcc"</span>)</a></code></pre></div> <pre><code>## gcc ## "/usr/bin/gcc"</code></pre> <p>First, we build a simple degradation model for a parent compound with one metabolite.</p> -<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="kw">library</span>(<span class="st">"mkin"</span>, <span class="dt">quietly =</span> <span class="ot">TRUE</span>)</a> +<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(<span class="st">"mkin"</span>, <span class="dt">quietly =</span> <span class="ot">TRUE</span>)</a> <a class="sourceLine" id="cb3-2" data-line-number="2">SFO_SFO <-<span class="st"> </span><span class="kw"><a href="../../reference/mkinmod.html">mkinmod</a></span>(</a> <a class="sourceLine" id="cb3-3" data-line-number="3"> <span class="dt">parent =</span> <span class="kw"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"m1"</span>),</a> <a class="sourceLine" id="cb3-4" data-line-number="4"> <span class="dt">m1 =</span> <span class="kw"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))</a></code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> <p>We can compare the performance of the Eigenvalue based solution against the compiled version and the R implementation of the differential equations using the benchmark package.</p> -<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="cf">if</span> (<span class="kw">require</span>(rbenchmark)) {</a> -<a class="sourceLine" id="cb5-2" data-line-number="2"> b<span class="fl">.1</span> <-<span class="st"> </span><span class="kw"><a href="http://www.rdocumentation.org/packages/rbenchmark/topics/benchmark">benchmark</a></span>(</a> +<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="cf">if</span> (<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">require</a></span>(rbenchmark)) {</a> +<a class="sourceLine" id="cb5-2" data-line-number="2"> b<span class="fl">.1</span> <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/rbenchmark/topics/benchmark">benchmark</a></span>(</a> <a class="sourceLine" id="cb5-3" data-line-number="3"> <span class="st">"deSolve, not compiled"</span> =<span class="st"> </span><span class="kw"><a href="../../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_<span class="dv">2006</span>_D,</a> <a class="sourceLine" id="cb5-4" data-line-number="4"> <span class="dt">solution_type =</span> <span class="st">"deSolve"</span>,</a> <a class="sourceLine" id="cb5-5" data-line-number="5"> <span class="dt">use_compiled =</span> <span class="ot">FALSE</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),</a> @@ -117,17 +118,17 @@ <a class="sourceLine" id="cb5-8" data-line-number="8"> <span class="st">"deSolve, compiled"</span> =<span class="st"> </span><span class="kw"><a href="../../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_<span class="dv">2006</span>_D,</a> <a class="sourceLine" id="cb5-9" data-line-number="9"> <span class="dt">solution_type =</span> <span class="st">"deSolve"</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),</a> <a class="sourceLine" id="cb5-10" data-line-number="10"> <span class="dt">replications =</span> <span class="dv">3</span>)</a> -<a class="sourceLine" id="cb5-11" data-line-number="11"> <span class="kw">print</span>(b<span class="fl">.1</span>)</a> -<a class="sourceLine" id="cb5-12" data-line-number="12"> factor_SFO_SFO <-<span class="st"> </span><span class="kw">round</span>(b<span class="fl">.1</span>[<span class="st">"1"</span>, <span class="st">"relative"</span>])</a> +<a class="sourceLine" id="cb5-11" data-line-number="11"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(b<span class="fl">.1</span>)</a> +<a class="sourceLine" id="cb5-12" data-line-number="12"> factor_SFO_SFO <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>(b<span class="fl">.1</span>[<span class="st">"1"</span>, <span class="st">"relative"</span>])</a> <a class="sourceLine" id="cb5-13" data-line-number="13">} <span class="cf">else</span> {</a> <a class="sourceLine" id="cb5-14" data-line-number="14"> factor_SFO_SFO <-<span class="st"> </span><span class="ot">NA</span></a> -<a class="sourceLine" id="cb5-15" data-line-number="15"> <span class="kw">print</span>(<span class="st">"R package benchmark is not available"</span>)</a> +<a class="sourceLine" id="cb5-15" data-line-number="15"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(<span class="st">"R package benchmark is not available"</span>)</a> <a class="sourceLine" id="cb5-16" data-line-number="16">}</a></code></pre></div> <pre><code>## Lade nötiges Paket: rbenchmark</code></pre> <pre><code>## test replications elapsed relative user.self sys.self -## 3 deSolve, compiled 3 2.344 1.000 2.343 0.000 -## 1 deSolve, not compiled 3 18.171 7.752 18.152 0.008 -## 2 Eigenvalue based 3 2.887 1.232 2.885 0.000 +## 3 deSolve, compiled 3 2.319 1.000 2.317 0.000 +## 1 deSolve, not compiled 3 17.483 7.539 17.473 0.000 +## 2 Eigenvalue based 3 2.857 1.232 2.852 0.003 ## user.child sys.child ## 3 0 0 ## 1 0 0 @@ -138,32 +139,32 @@ <h2 class="hasAnchor"> <a href="#model-that-can-not-be-solved-with-eigenvalues" class="anchor"></a>Model that can not be solved with Eigenvalues</h2> <p>This evaluation is also taken from the example section of mkinfit.</p> -<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1"><span class="cf">if</span> (<span class="kw">require</span>(rbenchmark)) {</a> +<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1"><span class="cf">if</span> (<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">require</a></span>(rbenchmark)) {</a> <a class="sourceLine" id="cb8-2" data-line-number="2"> FOMC_SFO <-<span class="st"> </span><span class="kw"><a href="../../reference/mkinmod.html">mkinmod</a></span>(</a> <a class="sourceLine" id="cb8-3" data-line-number="3"> <span class="dt">parent =</span> <span class="kw"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"FOMC"</span>, <span class="st">"m1"</span>),</a> <a class="sourceLine" id="cb8-4" data-line-number="4"> <span class="dt">m1 =</span> <span class="kw"><a href="../../reference/mkinsub.html">mkinsub</a></span>( <span class="st">"SFO"</span>))</a> <a class="sourceLine" id="cb8-5" data-line-number="5"></a> -<a class="sourceLine" id="cb8-6" data-line-number="6"> b<span class="fl">.2</span> <-<span class="st"> </span><span class="kw"><a href="http://www.rdocumentation.org/packages/rbenchmark/topics/benchmark">benchmark</a></span>(</a> +<a class="sourceLine" id="cb8-6" data-line-number="6"> b<span class="fl">.2</span> <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/rbenchmark/topics/benchmark">benchmark</a></span>(</a> <a class="sourceLine" id="cb8-7" data-line-number="7"> <span class="st">"deSolve, not compiled"</span> =<span class="st"> </span><span class="kw"><a href="../../reference/mkinfit.html">mkinfit</a></span>(FOMC_SFO, FOCUS_<span class="dv">2006</span>_D,</a> <a class="sourceLine" id="cb8-8" data-line-number="8"> <span class="dt">use_compiled =</span> <span class="ot">FALSE</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),</a> <a class="sourceLine" id="cb8-9" data-line-number="9"> <span class="st">"deSolve, compiled"</span> =<span class="st"> </span><span class="kw"><a href="../../reference/mkinfit.html">mkinfit</a></span>(FOMC_SFO, FOCUS_<span class="dv">2006</span>_D, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),</a> <a class="sourceLine" id="cb8-10" data-line-number="10"> <span class="dt">replications =</span> <span class="dv">3</span>)</a> -<a class="sourceLine" id="cb8-11" data-line-number="11"> <span class="kw">print</span>(b<span class="fl">.2</span>)</a> -<a class="sourceLine" id="cb8-12" data-line-number="12"> factor_FOMC_SFO <-<span class="st"> </span><span class="kw">round</span>(b<span class="fl">.2</span>[<span class="st">"1"</span>, <span class="st">"relative"</span>])</a> +<a class="sourceLine" id="cb8-11" data-line-number="11"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(b<span class="fl">.2</span>)</a> +<a class="sourceLine" id="cb8-12" data-line-number="12"> factor_FOMC_SFO <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>(b<span class="fl">.2</span>[<span class="st">"1"</span>, <span class="st">"relative"</span>])</a> <a class="sourceLine" id="cb8-13" data-line-number="13">} <span class="cf">else</span> {</a> <a class="sourceLine" id="cb8-14" data-line-number="14"> factor_FOMC_SFO <-<span class="st"> </span><span class="ot">NA</span></a> -<a class="sourceLine" id="cb8-15" data-line-number="15"> <span class="kw">print</span>(<span class="st">"R package benchmark is not available"</span>)</a> +<a class="sourceLine" id="cb8-15" data-line-number="15"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(<span class="st">"R package benchmark is not available"</span>)</a> <a class="sourceLine" id="cb8-16" data-line-number="16">}</a></code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> <pre><code>## test replications elapsed relative user.self sys.self -## 2 deSolve, compiled 3 4.173 1.000 4.169 0.000 -## 1 deSolve, not compiled 3 38.623 9.255 38.592 0.008 +## 2 deSolve, compiled 3 4.102 1.000 4.100 0 +## 1 deSolve, not compiled 3 37.059 9.034 37.041 0 ## user.child sys.child ## 2 0 0 ## 1 0 0</code></pre> <p>Here we get a performance benefit of a factor of 9 using the version of the differential equation model compiled from C code!</p> -<p>This vignette was built with mkin 0.9.47.6 on</p> -<pre><code>## R version 3.5.1 (2018-07-02) +<p>This vignette was built with mkin 0.9.47.5 on</p> +<pre><code>## R version 3.5.2 (2018-12-20) ## Platform: x86_64-pc-linux-gnu (64-bit) ## Running under: Debian GNU/Linux 9 (stretch)</code></pre> <pre><code>## CPU model: AMD Ryzen 7 1700 Eight-Core Processor</code></pre> @@ -189,9 +190,8 @@ </div> <div class="pkgdown"> - <p>Site built with <a href="http://pkgdown.r-lib.org/">pkgdown</a>.</p> + <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p> </div> - </footer> </div> |