Milton Llera
Milton Llera

Reputation: 95

Pycuda test_driver.py raises Attribute Error

I'm trying to install pycuda on Linux Mint with a GeForce 960M and Cuda 8.0 installed. When I run the test_driver.py script it outputs the following error:

============================= test session starts ============================== 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: collected 28 items

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

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

args = (,), kwargs = {}

pycuda = <module 'pycuda' from '/home/milton/miniconda2/lib/python2.7/site-packages/pycuda-2016.1.2-py2.7-linux-x86_64.egg/pycuda/init.pyc'>

ctx = <pycuda._driver.Context object at 0x7f540e39d758>

clear_context_caches = <function clear_context_caches at 0x7f540ee26758> collect =<built-in function 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:


self = <test_driver.TestDriver instance at 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 failed, 26 passed, 1 xfailed in 6.92 seconds ================

Upvotes: 1

Views: 661

Answers (1)

Sagar Sahu
Sagar Sahu

Reputation: 11

python driver compute mode only supports following modes:

DEFAULT, PROHIBITED, EXCLUSIVE_PROCESS

so please change this:

if drv.Context.get_device().compute_mode == drv.compute_mode.EXCLUSIVE:

to

if drv.Context.get_device().compute_mode == drv.compute_mode.EXCLUSIVE_PROCESS:

in your test_driver.py file

Upvotes: 1

Related Questions