From 194659fcaccdd1ee37851725b8c72e99daa3a8cf Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 10 Apr 2019 10:17:35 +0200 Subject: Adapt tests, vignettes and examples - Write the NEWS - Static documentation rebuilt by pkgdown - Adapt mkinerrmin - Fix (hopefully all) remaining problems in mkinfit --- docs/articles/web_only/compiled_models.html | 110 +++++++++++++++++++++------- 1 file changed, 82 insertions(+), 28 deletions(-) (limited to 'docs/articles/web_only/compiled_models.html') diff --git a/docs/articles/web_only/compiled_models.html b/docs/articles/web_only/compiled_models.html index 269b1098..597b7c55 100644 --- a/docs/articles/web_only/compiled_models.html +++ b/docs/articles/web_only/compiled_models.html @@ -30,7 +30,7 @@ mkin - 0.9.48.1 + 0.9.49.4 @@ -88,7 +88,7 @@

Performance benefit by using compiled model definitions in mkin

Johannes Ranke

-

2019-03-04

+

2019-04-10

@@ -125,49 +125,103 @@ factor_SFO_SFO <- round(b.1["1", "relative"]) } else { factor_SFO_SFO <- NA - print("R package benchmark is not available") + print("R package rbenchmark is not available") }
## Lade nötiges Paket: rbenchmark
+
## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "deSolve",
+## use_compiled = FALSE, : Observations with value of zero were removed from
+## the data
+
## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "eigen", quiet =
+## TRUE): Observations with value of zero were removed from the data
+
## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "deSolve", quiet
+## = TRUE): Observations with value of zero were removed from the data
+
## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "deSolve",
+## use_compiled = FALSE, : Observations with value of zero were removed from
+## the data
+
+## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "deSolve",
+## use_compiled = FALSE, : Observations with value of zero were removed from
+## the data
+
+## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "deSolve",
+## use_compiled = FALSE, : Observations with value of zero were removed from
+## the data
+
## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "eigen", quiet =
+## TRUE): Observations with value of zero were removed from the data
+
+## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "eigen", quiet =
+## TRUE): Observations with value of zero were removed from the data
+
+## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "eigen", quiet =
+## TRUE): Observations with value of zero were removed from the data
+
## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "deSolve", quiet
+## = TRUE): Observations with value of zero were removed from the data
+
+## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "deSolve", quiet
+## = TRUE): Observations with value of zero were removed from the data
+
+## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "deSolve", quiet
+## = TRUE): Observations with value of zero were removed from the data
##                    test replications elapsed relative user.self sys.self
-## 3     deSolve, compiled            3   2.310    1.000     2.308        0
-## 1 deSolve, not compiled            3  17.509    7.580    17.500        0
-## 2      Eigenvalue based            3   2.859    1.238     2.858        0
+## 3     deSolve, compiled            3   3.215    1.000     3.213        0
+## 1 deSolve, not compiled            3  42.468   13.209    42.445        0
+## 2      Eigenvalue based            3   4.666    1.451     4.663        0
 ##   user.child sys.child
 ## 3          0         0
 ## 1          0         0
 ## 2          0         0
-

We see that using the compiled model is by a factor of around 8 faster than using the R version with the default ode solver, and it is even faster than the Eigenvalue based solution implemented in R which does not need iterative solution of the ODEs.

+

We see that using the compiled model is by a factor of around 13 faster than using the R version with the default ode solver, and it is even faster than the Eigenvalue based solution implemented in R which does not need iterative solution of the ODEs.

Model that can not be solved with Eigenvalues

This evaluation is also taken from the example section of mkinfit.

-
if (require(rbenchmark)) {
-  FOMC_SFO <- mkinmod(
-    parent = mkinsub("FOMC", "m1"),
-    m1 = mkinsub( "SFO"))
-
-  b.2 <- benchmark(
-    "deSolve, not compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D,
-                                      use_compiled = FALSE, quiet = TRUE),
-    "deSolve, compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE),
-    replications = 3)
-  print(b.2)
-  factor_FOMC_SFO <- round(b.2["1", "relative"])
-} else {
-  factor_FOMC_SFO <- NA
-  print("R package benchmark is not available")
-}
+
if (require(rbenchmark)) {
+  FOMC_SFO <- mkinmod(
+    parent = mkinsub("FOMC", "m1"),
+    m1 = mkinsub( "SFO"))
+
+  b.2 <- benchmark(
+    "deSolve, not compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D,
+                                      use_compiled = FALSE, quiet = TRUE),
+    "deSolve, compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE),
+    replications = 3)
+  print(b.2)
+  factor_FOMC_SFO <- round(b.2["1", "relative"])
+} else {
+  factor_FOMC_SFO <- NA
+  print("R package benchmark is not available")
+}
## Successfully compiled differential equation model from auto-generated C code.
+
## Warning in mkinfit(FOMC_SFO, FOCUS_2006_D, use_compiled = FALSE, quiet =
+## TRUE): Observations with value of zero were removed from the data
+
## Warning in mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE): Observations with
+## value of zero were removed from the data
+
## Warning in mkinfit(FOMC_SFO, FOCUS_2006_D, use_compiled = FALSE, quiet =
+## TRUE): Observations with value of zero were removed from the data
+
+## Warning in mkinfit(FOMC_SFO, FOCUS_2006_D, use_compiled = FALSE, quiet =
+## TRUE): Observations with value of zero were removed from the data
+
+## Warning in mkinfit(FOMC_SFO, FOCUS_2006_D, use_compiled = FALSE, quiet =
+## TRUE): Observations with value of zero were removed from the data
+
## Warning in mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE): Observations with
+## value of zero were removed from the data
+
+## Warning in mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE): Observations with
+## value of zero were removed from the data
+
+## Warning in mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE): Observations with
+## value of zero were removed from the data
##                    test replications elapsed relative user.self sys.self
-## 2     deSolve, compiled            3   4.074    1.000     4.072        0
-## 1 deSolve, not compiled            3  37.219    9.136    37.203        0
+## 2     deSolve, compiled            3   4.906    1.000     4.902        0
+## 1 deSolve, not compiled            3  70.459   14.362    70.421        0
 ##   user.child sys.child
 ## 2          0         0
 ## 1          0         0
-

Here we get a performance benefit of a factor of 9 using the version of the differential equation model compiled from C code!

-

This vignette was built with mkin 0.9.48.1 on

-
## R version 3.5.2 (2018-12-20)
+

Here we get a performance benefit of a factor of 14 using the version of the differential equation model compiled from C code!

+

This vignette was built with mkin 0.9.49.4 on

+
## R version 3.5.3 (2019-03-11)
 ## Platform: x86_64-pc-linux-gnu (64-bit)
 ## Running under: Debian GNU/Linux 9 (stretch)
## CPU model: AMD Ryzen 7 1700 Eight-Core Processor
-- cgit v1.2.1