3

Problem

I'm trying to use mpi4py on a cluster. Because of other dependencies I have to use gnu, not intel. However, there are both compiler versions on the cluster and I don't manage to force mpi4py to install with the gnu compilers.

Questions

  • How can I make mpi4py work with gnu instead of intel?

  • Why is mpi4py installed with intel even though I unloaded all intel modules?

  • Why is mpi4py installed with intel despite me specifying env MPICC?

Failed Attempts

I first tried to unload the intel modules and load a gnu openmpi module, such that I get:

me@cluster:~$ module purge
me@cluster:~$ module load python
me@cluster:~$ source .virtualenvs/py36env/bin/activate
(py36env) me@cluster:~$ module load openmpi/gcc/9.1/4.0.1 
(py36env) me@cluster:~$ module list
Currently Loaded Modulefiles:
  1) python/3.6              2) openmpi/gcc/9.1/4.0.1

(py36env) me@cluster:~$ which mpicc
/usr/local/Cluster-Apps/openmpi/gnu/4.0.1-gcc-9.1/bin/mpicc

(py36env) me@cluster:~$ mpicc --version
gcc (GCC) 9.1.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(py36env) me@cluster:~$ which mpirun
/usr/local/Cluster-Apps/openmpi/gnu/4.0.1-gcc-9.1/bin/mpirun

(py36env) me@cluster:~$ mpirun --version
mpirun (Open MPI) 4.0.1

Report bugs to http://www.open-mpi.org/community/help/

However, when I pip install mpi4py it uses the intel compilers despite my efforts to unload them:

(py36env) me@cluster:~$ pip install mpi4py
Collecting mpi4py
Installing collected packages: mpi4py
Successfully installed mpi4py-3.0.2

(py36env) me@cluster:~$ python -c "import mpi4py; print(mpi4py.get_config())"
{'mpicc': '/usr/local/Cluster-Apps/intel/2017.4/compilers_and_libraries_2017.4.196/linux/mpi/intel64/bin/mpicc', 
 'mpicxx': '/usr/local/Cluster-Apps/intel/2017.4/compilers_and_libraries_2017.4.196/linux/mpi/intel64/bin/mpicxx', 
 'mpifort': '/usr/local/Cluster-Apps/intel/2017.4/compilers_and_libraries_2017.4.196/linux/mpi/intel64/bin/mpif90', 
 'mpif90': '/usr/local/Cluster-Apps/intel/2017.4/compilers_and_libraries_2017.4.196/linux/mpi/intel64/bin/mpif90', 
 'mpif77': '/usr/local/Cluster-Apps/intel/2017.4/compilers_and_libraries_2017.4.196/linux/mpi/intel64/bin/mpif77'}

I get the same result even when I try to specify the mpi environment with

$ env MPICC=/usr/local/Cluster-Apps/openmpi/gnu/4.0.1-gcc-9.1/bin/mpicc pip install mpi4py

as suggested in the Note at https://mpi4py.readthedocs.io/en/stable/install.html#using-pip-or-easy-install.

Errors

As pointed out in the comments to "mpiexec and python mpi4py gives rank 0 and size 1", having mpi4py being built against a different MPI implementation than the used mpirun results in errors:

(py36env) me@login-e-11:~$ mpirun -n 5 python -m mpi4py.bench helloworld
Hello, World! I am process 0 of 1 on login-e-11.
Hello, World! I am process 0 of 1 on login-e-11.
Hello, World! I am process 0 of 1 on login-e-11.
Hello, World! I am process 0 of 1 on login-e-11.
Hello, World! I am process 0 of 1 on login-e-11.

This should actually be (see https://mpi4py.readthedocs.io/en/stable/install.html#testing):

$ mpirun -n 5 python -m mpi4py.bench helloworld
Hello, World! I am process 0 of 5 on localhost.
Hello, World! I am process 1 of 5 on localhost.
Hello, World! I am process 2 of 5 on localhost.
Hello, World! I am process 3 of 5 on localhost.
Hello, World! I am process 4 of 5 on localhost.
2
  • I'm not an expert but mpi4py may have an extension, which may be linked to Intel, if so you need to install mpi4py with gnu loaded instead of intel Commented Sep 21, 2019 at 1:02
  • @geckos But that's what I'm saying. Despite unloading intel and loading gnu instead, mpi4py is still being installed with intel... Commented Sep 21, 2019 at 1:06

1 Answer 1

4

When installing packages, pip keeps a cache of recently built packages. To avoid using the cache, forcing pip to rebuild the package and thereby pick up the correct environment, the --no-cache-dir option to pip install can be used.

See horovod's documentation here for further discussion.

Sign up to request clarification or add additional context in comments.

Comments

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.