[R-pkg-devel] callr and CRAN policy on the max number of cores

Henrik Bengtsson henr|k@bengt@@on @end|ng |rom gm@||@com
Thu May 23 05:45:36 CEST 2024


Two parallel processes are okay, so you can use two callr background
processes ("children"), as long as you don't do heavy computations on
the main R process ("parent"). This is commonly done in many R
packages, e.g.

library(parallel)
cl <- makeCluster(2)
y <- parLapply(cl = cl, X = 1:10, fun = slow_fcn)
stopCluster(cl)

/Henrik

On Wed, May 22, 2024 at 7:50 PM Shu Fai Cheung <shufai.cheung using gmail.com> wrote:
>
> Hil,
>
> I am exploring the use of callr in a package. I know that for packages
> that do parallel computing, we should not use more than two cores in
> examples, tests, etc. when being checked on CRAN.
>
> I believe I can use callr in tests and examples. How should I use
> callr in compliance with CRAN policy? Because even just one call to
> callr will start a new R session, should I limit the use of callr such
> that at any one time, only one background R session created by callr
> is active?
>
> Regards,
> Shu Fai
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list