Groups | Search | Server Info | Login | Register


Groups > comp.soft-sys.math.mathematica > #16803

Tracking progress in ParallelDo

From Brian Beckage <Brian.Beckage@uvm.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Tracking progress in ParallelDo
Date 2014-04-14 09:28 +0000
Message-ID <lig9n7$cfl$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


I'm applying a function repeatedly using ParallelDo.  I would like to keep track of its progress.  I've tried using both my own counter variable as well as using the increments within the ParallelDo function (below). Neither provides a way of sequentially tracking how many of the iterations have been spawned (not completed--but just kicked off). 

How could I track that iteration 1, 2, 3, 4, 5 etc. have been started?  Is there a better way of monitoring progress of the ParalleDo?

Thanks for your help!

Brian


USING MY OWN COUNTER: myCounter:

parallelBootstrapFireMultiplier[nBoot_, fireMultiplierRange_, parmList1_,
  nYears_, initLandscapeProbs_] := Module[{outIter, myCounter},

  ParallelEvaluate[Clear[myCounter]];
  myCounter = 0;
  SetSharedVariable[myCounter];
  Reap[
   ParallelDo[
    myCounter++;
    Print["Starting parallelBootstrapMultiplier step ", myCounter, " out of ",
      nBoot];
    outIter =
     iterFireMultiplier[fireMultiplierRange, parmList1, nYears,
      initLandscapeProbs];
    ParallelSow[outIter],
    {nBoot}]
   ]
  ]

RESULTS in:

(kernel 2) Starting parallelBootstrapMultiplier step 2 out of 6
(kernel 1) Starting parallelBootstrapMultiplier step 2 out of 6
(kernel 1) Starting parallelBootstrapMultiplier step 4 out of 6
(kernel 2) Starting parallelBootstrapMultiplier step 4 out of 6
(kernel 2) Starting parallelBootstrapMultiplier step 5 out of 6
(kernel 1) Starting parallelBootstrapMultiplier step 6 out of 6

USING THE INCREMENT i FROM ParallelDo:

parallelBootstrapFireMultiplier[nBoot_,fireMultiplierRange_,parmList1_,nYears_,initLandscapeProbs_]:= Module[{outIter},
Reap[
ParallelDo[
Print["Starting parallelBootstrapMultiplier step ",i, " out of ",nBoot];
outIter=iterFireMultiplier[fireMultiplierRange,parmList1,nYears,initLandscapeProbs]; (*This returns a list*)
ParallelSow[outIter],
{i,nBoot}]
]
]

RESULTS in:
Starting parallelBootstrapMultiplier step 1 out of 6
Starting parallelBootstrapMultiplier step 4 out of 6
Starting parallelBootstrapMultiplier step 5 out of 6
Starting parallelBootstrapMultiplier step 2 out of 6
Starting parallelBootstrapMultiplier step 3 out of 6
Starting parallelBootstrapMultiplier step 6 out of 6

Back to comp.soft-sys.math.mathematica | Previous | NextNext in thread | Find similar


Thread

Tracking progress in ParallelDo Brian Beckage <Brian.Beckage@uvm.edu> - 2014-04-14 09:28 +0000
  Re: Tracking progress in ParallelDo Szabolcs Horvát <szhorvat@gmail.com> - 2014-04-17 09:10 +0000

csiph-web