Skip to content

Commit

Permalink
Modifications on parallelization vignette.
Browse files Browse the repository at this point in the history
  • Loading branch information
ManonSimonot committed Jan 15, 2025
1 parent 022ca08 commit 1a9adb4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Binary file modified R/sysdata.rda
Binary file not shown.
Binary file modified data-raw/df_parallelization.rds
Binary file not shown.
8 changes: 4 additions & 4 deletions data-raw/parallelization-vignette.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ library(progressr)
library(tictoc)
library(flipr)

ngrid_in <- 50L
nperms <- 5000
ngrid_in <- 100L
nperms <- 2000
n1 <- 10
set.seed(1234)
x <- rnorm(n1, mean = 1, sd = 1)
Expand All @@ -35,12 +35,12 @@ pf <- PlausibilityFunction$new(
stat_assignments = stat_assignments,
x, y
)
pf$set_nperms(nperms)

tic()
pf$set_point_estimate()
time_without_parallel <- toc()$callback_msg

pf$set_nperms(nperms)
pf$set_parameter_bounds(
point_estimate = pf$point_estimate,
conf_level = pf$max_conf_level
Expand Down Expand Up @@ -69,12 +69,12 @@ pf <- PlausibilityFunction$new(
stat_assignments = stat_assignments,
x, y
)
pf$set_nperms(nperms)

tic()
pf$set_point_estimate()
time_with_parallel <- toc()$callback_msg

pf$set_nperms(nperms)
pf$set_parameter_bounds(
point_estimate = pf$point_estimate,
conf_level = pf$max_conf_level
Expand Down
9 changes: 5 additions & 4 deletions vignettes/parallelization.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pf <- PlausibilityFunction$new(
stat_assignments = stat_assignments,
x, y
)
pf$set_nperms(2000)
tic()
pf$set_point_estimate()
Expand All @@ -71,14 +72,13 @@ time_without_parallel
```

```{r, eval=FALSE}
pf$set_parameter_bounds(
point_estimate = pf$point_estimate,
conf_level = pf$max_conf_level
)
pf$set_grid(
parameters = pf$parameters,
npoints = 50L
npoints = 100L
)
tictoc::tic()
Expand Down Expand Up @@ -125,6 +125,7 @@ pf <- PlausibilityFunction$new(
stat_assignments = stat_assignments,
x, y
)
pf$set_nperms(2000)
tic()
pf$set_point_estimate()
Expand All @@ -142,7 +143,7 @@ pf$set_parameter_bounds(
)
pf$set_grid(
parameters = pf$parameters,
npoints = 50L
npoints = 100L
)
tictoc::tic()
Expand All @@ -165,7 +166,7 @@ processing tools, we reduced approximately by 3 times the computation time for
both computing a point estimation and evaluating the plausibility function.

Finally, to return to a sequential plan with no progress updates, the following
code can be used.
code can be used. It also allows to shut down the workers used in [**future**](https://future.futureverse.org/index.html).

```{r, eval=FALSE}
future::plan(future::sequential)
Expand Down

0 comments on commit 1a9adb4

Please sign in to comment.