From c6759635fbea7f541d421b3de78f0d8868856486 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Tue, 23 Jun 2015 11:44:00 +0200 Subject: Vignettes rebuilt by staticdocs::build_site() for static documentation on r-forge --- vignettes/compiled_models.html | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'vignettes/compiled_models.html') diff --git a/vignettes/compiled_models.html b/vignettes/compiled_models.html index 8fb08136..814f3a52 100644 --- a/vignettes/compiled_models.html +++ b/vignettes/compiled_models.html @@ -10,7 +10,7 @@ - + Performance benefit by using compiled model definitions in mkin @@ -65,7 +65,7 @@ img {
@@ -77,7 +77,7 @@ img {

Benchmark for a model that can also be solved with Eigenvalues

-

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 compiler (gcc) is installed, you will see a message that the model is being compiled from autogenerated C code when defining a model using mkinmod. The package tests for presence of the gcc compiler using

+

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 mkinmod() function checks for presence of the gcc compiler using

Sys.which("gcc")
##            gcc 
 ## "/usr/bin/gcc"
@@ -86,7 +86,7 @@ img { SFO_SFO <- mkinmod( parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO")) -
## Compiling differential equation model from auto-generated C code...
+
## Successfully compiled differential equation model from auto-generated C code.

We can compare the performance of the Eigenvalue based solution against the compiled version and the R implementation of the differential equations using the microbenchmark package.

library("microbenchmark")
 mb.1 <- microbenchmark(
@@ -99,18 +99,18 @@ smb.1 <- summary(mb.1)[-1]
 rownames(smb.1) <- c("deSolve, not compiled", "Eigenvalue based", "deSolve, compiled")
 print(smb.1)
##                             min        lq      mean    median        uq
-## deSolve, not compiled 6896.8680 6933.3330 6963.5277 6969.7979 6996.8575
-## Eigenvalue based       933.0581  937.8984  963.5002  942.7388  978.7213
-## deSolve, compiled      784.9729  807.9919  822.4500  831.0110  841.1886
+## deSolve, not compiled 6650.2684 6684.4530 6774.1607 6718.6377 6836.1068
+## Eigenvalue based       903.5520  916.8598  927.3873  930.1676  939.3049
+## deSolve, compiled      751.1205  752.5239  756.1227  753.9273  758.6238
 ##                             max neval
-## deSolve, not compiled 7023.9171     3
-## Eigenvalue based      1014.7039     3
-## deSolve, compiled      851.3663     3
-

We see that using the compiled model is by a factor of 8.4 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:

+## deSolve, not compiled 6953.5760 3 +## Eigenvalue based 948.4423 3 +## deSolve, compiled 763.3202 3 +

We see that using the compiled model is by a factor of 8.9 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:

smb.1["median"]/smb.1["deSolve, compiled", "median"]
##                         median
-## deSolve, not compiled 8.387131
-## Eigenvalue based      1.134448
+## deSolve, not compiled 8.911519
+## Eigenvalue based      1.233763
 ## deSolve, compiled     1.000000
@@ -119,7 +119,7 @@ print(smb.1)
FOMC_SFO <- mkinmod(
   parent = mkinsub("FOMC", "m1"),
   m1 = mkinsub( "SFO"))
-
## Compiling differential equation model from auto-generated C code...
+
## Successfully compiled differential equation model from auto-generated C code.
mb.2 <- microbenchmark(
   mkinfit(FOMC_SFO, FOCUS_2006_D, use_compiled = FALSE, quiet = TRUE),
   mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE),
@@ -127,17 +127,17 @@ print(smb.1)
smb.2 <- summary(mb.2)[-1] rownames(smb.2) <- c("deSolve, not compiled", "deSolve, compiled") print(smb.2) -
##                             min        lq      mean    median        uq
-## deSolve, not compiled 14.661881 14.668453 14.701870 14.675025 14.721864
-## deSolve, compiled      1.393051  1.394908  1.415653  1.396764  1.426953
+
##                            min        lq      mean    median        uq
+## deSolve, not compiled 14.32061 14.336413 14.380847 14.352216 14.410966
+## deSolve, compiled      1.34366  1.344778  1.371116  1.345897  1.384844
 ##                             max neval
-## deSolve, not compiled 14.768704     3
-## deSolve, compiled      1.457143     3
+## deSolve, not compiled 14.469716 3 +## deSolve, compiled 1.423791 3
smb.2["median"]/smb.2["deSolve, compiled", "median"]
##                         median
-## deSolve, not compiled 10.50644
+## deSolve, not compiled 10.66368
 ## deSolve, compiled      1.00000
-

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

+

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

This vignette was built with mkin 0.9.37 on

## R version 3.2.1 (2015-06-18)
 ## Platform: x86_64-pc-linux-gnu (64-bit)
-- 
cgit v1.2.1