Discussion:
[PyCUDA] RuntimeError: make_default_context()
Lucia Morganti
2015-05-25 15:13:15 UTC
Permalink
Hi all,
on my Linux:

$ lsb_release -a
LSB Version:
:base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.6 (Final)
Release: 6.6
Codename: Final

I have python 2.6.6, numpy-1.4.1-9.el6.x86_64, cuda 6.5.
I tried to install pyCuda following the wiki:

$wget
https://pypi.python.org/packages/source/p/pycuda/pycuda-2014.1.tar.gz#md5=fdc2f59e57ab7256a7e0df0d9d943022
$tar xvf pycuda-2014.1.tar.gz
$cd pycuda-2014.1
$python configure.py --cuda-root=/usr/local/cuda-6.5
$make install
$cd test/
$python test_driver.py

but this gives huge amount of errors like:


# python test_driver.py
====================================================== test session
starts ======================================================
platform linux2 -- Python 2.6.6 -- py-1.4.26 -- pytest-2.6.4
collected 23 items

test_driver.py FFFFFFFFFFFFFFFFxFFFFF.

=========================================================== FAILURES
============================================================
________________________________________________
TestDriver.test_simple_kernel_2
________________________________________________

args = (<test_driver.TestDriver instance at 0x21d9320>,), kwargs = {}
pycuda = <module 'pycuda' from
'/usr/lib64/python2.6/site-packages/pycuda-2014.1-py2.6-linux-x86_64.egg/pycuda/__init__.pyc'>

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()
/usr/lib64/python2.6/site-packages/pycuda-2014.1-py2.6-linux-x86_64.egg/pycuda/tools.py:448:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

ctx_maker = <function ctx_maker at 0x21d7758>

def make_default_context(ctx_maker=None):
if ctx_maker is None:
def ctx_maker(dev):
return dev.make_context()

ndevices = cuda.Device.count()
if ndevices == 0:
raise RuntimeError("No CUDA enabled device found. "
"Please check your installation.")

# Is CUDA_DEVICE set?
import os
devn = os.environ.get("CUDA_DEVICE")

# Is $HOME/.cuda_device set ?
if devn is None:
try:
homedir = os.environ.get("HOME")
assert homedir is not None
devn = (open(os.path.join(homedir, ".cuda_device"))
.read().strip())
except:
pass

# If either CUDA_DEVICE or $HOME/.cuda_device is set, try to use it
if devn is not None:
try:
devn = int(devn)
except TypeError:
raise TypeError("CUDA device number (CUDA_DEVICE or
~/.cuda_device)"
" must be an integer")

dev = cuda.Device(devn)
return ctx_maker(dev)

# Otherwise, try to use any available device
else:
for devn in xrange(ndevices):
dev = cuda.Device(devn)
try:
return ctx_maker(dev)
except cuda.Error:
pass

raise RuntimeError("make_default_context() wasn't able to
create a context "
"on any of the %d detected devices" % ndevices)
E RuntimeError: make_default_context() wasn't able to create a
context on any of the 2 detected devices

/usr/lib64/python2.6/site-packages/pycuda-2014.1-py2.6-linux-x86_64.egg/pycuda/tools.py:204:
RuntimeError


can you please help me?
Many thanks,
Lucia
Andreas Kloeckner
2015-05-25 17:50:04 UTC
Permalink
Checked whether you have permission to access

/dev/nv*

Hope that helps,
Andreas
Post by Lucia Morganti
$ lsb_release -a
:base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.6 (Final)
Release: 6.6
Codename: Final
I have python 2.6.6, numpy-1.4.1-9.el6.x86_64, cuda 6.5.
$wget
https://pypi.python.org/packages/source/p/pycuda/pycuda-2014.1.tar.gz#md5=fdc2f59e57ab7256a7e0df0d9d943022
$tar xvf pycuda-2014.1.tar.gz
$cd pycuda-2014.1
$python configure.py --cuda-root=/usr/local/cuda-6.5
$make install
$cd test/
$python test_driver.py
# python test_driver.py
====================================================== test session
starts ======================================================
platform linux2 -- Python 2.6.6 -- py-1.4.26 -- pytest-2.6.4
collected 23 items
test_driver.py FFFFFFFFFFFFFFFFxFFFFF.
=========================================================== FAILURES
============================================================
________________________________________________
TestDriver.test_simple_kernel_2
________________________________________________
args = (<test_driver.TestDriver instance at 0x21d9320>,), kwargs = {}
pycuda = <module 'pycuda' from
'/usr/lib64/python2.6/site-packages/pycuda-2014.1-py2.6-linux-x86_64.egg/pycuda/__init__.pyc'>
import pycuda.driver
# appears to be idempotent, i.e. no harm in calling it more
than once
pycuda.driver.init()
ctx = make_default_context()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ctx_maker = <function ctx_maker at 0x21d7758>
return dev.make_context()
ndevices = cuda.Device.count()
raise RuntimeError("No CUDA enabled device found. "
"Please check your installation.")
# Is CUDA_DEVICE set?
import os
devn = os.environ.get("CUDA_DEVICE")
# Is $HOME/.cuda_device set ?
homedir = os.environ.get("HOME")
assert homedir is not None
devn = (open(os.path.join(homedir, ".cuda_device"))
.read().strip())
pass
# If either CUDA_DEVICE or $HOME/.cuda_device is set, try to use it
devn = int(devn)
raise TypeError("CUDA device number (CUDA_DEVICE or
~/.cuda_device)"
" must be an integer")
dev = cuda.Device(devn)
return ctx_maker(dev)
# Otherwise, try to use any available device
dev = cuda.Device(devn)
return ctx_maker(dev)
pass
raise RuntimeError("make_default_context() wasn't able to
create a context "
"on any of the %d detected devices" % ndevices)
E RuntimeError: make_default_context() wasn't able to create a
context on any of the 2 detected devices
RuntimeError
can you please help me?
Many thanks,
Lucia
_______________________________________________
PyCUDA mailing list
http://lists.tiker.net/listinfo/pycuda
Lucia Morganti
2015-05-26 09:29:51 UTC
Permalink
Thanks Andreas.
I am root, and here the permissions:

crw-rw-rw- 1 root root 195, 0 Mar 13 13:56 nvidia0
crw-rw-rw- 1 root root 195, 1 Mar 13 13:56 nvidia1
crw-rw-rw- 1 root root 195, 255 Mar 13 13:56 nvidiactl
crw-rw-rw- 1 root root 238, 0 Mar 13 13:56 nvidia-uvm
crw-r----- 1 root kmem 10, 144 Mar 13 13:55 nvram

So I guess this is not the cause of the problem.
Hope someone can help.
Lucia
Post by Andreas Kloeckner
Checked whether you have permission to access
/dev/nv*
Hope that helps,
Andreas
Post by Lucia Morganti
$ lsb_release -a
:base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.6 (Final)
Release: 6.6
Codename: Final
I have python 2.6.6, numpy-1.4.1-9.el6.x86_64, cuda 6.5.
$wget
https://pypi.python.org/packages/source/p/pycuda/pycuda-2014.1.tar.gz#md5=fdc2f59e57ab7256a7e0df0d9d943022
$tar xvf pycuda-2014.1.tar.gz
$cd pycuda-2014.1
$python configure.py --cuda-root=/usr/local/cuda-6.5
$make install
$cd test/
$python test_driver.py
# python test_driver.py
====================================================== test session
starts ======================================================
platform linux2 -- Python 2.6.6 -- py-1.4.26 -- pytest-2.6.4
collected 23 items
test_driver.py FFFFFFFFFFFFFFFFxFFFFF.
=========================================================== FAILURES
============================================================
________________________________________________
TestDriver.test_simple_kernel_2
________________________________________________
args = (<test_driver.TestDriver instance at 0x21d9320>,), kwargs = {}
pycuda = <module 'pycuda' from
'/usr/lib64/python2.6/site-packages/pycuda-2014.1-py2.6-linux-x86_64.egg/pycuda/__init__.pyc'>
import pycuda.driver
# appears to be idempotent, i.e. no harm in calling it more
than once
pycuda.driver.init()
ctx = make_default_context()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ctx_maker = <function ctx_maker at 0x21d7758>
return dev.make_context()
ndevices = cuda.Device.count()
raise RuntimeError("No CUDA enabled device found. "
"Please check your installation.")
# Is CUDA_DEVICE set?
import os
devn = os.environ.get("CUDA_DEVICE")
# Is $HOME/.cuda_device set ?
homedir = os.environ.get("HOME")
assert homedir is not None
devn = (open(os.path.join(homedir, ".cuda_device"))
.read().strip())
pass
# If either CUDA_DEVICE or $HOME/.cuda_device is set, try to use it
devn = int(devn)
raise TypeError("CUDA device number (CUDA_DEVICE or
~/.cuda_device)"
" must be an integer")
dev = cuda.Device(devn)
return ctx_maker(dev)
# Otherwise, try to use any available device
dev = cuda.Device(devn)
return ctx_maker(dev)
pass
raise RuntimeError("make_default_context() wasn't able to
create a context "
"on any of the %d detected devices" % ndevices)
E RuntimeError: make_default_context() wasn't able to create a
context on any of the 2 detected devices
RuntimeError
can you please help me?
Many thanks,
Lucia
_______________________________________________
PyCUDA mailing list
http://lists.tiker.net/listinfo/pycuda
Loading...