opencltheanoamd-gpu

getting "pygpu was configured but could not be imported" error while trying with OpenCL+Theano on AMD Radeon


I have followed the instructions from this:

https://gist.github.com/jarutis/ff28bca8cfb9ce0c8b1a

But then when I tried : THEANO_FLAGS=device=opencl0:0 python test.py
on the test file I am getting error:

ERROR (theano.sandbox.gpuarray): pygpu was configured but could not be imported
Traceback (most recent call last):
  File "/home/mesayantan/.local/lib/python2.7/site-packages/theano/sandbox/gpuarray/__init__.py", line 20, in <module>

    import pygpu

  File "/usr/src/gtest/clBLAS/build/libgpuarray/pygpu/__init__.py", line 7, in <module>

    from . import gpuarray, elemwise, reduction
  File "/usr/src/gtest/clBLAS/build/libgpuarray/pygpu/elemwise.py", line 3, in <module>

    from .dtypes import dtype_to_ctype, get_common_dtype
  File "/usr/src/gtest/clBLAS/build/libgpuarray/pygpu/dtypes.py", line 6, in <module>

    from . import gpuarray
ImportError: cannot import name gpuarray

I do not have a good idea. I am using all these for the first time. I am working on Ubuntu 14.04 LTS. How can I resolve this error?


Solution

  • I fixed this issue with the step-by-step installation given in the lipgpuarray website!

    Download

    git clone https://github.com/Theano/libgpuarray.git
    cd libgpuarray
    

    Install libgpuarray

    # extract or clone the source to <dir>
    cd <dir> 
    mkdir Build
    cd Build
    # you can pass -DCMAKE_INSTALL_PREFIX=/path/to/somewhere to install to an alternate location
    cmake .. -DCMAKE_BUILD_TYPE=Release # or Debug if you are investigating a crash
    make
    make install
    cd ..
    

    Install pygpu

    # This must be done after libgpuarray is installed as per instructions above.
    python setup.py build
    python setup.py install
    

    Source: http://deeplearning.net/software/libgpuarray/installation.html

    This worked for me! Good Luck