ProgressIndicator in ParallelTable problem, redux

*To*: mathgroup at smc.vnet.net*Subject*: [mg131766] ProgressIndicator in ParallelTable problem, redux*From*: psycho_dad <s.nesseris at gmail.com>*Date*: Tue, 1 Oct 2013 06:20:41 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-outx@smc.vnet.net*Delivered-to*: mathgroup-newsendx@smc.vnet.net

Hi all, I have the following problem with ProgressIndicator and ParallelTable. Assume we have a function f (see below for a simple toy model) that performs a "long" calculation and carries its own ProgressIndicator to show how far it has progressed. It works OK if I run it once or in a Table (it runs serially of course), but if I run it inside a ParallelTable with N Kernels, the N progress bars remain "dead", while the calculation goes on OK. To be more clear, what I want is to run the function f[] in Parallel with N Kernels, with each instance having its own progress bar updating dynamically. So, there should be N progress bars updating dynamically as the calculations go on. In my real code f[] is too complicated but roughly it does a MCMC (plus some other stuff), so each instance would correspond to a different chain. The toy model f[] is shown below and it just sums numbers k^2 from 0 to "end" (+ a time-delay): f[end_] := DynamicModule[{n},( n = 0; Print[ProgressIndicator[Dynamic[n],{0,end}]]; Sum[Pause[.15];n=k;(k^2),{k,0,end,1}])] For example, the following gives the result along with a dynamic progress bar: f[10] ... while this runs f[10] 5 times serially (in the real case this would produce 5 different MCMC chains): Table[f[10],{j,1,5}]//AbsoluteTiming Now the parallel case: LaunchKernels[5]; DistributeDefinitions[f]; ParallelTable[f[10],{j,1,5},DistributedContexts:>Automatic]//AbsoluteTiming If you run the last part you will notice that while it returns the expected result (roughly 5 times as fast), the progress bars don't update as they should. Any idea how to fix this? This is not an issue of sharing the variables between Kernels with SetSharedVariable, like in https://groups.google.com/forum/#!msg/comp.soft-sys.math.mathematica/L7LFEUIgVPo/nr3LQIZ2lloJ as obviously each instance should have its own version. BTW, the latter is a slightly related question I had asked some time ago, hence the redux in the title. Thanks for any help in advance! Cheers