Joannès Guillemot
2013-May-29 13:18 UTC
[R] Trouble in parallel computing with snow package
Dear all, I want to make a baysian optimisation of the parameters values of a model, written in FORTRAN. I thus need a parallel modeling procedure. I started to use the R package "snow" but I went through trouble and I hope that you will bring me light on this problem. Briefly, I first make a function called "run" which will execute the .exe of my FORTRAN code (the argument *plac*, is the ID of the plot, I want the code to run 20 plots simultaneously). * **run<-function(plac) {** ** setwd(paste('L:/Joannes/CASTANEA/Casta_opti2/CASTANEA_OPTI',plac,'/projet_fortran_intel_castanea/', sep="") )** ** system('Release/projet_fortran_intel_castanea.exe') ** **}** * I then use the following code to run the FORTRAN code over 20 plots in the same time. My computer has 16 processors. *cl20 <- makeCluster(20, type="SOCK")** ** clusterApplyLB(cl20,1:20, run)** **stopCluster(cl20)** * But I finally realized that this code did not run all the 20 plots but only part of them. The code return a "0" for the plots which has been simulated and a "127" if nothing is done. If I run my R code several time, the number of simulated plots is different (but<20) and the plots which are simulated are not always the same. I need all the 20 plots to be run simulaneously and I cannot find out what is the problem with my code. Any idea about how to solve my problem? Thank you very much, Joannès Guillemot <joannes.guillemot@u-psud.fr> [[alternative HTML version deleted]]