hello all
 
For those interested! i figured out the problem!
 
I needed to put the dyn.load and dyn.unload lines inside the loop! 
 
----------------------------------------------------------------------------------------------------
 library(doMPI)
 
 cl <- startMPIcluster(count=2)    #this will be changed later
 registerDoMPI(cl)
 
 #the input parameters!
 ...
 
 #some vecs and matrices for the C program
  
  ...
 
 #load the C code
    
  Est_Results<-foreach(data_iter = 1:nsamp, .combine="cbind",
.inorder=TRUE ) %dopar% 
  {
      dyn.load("/export/home/example/Runs/eg.so")
       outs=.C("prog1", all of the args )
                  
       do more things

       dyn.unload("/export/home/example/Runs/eg.so")

       return( some things)
  }
 
   
  closeCluster(cl)
  save.image("/export/home/example/Runs/eg.RData")
 
 mpi.quit(save = "no") 
----------------------------------------------------------------------------------------------------
 
 
 

 


 

###
UNIVERSITY OF CAPE TOWN 

This e-mail is subject to the UCT ICT policies and e-mai...{{dropped:16}}

______________________________________________
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.

Reply via email to