I've use open mpi, doMPI and foreach quite a bit, although I'm no expert.
 Recently I've been attempting to help a friend parallelize some loops that
contain a "source" function to an external .R code file.  I get some
strange behaviour, when I use %do% it executes and walks through the code
nicely, however when I change to %dopar% I get  this error.

Error in { : task 2 failed - "object 'Data' not found"

The file being sourced is large and I have tried many things but can not
make it work.  Do foreach and source not play well together?  Here is a
copy of the foreach loop, any thoughts and/or suggestions most welcome.
 I've spent hours on it and tried everything I can think of .

Thanks

J

====================================
newstuff <- foreach (k=1:length(CountryFileList), .packages = c("Hmisc",
"gtools"),
                     .combine = rbind)  %dopar% {

                          setwd("/home/jamaas/NewRun/DataNoProblems")
                          print(CountryFileList[k])
                          CountryFile = CountryFileList[k]
                          load(paste(CountryFile,"NoProblems.RData",sep=""))
                          TextFileName = 0
                          setwd("/home/jamaas/Rcode/Nate/Treatment0")
                          source(RegressionScript)
                          Output
}

-- 
Jim Maas

	[[alternative HTML version deleted]]

