On Tue, Dec 13, 2011 at 8:43 AM, Thomas Leissing <span dir="ltr"><<a href="mailto:thomas.leissing@cstb.fr">thomas.leissing@cstb.fr</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<u></u>
<div>
Dear all,<br>
<br>
Somewhere in my boundary element solver I have a console progress bar which prints to screen the progress of an operation.<br>
It looks like this:<br>
INFO : 50% [------------> ]<br>
<br>
The function is very simple:<br>
//i is the current iteration number <br>
//n is the total number of iterations<br>
void progressBar(int x, int n)<br>
{<br>
<br>
if ( x % (n/100) != 0 ) return;<br>
<br>
// Calculate the ratio of complete-to-incomplete.<br>
float ratio = x/(float)n;<br>
int c = ratio * 80<br>
<br>
// Show the percentage complete.<br>
printf("INFO :\t%3d%% [", (int)(ratio*100) );<br>
<br>
// Show the load bar.<br>
for (int x=0; x<c-1; x++)<br>
printf("-");<br>
<br>
printf(">");<br>
<br>
for (int x=c; x<pBarWidth; x++)<br>
printf(" ");<br>
<br>
// ANSI Control codes to go back to the<br>
// previous line and clear it.<br>
printf("]\n\033[F\033[J");<br>
}<br>
<br>
<br>
My problem is that the progress bar doesn't print to screen as soon as I call the PetscInitialize() function (it works fine otherwise).<br>
I tried to play with fflush(stdout) commands without any success.<br>
<br>
Any ideas ?<br></div></blockquote><div><br></div><div>This sounds like MPI rather than PETSc, since it plays with output. Are you running with mpiexec?</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
Thanks,<span class="HOEnZb"><font color="#888888"><br>
Thomas Leissing<br>
<br>
</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>