2016-10-10 23 views
1

我試圖在安裝有GeForce 960M和Cuda 8.0的Linux Mint上安裝pycuda。當我運行test_driver.py腳本時,它輸出以下錯誤: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 = <模塊 '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 = <功能clear_context_caches在0x7f540ee26758> 收集= <內置功能離子收集>

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:


自我= < test_driver.TestDriver實例在0x7f540c21fc20>

@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: type object 'compute_mode' has no attribute 'EXCLUSIVE'

test_driver.py:638:AttributeError ================ 1失敗,26通過,1 xfailed在6.92秒============= ===

回答

1

蟒蛇司機計算模式只支持以下幾種模式:

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文件