<div class="gmail_quote">On Tue, Jan 17, 2012 at 16:19, Reuti <span dir="ltr"><<a href="mailto:reuti@staff.uni-marburg.de">reuti@staff.uni-marburg.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="im">> printf("Hello World from Node %d.\n", node);<br>
> for(j=0; j <= 100000; j++)<br>
> for(i=0;i <= 100000; i++)<br>
> f=i*2.718281828*i+i+i*3.141592654;<br>
><br>
> Well this is an odd spin loop because the compiler will happily remove it for you (note that MPICH2's mpicc wrapper very frequently has optimization flags in it). I would suggest sleep(3) instead, or, if you must, force the loop to actually be executed (e.g. seed the loop with the rank and use the result).<br>
<br>
</div></div>Not for my gcc version and mpich2-1.4, I can see a clear load. </blockquote><div><br></div><div>Add -O1 and it will go away. *Many* people build MPICH2 with some optimization in CFLAGS (hoping to build MPICH2 with optimization) in which case those flags also get written into the wrappers. I see this from users wondering why their debugging session isn't working as expected every few weeks, so it's definitely a common situation.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Of course, you can include the rank to modify it, but a clever compiler should then also detect that f is never used again.<br>
</blockquote><div><br></div><div>That's why my comment included "and use the result". ;-)</div></div>