mpi4py with mpich: doesn't not seems to work

Issue #76 closed
Former user created an issue

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)

  1. Lisandro Dalcin

    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), otherwise pip 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())"
    
  2. Olivier Gingras

    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

  3. Log in to comment