mwelz / GenericML

R implementation of Generic Machine Learning Inference (Chernozhukov, Demirer, Duflo and Fernández-Val, 2020).
GNU General Public License v3.0
64 stars 14 forks source link

Stop cluster for Unix System #27

Open milena-git opened 2 years ago

milena-git commented 2 years ago

Hello,

First thank you for this great package.

I am running GenericML functions in parallel on a Unix system, and I noticed that the requested cores remained so if I did not stopped my R session after use (on a shared rstudio-server). I was wondering whether they wasn't a parallel::stopCluster missing in the GenericML package code, and I found this line in the R/across-learner.R script:

## stop cluster (if applicable)
 if(win) parallel::stopCluster(cl = cl)

So it seems that it is on purpose that stopCluster is not run on Unix system, only on windows (I am not familiar with the parallel package and its requirement).

I wonder whether there is a reason for not stopping the cluster on Unix system after the GenericML function call. I guess it is best practice to stop its R session when done, but in my specific case, it can be sometimes annoying, therefore the question.