
Hi, 
Just wanted to share a working example of doSNOW and foreach for an openMPI cluster.  The function eddcmp() is just an example and returns some inocuous warnings.  The example first has each node return its nodename, then runs an example comparing dopar, do and a for loop.  In the directory containing rtest.R it is run from the command line with:
"mpirun -n --hostfile /home/hostfile --no-save -f rtest.R"

Here is the code for rtest.R:

#################
library(doSNOW)
library(panel)

cl<-makeMPIcluster(3)
registerDoSNOW(cl)

clusterEvalQ(cl,library(panel))

res<-clusterCall(cl, function(){Sys.info()["nodename"]})
print(do.call(rbind,res))

sme<- matrix(rnorm(100),10,10)
clusterExport(cl,"sme")

myfun<-function()
{
for(i in 1:1000)
{
x<-eddcmp(sme)
}
}

ged<-0

system.time({
ged<-foreach(i=1:10) %dopar%
{
myfun()
}
})

system.time({
ged<-foreach(i=1:10) %do%
{
myfun()
}
})

system.time({
for(i in 1:10)
{
ged<-myfun()
}
})

stopCluster(cl)
mpi.quit()

#################
Cheers,
Justin







 		 	   		  
	[[alternative HTML version deleted]]

