Those are my first steps with parallel computing in R. The code below results in the following error. I am clueless, since there is no mclapply function in what I wrote, at least I did not put it explicitly.
Error:
Error in mclapply(argsList, FUN, mc.preschedule = preschedule, mc.set.seed = set.seed, :
(list) object cannot be coerced to type 'integer'
Calls: %dopar% -> <Anonymous> -> mclapply
Execution halted
Code:
dist<-array(0, dim=c(320,500,25))
mc<-8
cl<-makeCluster(mc)
registerDoMC(cl)
opts<-list(chunkSize=10)
for(a in 1:25) {
dist[,,a]<-foreach(x=1:500, .combine='cbind', .options.mc=opts) %:%
foreach(y=1:320, .combine='c') %dopar% {
gcd.slc(crdsx[y,x], crdsy[y,x], lot[a,5], lot[a,4])
}
}
stopCluster(cl)
On a different machine, it works nicely with
registerDoParallel(cl)
instead of
registerDoMC(cl)