From 524a8bba89b95840b4e9215c403947a8bb76d7b2 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 30 Nov 2020 16:05:10 +0100 Subject: Complete rebuild of static docs of dev version --- docs/dev/articles/web_only/compiled_models.html | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'docs/dev/articles/web_only/compiled_models.html') diff --git a/docs/dev/articles/web_only/compiled_models.html b/docs/dev/articles/web_only/compiled_models.html index 3d1c7fcd..a444f4bc 100644 --- a/docs/dev/articles/web_only/compiled_models.html +++ b/docs/dev/articles/web_only/compiled_models.html @@ -102,7 +102,7 @@

Performance benefit by using compiled model definitions in mkin

Johannes Ranke

-

2020-11-19

+

2020-11-30

Source: vignettes/web_only/compiled_models.rmd @@ -134,9 +134,9 @@
 library("mkin", quietly = TRUE)
 SFO_SFO <- mkinmod(
-  parent = mkinsub("SFO", "m1"),
-  m1 = mkinsub("SFO"))
-
## Successfully compiled differential equation model from auto-generated C code.
+ parent = mkinsub("SFO", "m1"), + m1 = mkinsub("SFO")) +
## Temporary DLL for differentials generated and loaded
 FOCUS_D <- subset(FOCUS_2006_D, value != 0)

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. In the output of below code, the warnings about zero being removed from the FOCUS D dataset are suppressed. Since mkin version 0.9.49.11, an analytical solution is also implemented, which is included in the tests below.

@@ -160,10 +160,10 @@ print("R package rbenchmark is not available") }
##                    test replications relative elapsed
-## 4            analytical            1    1.000   0.186
-## 3     deSolve, compiled            1    1.742   0.324
-## 2      Eigenvalue based            1    2.048   0.381
-## 1 deSolve, not compiled            1   42.532   7.911
+## 4 analytical 1 1.000 0.187 +## 3 deSolve, compiled 1 1.807 0.338 +## 2 Eigenvalue based 1 2.032 0.380 +## 1 deSolve, not compiled 1 43.048 8.050

We see that using the compiled model is by more than a factor of 10 faster than using deSolve without compiled code.

@@ -173,8 +173,8 @@
 if (require(rbenchmark)) {
   FOMC_SFO <- mkinmod(
-    parent = mkinsub("FOMC", "m1"),
-    m1 = mkinsub( "SFO"))
+    parent = mkinsub("FOMC", "m1"),
+    m1 = mkinsub( "SFO"))
 
   b.2 <- benchmark(
     "deSolve, not compiled" = mkinfit(FOMC_SFO, FOCUS_D,
@@ -188,11 +188,11 @@
   factor_FOMC_SFO <- NA
   print("R package benchmark is not available")
 }
-
## Successfully compiled differential equation model from auto-generated C code.
+
## Temporary DLL for differentials generated and loaded
##                    test replications relative elapsed
-## 2     deSolve, compiled            1    1.000   0.465
-## 1 deSolve, not compiled            1   30.852  14.346
-

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

+## 2 deSolve, compiled 1 1.000 0.483 +## 1 deSolve, not compiled 1 29.969 14.475 +

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

This vignette was built with mkin 0.9.50.4 on

## R version 4.0.3 (2020-10-10)
 ## Platform: x86_64-pc-linux-gnu (64-bit)
-- 
cgit v1.2.1