4

I have an ipcluster running with 8 engines for Ipython notebook. So the following:

from IPython import parallel
clients = parallel.Client()
clients.block = True  # use synchronous computations
print clients.ids

gives [0, 1, 2, 3, 4, 5, 6, 7]. But, I cannot get mpi4py to see these engines:

from mpi4py import MPI
print MPI.COMM_WORLD.size

gives 1. I guess, I am missing something basic, so I'd appreciate any help.

1 Answer 1

4

It turns out that it requires some magic. The first line of the cell should be:

%%px
from mpi4py import MPI
print MPI.COMM_WORLD.size
Sign up to request clarification or add additional context in comments.

3 Comments

What does px mean/stand for?
@jtlz2 not sure but maybe parallel execute. More info on %%px is here: ipython.org/ipython-doc/3/parallel/magics.html#px
@Armut s link is dead. ipyparallel is a separate package. See <ipyparallel.readthedocs.io/en/latest/reference/mpi.html> for using MPI.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.