Re: [Rd] mclapply returns NULLs on MacOS when running GAM

2020-04-29 Thread Jan Gorecki
> PS. Simon, I think your explicit comment on mcparallel() & friends is very helpful for many people and developers. It clearly tells developers to never use mclapply() as the only path through their code. I'm quite sure not everyone has been or is aware of this. Now it's clear. Thank you. I secon

Re: [Rd] mclapply returns NULLs on MacOS when running GAM

2020-04-28 Thread Henrik Bengtsson
On Tue, Apr 28, 2020 at 9:00 PM Shian Su wrote: > > Thanks Simon, > > I will take note of the sensible default for core usage. I’m trying to > achieve small scale parallelism, where tasks take 1-5 seconds and make fuller > use of consumer hardware. Its not a HPC-worthy computation but even lapto

Re: [Rd] mclapply returns NULLs on MacOS when running GAM

2020-04-28 Thread Shian Su
Thanks Simon, I will take note of the sensible default for core usage. I’m trying to achieve small scale parallelism, where tasks take 1-5 seconds and make fuller use of consumer hardware. Its not a HPC-worthy computation but even laptops these days come with 4 cores and I don’t see a reason to

Re: [Rd] mclapply returns NULLs on MacOS when running GAM

2020-04-28 Thread Simon Urbanek
Do NOT use mcparallel() in packages except as a non-default option that user can set for the reasons Henrik explained. Multicore is intended for HPC applications that need to use many cores for computing-heavy jobs, but it does not play well with RStudio and more importantly you don't know the r

Re: [Rd] mclapply returns NULLs on MacOS when running GAM

2020-04-28 Thread Shian Su
Thanks Henrik, That clears things up significantly. I did see the warning but failed to include it my initial email. It sounds like an RStudio issue, and it seems like that it’s quite intrinsic to how forks interact with RStudio. Given this code is eventually going to be a part of a package, sh

Re: [Rd] mclapply returns NULLs on MacOS when running GAM

2020-04-28 Thread Henrik Bengtsson
Hi, a few comments below. First, from my experience and troubleshooting similar reports from others, a returned NULL from parallel::mclapply() is often because the corresponding child process crashed/died. However, when this happens you should see a warning, e.g. > y <- parallel::mclapply(1:2, FU

Re: [Rd] mclapply returns NULLs on MacOS when running GAM

2020-04-28 Thread Shian Su
Yes I am running on Rstudio 1.2.5033. I was also running this code without error on Ubuntu in Rstudio. Checking again on the terminal and it does indeed work fine even with large data.frames. Any idea as to what interaction between Rstudio and mclapply causes this? Thanks, Shian On 28 Apr 2020

Re: [Rd] mclapply returns NULLs on MacOS when running GAM

2020-04-28 Thread Simon Urbanek
Sorry, the code works perfectly fine for me in R even for 1e6 observations (but I was testing with R 4.0.0). Are you using some kind of GUI? Cheers, Simon > On 28/04/2020, at 8:11 PM, Shian Su wrote: > > Dear R-devel, > > I am experiencing issues with running GAM models using mclapply, it fa

[Rd] mclapply returns NULLs on MacOS when running GAM

2020-04-28 Thread Shian Su
Dear R-devel, I am experiencing issues with running GAM models using mclapply, it fails to return any values if the data input becomes large. For example here the code runs fine with a df of 100 rows, but fails at 1000. library(mgcv) library(parallel) > df <- data.frame( + x = 1:100, +