Re: ProgressIndicator and ParallelTable problem :(
- To: mathgroup at smc.vnet.net
- Subject: [mg117999] Re: ProgressIndicator and ParallelTable problem :(
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Fri, 8 Apr 2011 04:13:19 -0400 (EDT)
It takes 9.7 seconds to pause one second 18 times. Not too bad. Clear[j] j = 1; SetSharedVariable[j]; ProgressIndicator[Dynamic[j], {1, 18}] ParallelTable[Pause[1]; j++; f[i], {i, 1, 18}, DistributedContexts -> Automatic] // AbsoluteTiming {9.725959, {f[1], f[2], f[3], f[4], f[5], f[6], f[7], f[8], f[9], f[10], f[11], f[12], f[13], f[14], f[15], f[16], f[17], f[18]}} Bobby On Thu, 07 Apr 2011 07:04:48 -0500, psycho_dad <s.nesseris at gmail.com> wrote: > Hi, > I have just solved the problem. The following piece of code does > exactly what I want it to do, ie update the ProgressIndicator after > every parallel kernel has finished its job, before moving to the next > one. The key is the SetSharedVariable function: > > Clear[j] > j=1;SetSharedVariable[j]; > ProgressIndicator[Dynamic[j],{1,18}] > ParallelTable[Pause[1];j++;f[i],{i,1,18},DistributedContexts- >> Automatic]//AbsoluteTiming > > Thanks for all your help Albert and Eric. > > Cheers > -- DrMajorBob at yahoo.com