我很难安装pycuda。我在Ubuntu 12.04上运行。我首先安装了Enthought python发行版(尽管我已经在电脑上安装了python)。我将enthought python位置添加到我的.profile中的路径中(并且此工作没有问题,从命令行键入python或ipython正确使用enthought版本)。然后我遵循http://wiki.tiker.net/PyCuda/Installation/Linux/Ubuntu的指示(跳过步骤0-1,因为我已经安装了numpy和cuda)。在Ubuntu上安装Pycuda
一切似乎运行并安装正常。但是当我尝试使用pycuda时,它失败了。例如,这里是当我尝试运行hello_gpu.py例子会发生什么:
:~/Downloads/pycuda-2012.1$ python examples/hello_gpu.py
Traceback (most recent call last):
File "examples/hello_gpu.py", line 1, in <module>
import pycuda.driver as drv
File "/usr/lib/python_enthought/lib/python2.7/site-packages/pycuda-2012.1-py2.7-linux- x86_64.egg/pycuda/driver.py", line 2, in <module>
from pycuda._driver import *
ImportError: /usr/lib/libboost_python-py27.so.1.46.1: undefined symbol:
PyUnicodeUCS4_FromEncodedObject
或者,当我尝试从空闲导入pycuda包,我得到一个不同的错误:
Python 2.7.3 |EPD 7.3-1 (64-bit)| (default, Apr 11 2012, 17:52:16)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "credits", "demo" or "enthought" for more information.
>>> import pycuda
>>> pycuda
<module 'pycuda' from 'pycuda/__init__.pyc'>
>>> import pycuda.driver as drv
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pycuda/driver.py", line 2, in <module>
from pycuda._driver import *
ImportError: No module named _driver
我怀疑问题的一部分是我没有指定Python解释器的正确路径,但我无法弄清楚这个错误发生的地方。任何建议将是最受欢迎的,我没有想法。
如果PyCUDA存在错误,您可以考虑其他选项,例如我正在处理的ArrayFire Python。它是Python最广泛的GPU库,在这里:http://www.accelereyes.com/arrayfire/python/ – arrayfire 2012-07-17 00:51:40
谢谢,虽然因为我有一堆已经写入pycuda的代码,现在切换是一件遗憾的事情... – miz 2012-07-17 01:48:29
@miz:看起来你已经混合了Enthought Python发行版和Ubuntu标准系统Python。您不能将为系统Python构建的二进制库与Enthought(使用intel编译器构建,而不是gcc)混合。你必须使用100%System或100%Enthough(后者可能意味着再次构建你自己的booth-python版本,如果可能的话)。 – talonmies 2012-07-17 08:09:15