Building mpi4py with openmpi gives error

Issue #69 invalid
Tim Jim created an issue

Hi, I'm trying to build mpi4py using my install of openmpi but python setup.py keeps failing.

I have built openmpi in my opt directory (/opt/openmpi/openmpi-2.1.0) and I am running Ubuntu 16.04.

I edited the mpi.cfg file to add my paths and include directory for my install and executed:

python setup.py build --mpi=openmpi

However, I am getting the following error:

running build
running build_src
running build_py
running build_clib
MPI configuration: [openmpi] from 'mpi.cfg'
MPI C compiler:    /opt/openmpi/openmpi-2.1.0/bin/mpicc
MPI C++ compiler:  /opt/openmpi/openmpi-2.1.0/bin/mpicxx
running build_ext
MPI configuration: [openmpi] from 'mpi.cfg'
MPI C compiler:    /opt/openmpi/openmpi-2.1.0/bin/mpicc
MPI C++ compiler:  /opt/openmpi/openmpi-2.1.0/bin/mpicxx
checking for MPI compile and link ...
/opt/openmpi/openmpi-2.1.0/bin/mpicc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -I/opt/openmpi/openmpi-2.1.0/include -c _configtest.c -o _configtest.o
/opt/openmpi/openmpi-2.1.0/bin/mpicc: /usr/local/cuda-8.0/targets/x86_64-linux/lib/libOpenCL.so.1: no version information available (required by /opt/openmpi/openmpi-2.1.0/lib/libopen-pal.so.20)
success!
removing: _configtest.c _configtest.o
/opt/openmpi/openmpi-2.1.0/bin/mpicc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -I/opt/openmpi/openmpi-2.1.0/include -c _configtest.c -o _configtest.o
/opt/openmpi/openmpi-2.1.0/bin/mpicc: /usr/local/cuda-8.0/targets/x86_64-linux/lib/libOpenCL.so.1: no version information available (required by /opt/openmpi/openmpi-2.1.0/lib/libopen-pal.so.20)
/opt/openmpi/openmpi-2.1.0/bin/mpicc -pthread _configtest.o -Lbuild/temp.linux-x86_64-2.7 -L/opt/openmpi/openmpi-2.1.0/lib -Wl,-R/opt/openmpi/openmpi-2.1.0/lib -o _configtest
/opt/openmpi/openmpi-2.1.0/bin/mpicc: /usr/local/cuda-8.0/targets/x86_64-linux/lib/libOpenCL.so.1: no version information available (required by /opt/openmpi/openmpi-2.1.0/lib/libopen-pal.so.20)
/opt/openmpi/openmpi-2.1.0/lib/libopen-pal.so.20: undefined reference to `clGetPlatformInfo@OPENCL_1.0'
/opt/openmpi/openmpi-2.1.0/lib/libopen-pal.so.20: undefined reference to `clGetPlatformIDs@OPENCL_1.0'
/opt/openmpi/openmpi-2.1.0/lib/libopen-pal.so.20: undefined reference to `clGetDeviceInfo@OPENCL_1.0'
/opt/openmpi/openmpi-2.1.0/lib/libopen-pal.so.20: undefined reference to `clGetDeviceIDs@OPENCL_1.0'
collect2: error: ld returned 1 exit status
failure.
removing: _configtest.c _configtest.o
error: Cannot link MPI programs. Check your configuration!!!

It seems to be picking up some paths to my NVIDIA CUDA installation, though I am unsure of the reason why.

Can anyone point out if I set some options wrongly or not installed openmpi correctly? (Sorry, I'm a bit new to this). Thanks in advance.

Comments (9)

  1. Lisandro Dalcin

    Could you cd demo && mpicc helloworld.c -o hello.bin ? Does it work? Are you able to run ./hello.bin? Post this issue to our mailing list, perhaps someone can provide insight. Maybe you should also ask in the Open MPI mailing list, this does not seems to be an issue with mpi4py.

  2. Tim Jim reporter

    I think you're right - it might be something to do with my openmpi install. When I try:

    mpicc helloworld.c -o hello.bin
    

    I get the following:

    mpicc: /usr/local/cuda-8.0/targets/x86_64-linux/lib/libOpenCL.so.1: no version information available (required by /opt/openmpi/openmpi-2.1.0/lib/libopen-pal.so.20)
    /usr/bin/ld: cannot open output file hello.bin: Permission denied
    collect2: error: ld returned 1 exit status
    

    I thought it was a permission error, so I tried:

    sudo mpicc helloworld.c -o hello.bin
    

    However that, rather confusingly, gave me:

    sudo: mpicc: command not found
    

    Do you know where I might be going wrong? How might I post this to the right mailing list? Thanks.

  3. Lisandro Dalcin

    You have to invoke sudo -E to preserve the environment (PATH variable). However, you should not need to use sudo to compile MPI programs. Something else is wrong, perhaps the permissions of the directory where you are trying to compile. About Open MPI mailing lists: https://www.open-mpi.org/community/lists/

  4. Tom Tranter

    Apologies for posting here. @timjim333 did you solve this problem? I'm having the same issue and wondered if you could help

  5. Lisandro Dalcin

    @tomtranter What's exactly your issue? Do you really need to use sudo? Running python setup.py install --user should be enough to build and install as a user, there is no need to use sudo.

  6. Tim Jim reporter

    @tomtranter apologies, I never figured out what I had wrong in the end. I will need to get it configured in the near future for other work, so if I can't get it up and running, I might try using another MPI distribution. If I do get it working, I'll post you an update.

  7. Tom Tranter

    Hi, and thanks for the responses. I'm not actually using mpi4py. Just trying to install openmpi after installing cuda. This post was the only one to come close to matching my problem. Again apologies for posting here. I did fix it in the end by building openmpi whilst disabling building extensions and also deleting that troublesome file. I think another fix would be to start fresh and install openmpi with standard options before installing cuda. Hope that helps Timothy

  8. Tim Jim reporter

    Hi, @tomtranter I've had another go at the problem and appear to have solved my problem with help from the openmpi folks! I kept my cuda installation but before running the configure command, I was instructed to disable two features. For future reference, see below for the install process I followed.

    In a new terminal:

    export nvml_enable=no
    export enable_opencl=no
    ./configure --with-cuda --prefix=/opt/openmpi/openmpi-3.0.0
    make all
    sudo make install 
    

    Apparently, openmpi does not use these features currently (it is only utilised by hwloc), so they can be disabled. This solved the undefined reference issues for me.

  9. Log in to comment