<p dir="ltr">Then it was done wrong. There are lots of examples that do this</p>
<p dir="ltr"> Matt</p>
<div class="gmail_quote">On Oct 8, 2012 4:44 PM, "TAY wee-beng" <<a href="mailto:zonexo@gmail.com">zonexo@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div><br>
<pre cols="72">
</pre>
On 8/10/2012 11:39 PM, Matthew Knepley wrote:<br>
</div>
<blockquote type="cite">Register the stages outside the time loop.
<div><br>
</div>
<div> Matt<br>
</div>
</blockquote>
<br>
Hi Matt,<br>
<br>
I did that in my 2nd attempt (as in the org email), but it only
shows 1 main stage in the end:<br>
<br>
I changed my code to only call PetscLogStageRegister once:<br>
<br>
<i>PetscLogStage stages(2)</i><i><br>
</i><i><br>
</i><i>call PetscLogStageRegister("momentum_eqn",stages(1),ierr)</i><i><br>
</i><i><br>
</i><i> call PetscLogStageRegister("poisson_eqn",stages(2),ierr)</i><i><br>
</i> <i><br>
</i><i> do time = 1,n</i><i><br>
</i><i> </i><i><br>
</i><i> ...</i><i><br>
</i> <i><br>
</i><i> call PetscLogStagePush(stages(1),ierr)</i><i><br>
</i> <i><br>
</i><i> stage 1 logging</i><i><br>
</i> <i><br>
</i><i> call PetscLogStagePop(ierr)</i><i><br>
</i> <i><br>
</i><i> </i><i>...</i><i><br>
</i> <i><br>
</i><i> call PetscLogStagePush(stages(2),ierr)</i><i><br>
</i> <i><br>
</i><i> stage 2 logging</i><i><br>
</i> <i><br>
</i><i> call PetscLogStagePop(ierr)</i><i><br>
</i> <i><br>
</i><i> end do</i><br>
<blockquote type="cite">
<div><br>
<div class="gmail_quote">On Mon, Oct 8, 2012 at 10:19 AM, TAY
wee-beng <span dir="ltr"><<a href="mailto:zonexo@gmail.com" target="_blank">zonexo@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Hi,<br>
<br>
I am trying to log my PETSc performance in stages.<br>
<br>
I initially used:<br>
<br>
<i>PetscLogStage stages(2)</i><i><br>
</i><i><br>
</i><i>do time = 1,n</i><i><br>
</i><i> </i><i><br>
</i><i> ...</i><i><br>
</i><i><br>
</i><i> call
PetscLogStageRegister("momentum_eqn",stages(1),ierr)</i><i><br>
</i><i><br>
</i><i> call PetscLogStagePush(stages(1),ierr)</i><i><br>
</i><i><br>
</i><i> stage 1 logging</i><i><br>
</i><i><br>
</i><i> call PetscLogStagePop(ierr)</i><i><br>
</i><i><br>
</i><i> ...</i><i><br>
</i><i><br>
</i><i> call
PetscLogStageRegister("poisson_eqn",stages(2),ierr)</i><i><br>
</i><i><br>
</i><i> call PetscLogStagePush(stages(2),ierr)</i><i><br>
</i><i><br>
</i><i> stage 2 logging</i><i><br>
</i><i><br>
</i><i> call PetscLogStagePop(ierr)</i><i><br>
</i><i><br>
</i><i>end do</i><br>
<br>
<br>
The log_summary shows that results in stages 1 and 2, but
I also get the error:<br>
<br>
Invalid argument!<br>
[1]PETSC ERROR: Duplicate stage name given: poisson_eqn!<br>
<br>
I changed my code to only call PetscLogStageRegister once:<br>
<br>
<i>PetscLogStage stages(2)</i><i><br>
</i><i><br>
</i><i>call
PetscLogStageRegister("momentum_eqn",stages(1),ierr)</i><i><br>
</i><i><br>
</i><i> call
PetscLogStageRegister("poisson_eqn",stages(2),ierr)</i><i><br>
</i> <i><br>
</i><i> do time = 1,n</i><i><br>
</i><i> </i><i><br>
</i><i> ...</i><i><br>
</i> <i><br>
</i><i> call PetscLogStagePush(stages(1),ierr)</i><i><br>
</i> <i><br>
</i><i> stage 1 logging</i><i><br>
</i> <i><br>
</i><i> call PetscLogStagePop(ierr)</i><i><br>
</i> <i><br>
</i><i> </i><i>...</i><i><br>
</i> <i><br>
</i><i> call PetscLogStagePush(stages(2),ierr)</i><i><br>
</i> <i><br>
</i><i> stage 2 logging</i><i><br>
</i> <i><br>
</i><i> call PetscLogStagePop(ierr)</i><i><br>
</i> <i><br>
</i><i> end do</i><br>
<br>
Now there's no error but all logging are now grouped
together into just 1 main stage. <br>
<br>
How can I correct it to have separate logging? Tks!<span><font color="#888888"><br>
<pre cols="72">--
Yours sincerely,
TAY wee-beng</pre>
</font></span></div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to
which their experiments lead.<br>
-- Norbert Wiener<br>
</div>
</blockquote>
<br>
</div>
</blockquote></div>