diff --git a/vignettes/_fundiversity_1-parallel.Rmd b/vignettes/_fundiversity_1-parallel.Rmd index 93ebe5a..6ab5115 100644 --- a/vignettes/_fundiversity_1-parallel.Rmd +++ b/vignettes/_fundiversity_1-parallel.Rmd @@ -30,7 +30,7 @@ Within `fundiversity` the computation of most indices can be parallelized using ```{r child="../man/rmdchunks/_fundiversity_functions.Rmd"} ``` -Note that **memoization and parallelization cannot be used at the same time**. If the option `fundiversity.memoise` has been set to `TRUE` but the computation are parallelized, `fundiversity` will use unmemoised version of functions. +Note that **memoization and parallelization cannot be used at the same time**. If the option `fundiversity.memoise` has been set to `TRUE` but the computations are parallelized, `fundiversity` will use unmemoised versions of functions. The `future` package provides a simple and general framework to allow asynchronous computation depending on the resources available for the user. The [first vignette of `future`](https://cran.r-project.org/package=future) gives a general overview of all its features. The main idea being that the user should write the code once and that it would run seamlessly sequentially, or in parallel on a single computer, or on a cluster, or distributed over several computers. `fundiversity` can thus run on all these different backends following the user's choice. diff --git a/vignettes/fundiversity_1-parallel.Rmd b/vignettes/fundiversity_1-parallel.Rmd index 01cd41b..7dd8bd2 100644 --- a/vignettes/fundiversity_1-parallel.Rmd +++ b/vignettes/fundiversity_1-parallel.Rmd @@ -31,7 +31,7 @@ Within `fundiversity` the computation of most indices can be parallelized using [^1]: parallelization through the `future` backend please refer to the [parallelization vignette](https://funecology.github.io/fundiversity/articles/fundiversity_1-parallel.html) for details. [^2]: memoization means that the results of the functions calls are cached and not recomputed when recalled, to toggle it off see the `fundiversity::fd_fric()` [Details section](https://funecology.github.io/fundiversity/reference/fd_fric.html#details). -Note that **memoization and parallelization cannot be used at the same time**. If the option `fundiversity.memoise` has been set to `TRUE` but the computation are parallelized, `fundiversity` will use unmemoised version of functions. +Note that **memoization and parallelization cannot be used at the same time**. If the option `fundiversity.memoise` has been set to `TRUE` but the computations are parallelized, `fundiversity` will use unmemoised versions of functions. The `future` package provides a simple and general framework to allow asynchronous computation depending on the resources available for the user. The [first vignette of `future`](https://cran.r-project.org/package=future) gives a general overview of all its features. The main idea being that the user should write the code once and that it would run seamlessly sequentially, or in parallel on a single computer, or on a cluster, or distributed over several computers. `fundiversity` can thus run on all these different backends following the user's choice. @@ -98,9 +98,9 @@ parallel_bench <- microbenchmark::microbenchmark( rbind(non_parallel_bench, parallel_bench) #> Unit: milliseconds -#> expr min lq mean median uq max neval cld -#> non_parallel 12.3267 13.3452 15.03753 14.7037 15.84075 20.0802 20 a -#> parallel 178.1048 188.8670 259.66154 211.7129 219.97645 1312.2693 20 b +#> expr min lq mean median uq max neval cld +#> non_parallel 8.9509 9.2691 14.93812 13.32405 18.4841 33.153 20 a +#> parallel 224.7037 248.9997 345.59427 274.59615 304.6889 1660.164 20 b ``` The non parallelized code runs faster than the parallelized one! Indeed, the parallelization in `fundiversity` parallelize the computation across different sites. So parallelization should be used when you have many sites on which you want to compute similar indices. @@ -137,10 +137,10 @@ microbenchmark::microbenchmark( }, times = 20 ) #> Unit: seconds -#> expr min lq mean median uq max neval cld -#> seq 114.82322 117.47735 149.55998 163.00871 167.59926 184.8759 20 a -#> multisession 54.77985 64.59042 70.99131 67.62465 74.16261 119.5938 20 b -#> multicore 116.11616 160.90286 159.18414 163.86793 166.77678 173.3062 20 a +#> expr min lq mean median uq max neval cld +#> seq 78.13766 195.17853 184.92560 196.89360 197.90500 200.56116 20 a +#> multisession 34.23402 54.44036 53.39172 54.88206 55.19359 61.83829 20 b +#> multicore 75.43857 192.45136 183.07222 196.48277 201.16889 209.39847 20 a ```
@@ -148,8 +148,8 @@ microbenchmark::microbenchmark( ``` -#> seconds needed to generate this document: 7610.61 sec elapsed -#> ─ Session info ──────────────────────────────────────────────────────────────────── +#> seconds needed to generate this document: 8443.78 sec elapsed +#> ─ Session info ────────────────────────────────────────────────────────────────────────────────────────────────────────────────── #> setting value #> version R version 4.3.1 (2023-06-16 ucrt) #> os Windows 11 x64 (build 22631) @@ -159,23 +159,22 @@ microbenchmark::microbenchmark( #> collate French_France.utf8 #> ctype fr_FR.UTF-8 #> tz Europe/Paris -#> date 2024-03-20 +#> date 2024-03-26 #> rstudio 2023.12.1+402 Ocean Storm (desktop) #> pandoc 3.1.1 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown) #> -#> ─ Packages ──────────────────────────────────────────────────────────────────────── +#> ─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── #> ! package * version date (UTC) lib source #> abind 1.4-5 2016-07-21 [1] CRAN (R 4.3.0) -#> brio 1.1.4 2023-12-10 [1] CRAN (R 4.3.2) #> cachem 1.0.8 2023-05-01 [1] CRAN (R 4.3.1) #> cli 3.6.2 2023-12-11 [1] CRAN (R 4.3.2) #> cluster 2.1.6 2023-12-01 [1] CRAN (R 4.3.2) #> codetools 0.2-19 2023-02-01 [2] CRAN (R 4.3.1) #> commonmark 1.9.1 2024-01-30 [1] CRAN (R 4.3.2) #> crayon 1.5.2 2022-09-29 [1] CRAN (R 4.3.1) +#> curl 5.2.1 2024-03-01 [1] CRAN (R 4.3.3) #> desc 1.4.3 2023-12-10 [1] CRAN (R 4.3.2) #> devtools 2.4.5 2022-10-11 [1] CRAN (R 4.3.2) -#> diffobj 0.3.5 2021-10-05 [1] CRAN (R 4.3.2) #> digest 0.6.35 2024-03-11 [1] CRAN (R 4.3.3) #> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.3.1) #> evaluate 0.23 2023-11-01 [1] CRAN (R 4.3.2) @@ -186,17 +185,20 @@ microbenchmark::microbenchmark( #> future 1.33.1 2023-12-22 [1] CRAN (R 4.3.2) #> future.apply 1.11.1 2023-12-21 [1] CRAN (R 4.3.2) #> geometry 0.4.7 2023-02-03 [1] CRAN (R 4.3.1) +#> gh 1.4.0 2023-02-22 [1] CRAN (R 4.3.1) +#> gitcreds 0.1.2 2022-09-08 [1] CRAN (R 4.3.1) #> globals 0.16.3 2024-03-08 [1] CRAN (R 4.3.3) #> glue 1.7.0 2024-01-09 [1] CRAN (R 4.3.2) #> htmltools 0.5.7 2023-11-03 [1] CRAN (R 4.3.2) #> htmlwidgets 1.6.4 2023-12-06 [1] CRAN (R 4.3.2) #> httpuv 1.6.14 2024-01-26 [1] CRAN (R 4.3.2) +#> httr2 1.0.0 2023-11-14 [1] CRAN (R 4.3.2) +#> jsonlite 1.8.8 2023-12-04 [1] CRAN (R 4.3.2) #> knitr 1.45 2023-10-30 [1] CRAN (R 4.3.2) #> later 1.3.2 2023-12-06 [1] CRAN (R 4.3.2) #> lattice 0.22-5 2023-10-24 [1] CRAN (R 4.3.2) #> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.3.2) #> listenv 0.9.1 2024-01-29 [1] CRAN (R 4.3.2) -#> lpSolve 5.6.20 2023-12-10 [1] CRAN (R 4.3.2) #> magic 1.6-1 2022-11-16 [1] CRAN (R 4.3.0) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.1) #> MASS 7.3-60.0.1 2024-01-13 [1] CRAN (R 4.3.2) @@ -209,7 +211,6 @@ microbenchmark::microbenchmark( #> multcomp 1.4-25 2023-06-20 [1] CRAN (R 4.3.1) #> mvtnorm 1.2-4 2023-11-27 [1] CRAN (R 4.3.2) #> nlme 3.1-164 2023-11-27 [1] CRAN (R 4.3.2) -#> pak 0.7.2 2024-03-17 [1] CRAN (R 4.3.3) #> parallelly 1.37.1 2024-02-29 [1] CRAN (R 4.3.3) #> permute 0.9-7 2022-01-27 [1] CRAN (R 4.3.1) #> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.3.1) @@ -220,8 +221,8 @@ microbenchmark::microbenchmark( #> promises 1.2.1 2023-08-10 [1] CRAN (R 4.3.1) #> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.3.1) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.1) +#> rappdirs 0.3.3 2021-01-31 [1] CRAN (R 4.3.1) #> Rcpp 1.0.12 2024-01-09 [1] CRAN (R 4.3.2) -#> rematch2 2.1.2 2020-05-01 [1] CRAN (R 4.3.1) #> remotes 2.5.0 2024-03-17 [1] CRAN (R 4.3.3) #> rlang 1.1.3 2024-01-10 [1] CRAN (R 4.3.2) #> rmarkdown 2.26 2024-03-05 [1] CRAN (R 4.3.3) @@ -234,7 +235,6 @@ microbenchmark::microbenchmark( #> stringi 1.8.3 2023-12-11 [1] CRAN (R 4.3.2) #> stringr 1.5.1 2023-11-14 [1] CRAN (R 4.3.2) #> survival 3.5-8 2024-02-14 [1] CRAN (R 4.3.3) -#> testthat * 3.2.1 2023-12-02 [1] CRAN (R 4.3.2) #> TH.data 1.1-2 2023-04-17 [1] CRAN (R 4.3.1) #> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.3.1) #> tictoc 1.2.1 2024-03-18 [1] CRAN (R 4.3.3) @@ -243,7 +243,6 @@ microbenchmark::microbenchmark( #> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.3.2) #> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.3.2) #> vegan 2.6-4 2022-10-11 [1] CRAN (R 4.3.1) -#> waldo 0.5.2 2023-11-02 [1] CRAN (R 4.3.2) #> withr 3.0.0 2024-01-16 [1] CRAN (R 4.3.2) #> xfun 0.42 2024-02-08 [1] CRAN (R 4.3.3) #> xml2 1.3.6 2023-12-04 [1] CRAN (R 4.3.2) @@ -256,7 +255,7 @@ microbenchmark::microbenchmark( #> #> P ── Loaded and on-disk path mismatch. #> -#> ─────────────────────────────────────────────────────────────────────────────────── +#> ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ```