Message Boards Message Boards

Create a DIY progressindicator for paralleltable?

Posted 8 years ago

Hello, I am trying find a way to let the user know the progress of a calculation. ProgressIndicator or scheduledtask has some drawbacks for me so I can't really use those.

What I would like to do something like

d = 0;
SetSharedVariable[d];
nprecision = 1000;
ParallelEvaluate[dl = 0];
aInu = Table[

   If[Mod[iC, nprecision*0.2] == 0, d = d + 1;
    prcounter = 
     CreateDialog[
      Row@{Style["Calculation progress  ", 12, Red], 20*d, 
        Style["%", 12, Red]}];];
   aInu = 50*50;

   If[Mod[iC, nprecision*0.2] == 0, NotebookClose[prcounter];];

   , {iC, nprecision}];

I am getting an error for frontend. I know that it is because of the Parallel computation. But I am not able find a way around. Any suggestions?

POSTED BY: Erdem Uguz

I think you will need some dynamic in your 'CreateDialog'. I always use (something like):

max = 1000
d = 0;
Dynamic[Row[{Round[100 d/max, 0.1], "% done!"}]]
LaunchKernels[3]
DistributeDefinitions[d]
SetSharedVariable[d];
out = ParallelTable[
      d++;
      i^2
  ,
      {i, max}
  ]

Dynamic will just output an 'dynamic output' that will keep track of 'd'. Perhaps you can include something similar in your code?

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract