I think you do not understand how the parallelization works: Different iterations from your foreach() are run on different nodes, hence you change the progressbar on the node rather on the master in your loop.

Uwe Ligges


On 14.06.2011 12:23, Julian TszKin Chan wrote:
Hi all,

I can create a text-progress bar in a foreach loop by the following code :

n=10
foreach( i = 1:n ,.combine=c) %do%{
        setTxtProgressBar(pb, i)
        Sys.sleep(0.1)
}


However, once i use the parallelized foreach, the text-progress bar
disappear.  Any solution to this problem? How can i create a progress
bar in parallelized foreach? Thanks

cl<-makeCluster(core)
registerDoSNOW(cl)

pb<-txtProgressBar(min = 0, max = n, style = 3)
foreach( i = 1:n ,.combine=c) %dopar%{
        setTxtProgressBar(pb, i)
        Sys.sleep(0.1)
}
close(pb)
stopCluster(cl)


Regards,
TszKin Julian

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

______________________________________________
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