aboutsummaryrefslogtreecommitdiff
path: root/docs/articles/web_only/compiled_models.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/articles/web_only/compiled_models.html')
-rw-r--r--docs/articles/web_only/compiled_models.html49
1 files changed, 27 insertions, 22 deletions
diff --git a/docs/articles/web_only/compiled_models.html b/docs/articles/web_only/compiled_models.html
index 0bb564ad..89977591 100644
--- a/docs/articles/web_only/compiled_models.html
+++ b/docs/articles/web_only/compiled_models.html
@@ -7,8 +7,9 @@
<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://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="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/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous">
+<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" 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><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" 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">
@@ -82,13 +83,14 @@
<!--/.navbar -->
+
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header toc-ignore">
<h1>Performance benefit by using compiled model definitions in mkin</h1>
<h4 class="author">Johannes Ranke</h4>
- <h4 class="date">2019-07-09</h4>
+ <h4 class="date">2019-09-18</h4>
<div class="hidden name"><code>compiled_models.Rmd</code></div>
@@ -101,18 +103,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" title="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>
+<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1"><span class="kw"><a href="https://rdrr.io/r/base/Sys.which.html">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" title="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>
+<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">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" title="2">SFO_SFO &lt;-<span class="st"> </span><span class="kw"><a href="../../reference/mkinmod.html">mkinmod</a></span>(</a>
<a class="sourceLine" id="cb3-3" title="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" title="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" title="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" title="2"> b<span class="fl">.1</span> &lt;-<span class="st"> </span><span class="kw"><a href="https://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" title="1"><span class="cf">if</span> (<span class="kw"><a href="https://rdrr.io/r/base/library.html">require</a></span>(rbenchmark)) {</a>
+<a class="sourceLine" id="cb5-2" title="2"> b<span class="fl">.1</span> &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/rbenchmark/man/benchmark.html">benchmark</a></span>(</a>
<a class="sourceLine" id="cb5-3" title="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" title="4"> <span class="dt">solution_type =</span> <span class="st">"deSolve"</span>,</a>
<a class="sourceLine" id="cb5-5" title="5"> <span class="dt">use_compiled =</span> <span class="ot">FALSE</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),</a>
@@ -121,11 +123,11 @@
<a class="sourceLine" id="cb5-8" title="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" title="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" title="10"> <span class="dt">replications =</span> <span class="dv">3</span>)</a>
-<a class="sourceLine" id="cb5-11" title="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" title="12"> factor_SFO_SFO &lt;-<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-11" title="11"> <span class="kw"><a href="https://rdrr.io/r/base/print.html">print</a></span>(b<span class="fl">.1</span>)</a>
+<a class="sourceLine" id="cb5-12" title="12"> factor_SFO_SFO &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/Round.html">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" title="13">} <span class="cf">else</span> {</a>
<a class="sourceLine" id="cb5-14" title="14"> factor_SFO_SFO &lt;-<span class="st"> </span><span class="ot">NA</span></a>
-<a class="sourceLine" id="cb5-15" title="15"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(<span class="st">"R package rbenchmark is not available"</span>)</a>
+<a class="sourceLine" id="cb5-15" title="15"> <span class="kw"><a href="https://rdrr.io/r/base/print.html">print</a></span>(<span class="st">"R package rbenchmark is not available"</span>)</a>
<a class="sourceLine" id="cb5-16" title="16">}</a></code></pre></div>
<pre><code>## Lade nötiges Paket: rbenchmark</code></pre>
<pre><code>## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "deSolve",
@@ -163,9 +165,9 @@
## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "deSolve", quiet
## = TRUE): Observations with value of zero were removed from the data</code></pre>
<pre><code>## test replications elapsed relative user.self sys.self
-## 3 deSolve, compiled 3 3.127 1.000 3.125 0
-## 1 deSolve, not compiled 3 28.337 9.062 28.322 0
-## 2 Eigenvalue based 3 4.320 1.382 4.317 0
+## 3 deSolve, compiled 3 3.124 1.000 3.122 0
+## 1 deSolve, not compiled 3 28.822 9.226 28.807 0
+## 2 Eigenvalue based 3 4.416 1.414 4.413 0
## user.child sys.child
## 3 0 0
## 1 0 0
@@ -176,21 +178,21 @@
<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="cb14"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb14-1" title="1"><span class="cf">if</span> (<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">require</a></span>(rbenchmark)) {</a>
+<div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb14-1" title="1"><span class="cf">if</span> (<span class="kw"><a href="https://rdrr.io/r/base/library.html">require</a></span>(rbenchmark)) {</a>
<a class="sourceLine" id="cb14-2" title="2"> FOMC_SFO &lt;-<span class="st"> </span><span class="kw"><a href="../../reference/mkinmod.html">mkinmod</a></span>(</a>
<a class="sourceLine" id="cb14-3" title="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="cb14-4" title="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="cb14-5" title="5"></a>
-<a class="sourceLine" id="cb14-6" title="6"> b<span class="fl">.2</span> &lt;-<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="cb14-6" title="6"> b<span class="fl">.2</span> &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/rbenchmark/man/benchmark.html">benchmark</a></span>(</a>
<a class="sourceLine" id="cb14-7" title="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="cb14-8" title="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="cb14-9" title="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="cb14-10" title="10"> <span class="dt">replications =</span> <span class="dv">3</span>)</a>
-<a class="sourceLine" id="cb14-11" title="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="cb14-12" title="12"> factor_FOMC_SFO &lt;-<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="cb14-11" title="11"> <span class="kw"><a href="https://rdrr.io/r/base/print.html">print</a></span>(b<span class="fl">.2</span>)</a>
+<a class="sourceLine" id="cb14-12" title="12"> factor_FOMC_SFO &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/Round.html">round</a></span>(b<span class="fl">.2</span>[<span class="st">"1"</span>, <span class="st">"relative"</span>])</a>
<a class="sourceLine" id="cb14-13" title="13">} <span class="cf">else</span> {</a>
<a class="sourceLine" id="cb14-14" title="14"> factor_FOMC_SFO &lt;-<span class="st"> </span><span class="ot">NA</span></a>
-<a class="sourceLine" id="cb14-15" title="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="cb14-15" title="15"> <span class="kw"><a href="https://rdrr.io/r/base/print.html">print</a></span>(<span class="st">"R package benchmark is not available"</span>)</a>
<a class="sourceLine" id="cb14-16" title="16">}</a></code></pre></div>
<pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre>
<pre><code>## Warning in mkinfit(FOMC_SFO, FOCUS_2006_D, use_compiled = FALSE, quiet =
@@ -214,14 +216,14 @@
## Warning in mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE): Observations with
## value of zero were removed from the data</code></pre>
<pre><code>## test replications elapsed relative user.self sys.self
-## 2 deSolve, compiled 3 4.783 1.000 4.780 0
-## 1 deSolve, not compiled 3 52.761 11.031 52.733 0
+## 2 deSolve, compiled 3 4.878 1.000 4.875 0
+## 1 deSolve, not compiled 3 53.602 10.989 53.568 0
## user.child sys.child
## 2 0 0
## 1 0 0</code></pre>
<p>Here we get a performance benefit of a factor of 11 using the version of the differential equation model compiled from C code!</p>
<p>This vignette was built with mkin 0.9.49.6 on</p>
-<pre><code>## R version 3.6.0 (2019-04-26)
+<pre><code>## R version 3.6.1 (2019-07-05)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Debian GNU/Linux 10 (buster)</code></pre>
<pre><code>## CPU model: AMD Ryzen 7 1700 Eight-Core Processor</code></pre>
@@ -242,17 +244,20 @@
</div>
+
<footer><div class="copyright">
<p>Developed by Johannes Ranke.</p>
</div>
<div class="pkgdown">
- <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
+ <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
</div>
+
</footer>
</div>
+
</body>
</html>

Contact - Imprint