Cannot install mpi4py using conda AND specify pre-installed mpicc path

折月煮酒 提交于 2020-04-16 03:28:08

问题


I have tried installing mpi4py with:

env MPICC=path/to/openmpi/bin/mpicc conda install -c anaconda mpi4py

But I get this message:

The following NEW packages will be INSTALLED:
  mpi                anaconda/linux-64::mpi-1.0-mpich
  mpi4py             anaconda/linux-64::mpi4py-3.0.3-py37h028fd6f_0
  mpich              anaconda/linux-64::mpich-3.3.2-hc856adb_0

Which seems to show that "MPICC=path/to/openmpi/bin/mpicc" was ignored.

Indeed, after installing mpi4py with mpich, and trying to run the following simple code with mpirun -n 2 python mpi4pyTest.py:

from mpi4py import MPI
comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()
print('Hello from processor {} of {}'.format(rank+1,size))

The output is:

Hello from processor 1 of 1
Hello from processor 1 of 1

How can I get conda to link mpi4py with my own mpicc? Its location is setup in PATH environment variable, as well as LD_LIBARY_PATH.

Best regards.


回答1:


conda install pulls precompiled binary packages and their dependencies from the repository. If you want mpi4py built with your own MPI implementation, use pip instead to install from source. You can use pip with Conda environments.

Edit for completion

Either uninstall all packages using conda remove and then install mpi4py using pip (specifying the MPICC environment variable to your MPI C complier), OR start with a new environment.



来源:https://stackoverflow.com/questions/61003570/cannot-install-mpi4py-using-conda-and-specify-pre-installed-mpicc-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!