vallotlab / ChromSCape

ChromSCape
https://vallotlab.github.io/ChromSCape/
14 stars 8 forks source link

availableCores(omit = 1) is safer than availableCores() - 1 #5

Closed HenrikBengtsson closed 2 years ago

HenrikBengtsson commented 2 years ago

Hi, through my revdep checking of parallelly, I spotted:

https://github.com/vallotlab/ChromSCape/blob/a27fbaad2852800c90573460e638292f3e9f618f/R/preprocessing_filtering_reduction.R#L543

Note that some systems are single-core machines, e.g. some containers and free RStudio Cloud accounts. See https://parallelly.futureverse.org/#availablecores-vs-paralleldetectcores for why availableCores(omit = 1) is a better choice here.

Related, you probably also want to use availableCores() rather than detectCores() in

https://github.com/vallotlab/ChromSCape/blob/a27fbaad2852800c90573460e638292f3e9f618f/inst/ui.R#L83

for reasons like the ones above, e.g. detectCores() is not truthful for RStudio Cloud, cf. https://community.rstudio.com/t/setting-parallel-computing-in-rstudio-cloud/133445/4

Pacomito commented 2 years ago

Hello Henrik,

Thank you very much for the recommandations ! I now have replaced the call to availableCores and detectCores with your recommandations in f87fe5c056bdcd6dd8ea5390277281f613fecdf6 .

Best, Pacome

HenrikBengtsson commented 2 years ago

Great. Thxs.

BTW, availableCores() has moved to parallelly and is only re-exported from future these days and will in some far future be dropped from future, so it's a better to use parallelly::availableCores() here.

Pacomito commented 2 years ago

Okay, Thank you, Pacome