Suppose that I want to do something in R that would normally (in one process/thread) look like this:
for(i in 1:2) {
for(j in 1:2) {
#Do some stuff here
}
}
Using R's new package parallel, on a quad core machine, can I do the following?
cluster<-makeCluster(4)
innerLoop<-function() {
#Do some stuff here
}
outerLoop<-function() {
result<-do.call(, parLapply(cluster, c(1:2), innerLoop))
}
final.result<-do.call(, parLapply(cluster, c(1:2), outerLoop))
Is this possible with the parallel package that comes with R-2.14.0?