Whas missing the R in the command line: "mpirun -n --hostfile /home/hostfile R --no-save -f rtest.R"
Hope this helps mario On 13-Jan-11 22:08, Justin Moriarty wrote:
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]] _______________________________________________ R-sig-hpc mailing list r-sig-...@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-hpc
-- Ing. Mario Valle Data Analysis and Visualization Group | http://www.cscs.ch/~mvalle Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60 v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.