I am conducting a simulation study using snowfall package on Windows 7.
I like to print out a message for every 10 runs to main R console to monitor the progress, but it fails to do so. ie. nothing is printed
Any help will be much appreciated.
runsim = function(nsim,n,mean,var){
cov = 0
for(i in 1:nsim){
if ( i %% 10==0)
cat("\n Running simulation",i)
dat = function1(n,mean,var)
cov = ...
}
cov / nsim
}
sfExport("function1","runsim")
sfLibrary(library1)
wrapper = function(n){
runsim(100,n,0.5,0.25)
}
Out<-sfLapply(1:100,wrapper)
Check
?sfCat
and find the line where it says:This tells us that we need to enable logging in the call to
sfInit
(argumentslaveOutfile
). Then, each call tosfCat()
will dump stuff to the log file you specified. It took me a while to figure that out as well ;-)Code Example
Output of
./test.txt
Own question
Does anyone have a clue how to "control" the specific things that go to the log file? E.g., what would be nice is to include information about which worker finished which job etc.