I am trying to reproduce the example given in here:
https://stat.ethz.ch/R-manual/R-devel/library/mgcv/html/mgcv-parallel.html
Specifically, the use of the cluster= argument in mgcv::bam().
Reproducible example:
require(mgcv)
require(parallel)
k <- 13;bs <- "cr"; set.seed(9)
dat <- gamSim(1,n=6000,dist="poisson",scale=.1)
nc <- 2 ## cluster size, set for example portability
if (detectCores()>1) { ## no point otherwise
cl <- makeCluster(nc)
} else cl <- NULL
system.time(b3 <- bam(y ~ s(x0,bs=bs,k=7)+s(x1,bs=bs,k=7)+s(x2,bs=bs,k=k)
,data=dat,family=poisson(),chunk.size=5000,cluster=cl))
This results in the following error on my machine:
Error in checkForRemoteErrors(val) : 2 nodes produced errors; first error: no applicable method for 'predict' applied to an object of class "gam" Timing stopped at: 0.31 0 0.37
Other information which may be of use:
R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
My machine has 4 cores and 16 GB RAM.
Thank you.
parallel 3.5.1
andmgcv 1.8.27
andR 3.5.1
and I get a proper result. Maybe updating the packages may help? – thothal