Pycuda test_driver.py引发属性错误

时间:2016-10-10 11:48:19

标签: pycuda

我正在尝试在安装了GeForce 960M和Cuda 8.0的Linux Mint上安装pycuda。当我运行test_driver.py脚本时,它会输出以下错误:

=============================测试会话开始=============== =============== platform linux2 - Python 2.7.12,pytest-3.0.3,py-1.4.31,pluggy-0.4.0 rootdir:/home/milton/Downloads/pycuda-2016.1.2,inifile: 收集了28件

test_driver.py ................... x ..... F ..

=================================== FAILURES =========== ======================== ________________________ TestDriver.test_multi_context _________________________

args =(,),kwargs = {}

pycuda =< module'pycuda'来自'/home/milton/miniconda2/lib/python2.7/site-packages/pycuda-2016.1.2-py2.7-linux-x86_64.egg/pycuda/初始化 pyc文件'>

ctx =< pycuda._driver.Context对象位于0x7f540e39d758>

clear_context_caches =< function clear_context_caches at 0x7f540ee26758> collect =<内置函数collect>

def f(*args, **kwargs):
    import pycuda.driver
    # appears to be idempotent, i.e. no harm in calling it more than once
    pycuda.driver.init()

    ctx = make_default_context()
    try:
        assert isinstance(ctx.get_device().name(), str)
        assert isinstance(ctx.get_device().compute_capability(), tuple)
        assert isinstance(ctx.get_device().get_attributes(), dict)
      inner_f(*args, **kwargs)

../../../ miniconda2 / lib / python2.7 / site-packages / pycuda-2016.1.2-py2.7-linux-x86_64.egg / pycuda / tools.py:460:< / p>

self =&lt; test_driver.TestDriver实例位于0x7f540c21fc20&gt;

@mark_cuda_test
def test_multi_context(self):
    if drv.get_version() < (2,0,0):
        return
    if drv.get_version() >= (2,2,0):
      if drv.Context.get_device().compute_mode == drv.compute_mode.EXCLUSIVE:
     

E AttributeError:类型对象'compute_mode'没有属性'EXCLUSIVE'

test_driver.py:638:AttributeError ================ 1次失败,26次通过,在6.92秒内失败1次================

1 个答案:

答案 0 :(得分:1)

python驱动程序计算模式仅支持以下模式:

DEFAULT, 禁止的, EXCLUSIVE_PROCESS

所以请改变这个:

如果drv.Context.get_device()。compute_mode == drv.compute_mode。 EXCLUSIVE

如果drv.Context.get_device()。compute_mode == drv.compute_mode。 EXCLUSIVE_PROCESS

你的test_driver.py文件中的