mpi4py with mpich: doesn't not seems to work
Hello,
I'm trying to understand if my mpi4py works with mpich. I work on a cluster and if I load the openmpi module and do the test mpiexec -n 5 python -m mpi4py helloworld
, I get
Hello, World! I am process 0 of 5 on briaree2.
Hello, World! I am process 4 of 5 on briaree2.
Hello, World! I am process 1 of 5 on briaree2.
Hello, World! I am process 2 of 5 on briaree2.
Hello, World! I am process 3 of 5 on briaree2.
but if I load instead the mpich module, I get
Hello, World! I am process 0 of 1 on briaree2.
Hello, World! I am process 0 of 1 on briaree2.
Hello, World! I am process 0 of 1 on briaree2.
Hello, World! I am process 0 of 1 on briaree2.
Hello, World! I am process 0 of 1 on briaree2.
which looks broken. I did try to install mpi4py using the command env MPICC=/home/apps/Logiciels/MPI/gnu/gcc4.9.2/mpich-3.2/bin/mpicc pip install mpi4py
but the same happens. What is happening and what should I do? Also, is there a way to import mpi4py and make it print the MPI version it's using? I searched and couldn't find anything.
Thank you very much! Olivier Gingras
Comments (5)
-
-
You cannot just switch modules and expect mpi4py work with an MPI that it was not build with. This is not different that for any other binary executable or library using MPI.
Make sure you uninstall mpi4py first (
pip uninstall mpi4py
), otherwisepip install mpi4py
will do nothing.To print the MPI version actually used, you could try:
mpiexec -n 5 python -c "from mpi4py import MPI; print(MPI.get_vendor())"
or maybe:
mpiexec -n 5 python -c "from mpi4py import MPI; print(MPI.Get_library_version())"
-
Thank you for you comment. Of course, I was uninstalling first, but your comment made me think about pip, which uses wheel to install precompiled code. I remembered there was the option
--no-binary=mpi4py
which skips wheel and installs it all. With this it worked! I looked using your first suggestion.Thanks again! Olivier Gingras
-
Oh, yes, of course! pip caching wheels is not your friend in this case.
-
- changed status to closed
- Log in to comment
I made and account to follow this Issues. Thanks!