diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2022-07-12 12:10:59 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2022-07-12 12:10:59 +0200 |
commit | d7d5b31e9352090fa598f50979d706d8e753ef9c (patch) | |
tree | f504bd9c70e9ff9abc33c123f8fe1088bb4eca93 | |
parent | 17bab8422795379a3cd40d6e5d0482e995a0d2f5 (diff) |
Rerun benchmarks on desktop computer
-rw-r--r-- | docs/articles/web_only/benchmarks.html | 31 | ||||
-rw-r--r-- | docs/pkgdown.yml | 2 | ||||
-rw-r--r-- | vignettes/mkin.html | 12 | ||||
-rw-r--r-- | vignettes/web_only/benchmarks.R | 112 | ||||
-rw-r--r-- | vignettes/web_only/benchmarks.html | 51 | ||||
-rw-r--r-- | vignettes/web_only/mkin_benchmarks.rda | bin | 1419 -> 1483 bytes |
6 files changed, 193 insertions, 15 deletions
diff --git a/docs/articles/web_only/benchmarks.html b/docs/articles/web_only/benchmarks.html index 2f7730bd..4e0cbba7 100644 --- a/docs/articles/web_only/benchmarks.html +++ b/docs/articles/web_only/benchmarks.html @@ -105,7 +105,7 @@ <h1 data-toc-skip>Benchmark timings for mkin</h1> <h4 data-toc-skip class="author">Johannes Ranke</h4> - <h4 data-toc-skip class="date">Last change 1 July 2022 (rebuilt 2022-07-08)</h4> + <h4 data-toc-skip class="date">Last change 1 July 2022 (rebuilt 2022-07-12)</h4> <small class="dont-index">Source: <a href="https://github.com/jranke/mkin/blob/HEAD/vignettes/web_only/benchmarks.rmd" class="external-link"><code>vignettes/web_only/benchmarks.rmd</code></a></small> <div class="hidden name"><code>benchmarks.rmd</code></div> @@ -317,6 +317,14 @@ <td align="right">1.644</td> <td align="right">3.172</td> </tr> +<tr class="even"> +<td align="left">Linux</td> +<td align="left">Ryzen 7 1700</td> +<td align="left">4.2.1</td> +<td align="left">1.1.1</td> +<td align="right">1.809</td> +<td align="right">3.468</td> +</tr> </tbody> </table> </div> @@ -470,6 +478,15 @@ <td align="right">5.839</td> <td align="right">2.444</td> </tr> +<tr class="even"> +<td align="left">Linux</td> +<td align="left">Ryzen 7 1700</td> +<td align="left">4.2.1</td> +<td align="left">1.1.1</td> +<td align="right">1.336</td> +<td align="right">5.820</td> +<td align="right">2.621</td> +</tr> </tbody> </table> </div> @@ -671,6 +688,18 @@ <td align="right">1.658</td> <td align="right">2.472</td> </tr> +<tr class="even"> +<td align="left">Linux</td> +<td align="left">Ryzen 7 1700</td> +<td align="left">4.2.1</td> +<td align="left">1.1.1</td> +<td align="right">0.707</td> +<td align="right">1.148</td> +<td align="right">1.339</td> +<td align="right">2.812</td> +<td align="right">1.752</td> +<td align="right">2.594</td> +</tr> </tbody> </table> </div> diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 19332d6b..87309c06 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -11,7 +11,7 @@ articles: benchmarks: web_only/benchmarks.html compiled_models: web_only/compiled_models.html dimethenamid_2018: web_only/dimethenamid_2018.html -last_built: 2022-07-08T15:33Z +last_built: 2022-07-12T10:10Z urls: reference: https://pkgdown.jrwb.de/mkin/reference article: https://pkgdown.jrwb.de/mkin/articles diff --git a/vignettes/mkin.html b/vignettes/mkin.html index 1f35e9bd..0d5ed6fc 100644 --- a/vignettes/mkin.html +++ b/vignettes/mkin.html @@ -1303,6 +1303,8 @@ window.initializeCodeFolding = function(show) { // select all R code blocks var rCodeBlocks = $('pre.r, pre.python, pre.bash, pre.sql, pre.cpp, pre.stan, pre.julia, pre.foldable'); rCodeBlocks.each(function() { + // skip if the block has fold-none class + if ($(this).hasClass('fold-none')) return; // create a collapsable div to wrap the code in var div = $('<div class="collapse r-code-collapse"></div>'); @@ -1318,7 +1320,9 @@ window.initializeCodeFolding = function(show) { showCodeButton.append(showCodeText); showCodeButton .attr('data-toggle', 'collapse') + .attr('data-bs-toggle', 'collapse') // BS5 .attr('data-target', '#' + id) + .attr('data-bs-target', '#' + id) // BS5 .attr('aria-expanded', showThis) .attr('aria-controls', id); @@ -1402,6 +1406,7 @@ if (window.hljs) { + <style type="text/css"> .main-container { max-width: 940px; @@ -1423,6 +1428,9 @@ button.code-folding-btn:focus { summary { display: list-item; } +details > summary > p:only-child { + display: inline; +} pre code { padding: 0; } @@ -1580,7 +1588,7 @@ div.tocify { <div id="header"> <div class="btn-group pull-right float-right"> -<button type="button" class="btn btn-default btn-xs btn-secondary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span>Code</span> <span class="caret"></span></button> +<button type="button" class="btn btn-default btn-xs btn-secondary btn-sm dropdown-toggle" data-toggle="dropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span>Code</span> <span class="caret"></span></button> <ul class="dropdown-menu dropdown-menu-right" style="min-width: 50px;"> <li><a id="rmd-show-all-code" href="#">Show All Code</a></li> <li><a id="rmd-hide-all-code" href="#">Hide All Code</a></li> @@ -1591,7 +1599,7 @@ div.tocify { <h1 class="title toc-ignore">Introduction to mkin</h1> <h4 class="author">Johannes Ranke</h4> -<h4 class="date">Last change 15 February 2021 (rebuilt 2022-03-02)</h4> +<h4 class="date">Last change 15 February 2021 (rebuilt 2022-07-12)</h4> </div> diff --git a/vignettes/web_only/benchmarks.R b/vignettes/web_only/benchmarks.R new file mode 100644 index 00000000..c9ba5be3 --- /dev/null +++ b/vignettes/web_only/benchmarks.R @@ -0,0 +1,112 @@ +## ---- include = FALSE--------------------------------------------------------- +library(knitr) +opts_chunk$set(tidy = FALSE, cache = FALSE) +library("mkin") + +## ----include = FALSE---------------------------------------------------------- +cpu_model <- benchmarkme::get_cpu()$model_name +# Abbreviate CPU identifiers +cpu_model <- gsub("AMD ", "", cpu_model) +cpu_model <- gsub("Intel\\(R\\) Core\\(TM\\) ", "", cpu_model) +cpu_model <- gsub(" Eight-Core Processor", "", cpu_model) +cpu_model <- gsub(" CPU @ 2.50GHz", "", cpu_model) + +operating_system <- Sys.info()[["sysname"]] +mkin_version <- as.character(packageVersion("mkin")) +R_version <- paste0(R.version$major, ".", R.version$minor) +system_string <- paste0(operating_system, ", ", cpu_model, ", mkin ", mkin_version, ", R ", R_version) + +benchmark_path = normalizePath("~/git/mkin/vignettes/web_only/mkin_benchmarks.rda") +load(benchmark_path) + +# Used for reformatting the data on 2022-06-30 +# mkin_benchmarks[, "R"] <- NA +# mkin_benchmarks <- mkin_benchmarks[c(2, 1, 15, 3, 4:14)] +# mkin_benchmarks[, "CPU"] <- gsub("AMD.*", "Ryzen 7 1700", mkin_benchmarks[, "CPU"]) +# mkin_benchmarks[, "CPU"] <- gsub("Intel.*", "i7-4710MQ", mkin_benchmarks[, "CPU"]) +# rownames(mkin_benchmarks) <- gsub("AMD Ryzen 7 1700 Eight-Core Processor", "Ryzen 7 1700", rownames(mkin_benchmarks)) +# rownames(mkin_benchmarks) <- gsub("Intel\\(R\\) Core\\(TM\\) i7-4710MQ CPU @ 2.50GHz", "i7-4710MQ", rownames(mkin_benchmarks)) +# rownames(mkin_benchmarks) <- gsub(" version", "", rownames(mkin_benchmarks)) + +mkin_benchmarks[system_string, c("CPU", "OS", "mkin", "R")] <- + c(cpu_model, operating_system, mkin_version, R_version) + +if (mkin_version > "0.9.48.1") { + mmkin_bench <- function(models, datasets, error_model = "const") { + mmkin(models, datasets, error_model = error_model, cores = 1, quiet = TRUE) + } +} else { + mmkin_bench <- function(models, datasets, error_model = NULL) { + mmkin(models, datasets, reweight.method = error_model, cores = 1, quiet = TRUE) + } +} + +## ----parent_only, warning = FALSE--------------------------------------------- +FOCUS_C <- FOCUS_2006_C +FOCUS_D <- subset(FOCUS_2006_D, value != 0) +parent_datasets <- list(FOCUS_C, FOCUS_D) + +t1 <- system.time(mmkin_bench(c("SFO", "FOMC", "DFOP", "HS"), parent_datasets))[["elapsed"]] +t2 <- system.time(mmkin_bench(c("SFO", "FOMC", "DFOP", "HS"), parent_datasets, + error_model = "tc"))[["elapsed"]] + +## ----one_metabolite, message = FALSE------------------------------------------ +SFO_SFO <- mkinmod( + parent = mkinsub("SFO", "m1"), + m1 = mkinsub("SFO")) +FOMC_SFO <- mkinmod( + parent = mkinsub("FOMC", "m1"), + m1 = mkinsub("SFO")) +DFOP_SFO <- mkinmod( + parent = mkinsub("FOMC", "m1"), + m1 = mkinsub("SFO")) +t3 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D)))[["elapsed"]] +t4 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D), + error_model = "tc"))[["elapsed"]] +t5 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D), + error_model = "obs"))[["elapsed"]] + +## ----two_metabolites, message = FALSE----------------------------------------- +m_synth_SFO_lin <- mkinmod(parent = mkinsub("SFO", "M1"), + M1 = mkinsub("SFO", "M2"), + M2 = mkinsub("SFO"), + use_of_ff = "max", quiet = TRUE) + +m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")), + M1 = mkinsub("SFO"), + M2 = mkinsub("SFO"), + use_of_ff = "max", quiet = TRUE) + +SFO_lin_a <- synthetic_data_for_UBA_2014[[1]]$data + +DFOP_par_c <- synthetic_data_for_UBA_2014[[12]]$data + +t6 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a)))[["elapsed"]] +t7 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c)))[["elapsed"]] + +t8 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a), + error_model = "tc"))[["elapsed"]] +t9 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c), + error_model = "tc"))[["elapsed"]] + +t10 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a), + error_model = "obs"))[["elapsed"]] +t11 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c), + error_model = "obs"))[["elapsed"]] + +## ----results------------------------------------------------------------------ +mkin_benchmarks[system_string, paste0("t", 1:11)] <- + c(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) +save(mkin_benchmarks, file = benchmark_path) +# Hide rownames from kable for results section +rownames(mkin_benchmarks) <- NULL + +## ---- echo = FALSE------------------------------------------------------------ +kable(mkin_benchmarks[, c(1:4, 5:6)]) + +## ---- echo = FALSE------------------------------------------------------------ +kable(mkin_benchmarks[, c(1:4, 7:9)]) + +## ---- echo = FALSE------------------------------------------------------------ +kable(mkin_benchmarks[, c(1:4, 10:15)]) + diff --git a/vignettes/web_only/benchmarks.html b/vignettes/web_only/benchmarks.html index 9923a8fa..4afe49c4 100644 --- a/vignettes/web_only/benchmarks.html +++ b/vignettes/web_only/benchmarks.html @@ -1599,7 +1599,7 @@ div.tocify { <h1 class="title toc-ignore">Benchmark timings for mkin</h1> <h4 class="author">Johannes Ranke</h4> -<h4 class="date">Last change 1 July 2022 (rebuilt 2022-07-08)</h4> +<h4 class="date">Last change 1 July 2022 (rebuilt 2022-07-12)</h4> </div> @@ -1799,8 +1799,16 @@ rownames(mkin_benchmarks) <- NULL</code></pre> <td align="left">i7-4710MQ</td> <td align="left">4.2.1</td> <td align="left">1.1.1</td> -<td align="right">1.592</td> -<td align="right">3.101</td> +<td align="right">1.644</td> +<td align="right">3.172</td> +</tr> +<tr class="even"> +<td align="left">Linux</td> +<td align="left">Ryzen 7 1700</td> +<td align="left">4.2.1</td> +<td align="left">1.1.1</td> +<td align="right">1.767</td> +<td align="right">3.396</td> </tr> </tbody> </table> @@ -1952,9 +1960,18 @@ rownames(mkin_benchmarks) <- NULL</code></pre> <td align="left">i7-4710MQ</td> <td align="left">4.2.1</td> <td align="left">1.1.1</td> -<td align="right">1.198</td> -<td align="right">5.740</td> -<td align="right">2.388</td> +<td align="right">1.230</td> +<td align="right">5.839</td> +<td align="right">2.444</td> +</tr> +<tr class="even"> +<td align="left">Linux</td> +<td align="left">Ryzen 7 1700</td> +<td align="left">4.2.1</td> +<td align="left">1.1.1</td> +<td align="right">1.320</td> +<td align="right">5.774</td> +<td align="right">2.575</td> </tr> </tbody> </table> @@ -2151,12 +2168,24 @@ rownames(mkin_benchmarks) <- NULL</code></pre> <td align="left">i7-4710MQ</td> <td align="left">4.2.1</td> <td align="left">1.1.1</td> -<td align="right">0.652</td> -<td align="right">1.089</td> +<td align="right">0.678</td> +<td align="right">1.095</td> <td align="right">1.149</td> -<td align="right">3.205</td> -<td align="right">1.635</td> -<td align="right">2.444</td> +<td align="right">3.247</td> +<td align="right">1.658</td> +<td align="right">2.472</td> +</tr> +<tr class="even"> +<td align="left">Linux</td> +<td align="left">Ryzen 7 1700</td> +<td align="left">4.2.1</td> +<td align="left">1.1.1</td> +<td align="right">0.700</td> +<td align="right">1.146</td> +<td align="right">1.334</td> +<td align="right">2.807</td> +<td align="right">1.750</td> +<td align="right">2.593</td> </tr> </tbody> </table> diff --git a/vignettes/web_only/mkin_benchmarks.rda b/vignettes/web_only/mkin_benchmarks.rda Binary files differindex 3687ab8e..49a91664 100644 --- a/vignettes/web_only/mkin_benchmarks.rda +++ b/vignettes/web_only/mkin_benchmarks.rda |