在 AMD Radeon 上尝试使用 OpenCL+Theano 时出现 "pygpu was configured but could not be imported" 错误

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

我已按照以下说明操作:

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

但是当我尝试时:THEANO_FLAGS=device=opencl0:0 python test.py
在测试文件上我收到错误:

错误(theano.sandbox.gpuarray):pygpu已配置但无法导入 追溯(最近一次通话): 文件“/home/mesayantan/.local/lib/python2.7/site-packages/theano/sandbox/gpuarray/init.py”,第 20 行,在

import pygpu

文件“/usr/src/gtest/clBLAS/build/libgpuarray/pygpu/init.py”,第 7 行,在

from . import gpuarray, elemwise, reduction

文件“/usr/src/gtest/clBLAS/build/libgpuarray/pygpu/elemwise.py”,第 3 行,在

from .dtypes import dtype_to_ctype, get_common_dtype

文件“/usr/src/gtest/clBLAS/build/libgpuarray/pygpu/dtypes.py”,第 6 行,在

from . import gpuarray

ImportError: 无法导入名称 gpuarray

我没有好主意。我是第一次使用所有这些。我正在开发 Ubuntu 14.04 LTS。我该如何解决这个错误?

我通过 lipgpuarray 网站上给出的分步安装解决了这个问题!

下载

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

安装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 ..

安装pygpu

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

来源: http://deeplearning.net/software/libgpuarray/installation.html

这对我有用! 祝你好运

安装 blas 库似乎就足够了。我正在为同样的问题做测试。

cd ~
git clone https://github.com/clMathLibraries/clBLAS.git
cd clBLAS/
mkdir build
cd build/
sudo apt-cache search openblas
sudo apt-get install libopenblas-base libopenblas-dev
sudo apt-get install liblapack3gf liblapack-doc liblapack-dev
cmake ../src
make
sudo make install

之后

git clone https://github.com/Theano/libgpuarray.git
cd libgpuarray
mkdir Build
cd Build
cmake .. -DCMAKE_BUILD_TYPE=Release

make
sudo make install
cd ..
sudo apt-get install cython
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git

关于 python3

的构建和安装
python3 setup.py build
sudo -H python3 setup.py install

希望对您有所帮助。现在我只缺少 theano 的开发版本。