<div><meta http-equiv="content-type" content="text/html; charset=utf-8">The issue is resolved now, thanks for the pointer. </div><div><br></div><div>The story of what was up:</div>Your example didn't work and showed that the issue was with MPI and not IPython related. <div>
<br></div><div>I then tried a standard MPI hello world application and that did work. </div><div><br></div><div>This pointed the issue to what was between MPI and IPython, mpi4py.</div><div><br></div><div>When I first installed mpi4py my system had a not-perfectly-functioning MPI. I realized this was an issue a couple days ago and installed a fresh openmpi. This cleared up many issues. Bits of mpi4py unfortunately had been compiled with the old MPI and this was causing the confusion that I brought to the list. A quick "pip install mpi4py --upgrade" forced recompilation with the newer openmpi installation. Everything is now fine. Seeing the list [3, 2, 0, 1] has never brought me so much joy. </div>
<div><br></div><div>Thanks,</div><div>-Matt<br><br><div class="gmail_quote">On Fri, Jan 27, 2012 at 3:56 PM, MinRK <span dir="ltr"><<a href="mailto:benjaminrk@gmail.com">benjaminrk@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 class="im">On Fri, Jan 27, 2012 at 13:24, Matthew Rocklin <<a href="mailto:mrocklin@gmail.com">mrocklin@gmail.com</a>> wrote:<br>
> Hi everyone,<br>
><br>
> I've been playing with using ipython parallel in mpi mode. On my laptop it's<br>
> working swell but on a different machine I can't get the ipengines to be<br>
> part of the same MPI world.<br>
><br>
> I.e. after setting up either an ipcluster or ipcontroller + ipengine I run<br>
> the following in python<br>
><br>
> from IPython.parallel import Client<br>
> rc = Client() #profile='mpi')<br>
> view = rc[:]<br>
> view.execute('from mpi4py import MPI')<br>
> view.execute('comm = MPI.COMM_WORLD')<br>
> view.execute('rank = comm.Get_rank()')<br>
> print view['rank']<br>
<br>
</div>The above can be done a bit more conveniently with apply:<br>
<br>
def get_rank():<br>
from mpi4py import MPI<br>
return MPI.COMM_WORLD.Get_rank()<br>
view.apply_sync(get_rank)<br>
<div class="im"><br>
><br>
> and get out a list of zeros, each of the engines is inside of its own mpi<br>
> world.<br>
><br>
> I set up the cluster either by using<br>
> ipcluster start --n 4 --engines=MPI --controller=MPI<br>
<br>
</div>Side note: it's rarely useful to use MPI to start the controller - it<br>
will always be alone in its own MPI universe. Only do this if it's<br>
required by your batch system/sysadmin somehow.<br>
<div class="im"><br>
> or<br>
> ipcluster start --n 4 --profile=mpi # config files set up as in the tutorial<br>
><br>
> or directly using ipcontroller and ipengines<br>
><br>
> ipcontroller --profile=mpi<br>
> mpiexec --np 4 ipengine --profile=mpi<br>
<br>
</div>Even this, using mpiexec *directly* doesn't work? I don't see how<br>
that would even be possible, unless your MPI setup is messed up.<br>
<br>
Try a simple test script:<br>
<br>
import os<br>
from mpi4py import MPI<br>
comm = MPI.COMM_WORLD<br>
<br>
rank = comm.Get_rank()<br>
print "pid:%i, rank:%i\n" % (os.getpid(),rank),<br>
<br>
And run this with `mpiexec -np 4 python test_script.py`.<br>
<div class="im"><br>
><br>
> I'm using ubuntu with the ipython that is packaged in the enthought<br>
> distribution and linking to openmpi.<br>
><br>
> Any thoughts on common mistakes I could be making?<br>
<br>
</div>You are doing the right thing by going straight to mpiexec. Whenever<br>
ipcluster doesn't work, the first step for debugging is to try to do<br>
explicitly what you think ipcluster should be doing, and make sure<br>
that works. ipcluster is convenient when it works, but it's a hassle<br>
to debug.<br>
<br>
The only thing I can think of is that you might still be running a<br>
controller/engines and are not actually connecting to your new ones<br>
started with MPI. This seems unlikely, though, but you can check with<br>
`ps aux | grep ipengine`.<br>
<br>
-MinRK<br>
<br>
><br>
> -Matt<br>
><br>
> _______________________________________________<br>
> IPython-User mailing list<br>
> <a href="mailto:IPython-User@scipy.org">IPython-User@scipy.org</a><br>
> <a href="http://mail.scipy.org/mailman/listinfo/ipython-user" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-user</a><br>
><br>
</blockquote></div><br></div>