amices / mice

Multivariate Imputation by Chained Equations
https://amices.org/mice/
GNU General Public License v2.0
447 stars 108 forks source link

WISH: Avoid parallel::detectCores() #542

Closed HenrikBengtsson closed 1 year ago

HenrikBengtsson commented 1 year ago

Hello,

please avoid using parallel::detectCores() to infer how many CPU cores there are available to R. For example, when this is used on a machine where multiple users or multiple processes are running, it risks overloading the machine making it sluggish or even bringing the machine to a near halt, causing all users to suffer. It also does not respect settings in Linux containers and environments like the RStudio Cloud. See https://www.jottr.org/2022/12/05/avoid-detectcores/ for further arguments against relying on parallel::detectCores().

(Disclaimer: I'm the author). You could use parallelly::availableCores() instead. It is backward compatible with parallel::detectCores(), but is also agile to a lot more settings, so it's less likely to cause damage.

gerkovink commented 1 year ago

Thanks! The function where parallel::detectCores() is invoked is deprecated. The respective function has been superseded by futuremice().

Will change, though.

stefvanbuuren commented 1 year ago

futuremice() uses the availableCores routine. I think it is not worthwhile anymore to change it in the deprecated parlmice(), so I am closing.