inducer / inducer/pycuda

make_default_context() wasn't able to create a context

Open
#212 16 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.1k
Forks
298
Avg merge
4m
Merged PRs (30d)
1

Description

When I run test_driver.py in docker container, it fails like this

ctx_maker = .ctx_maker at 0x7f04bfa5b2f0>

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 range(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)
RuntimeError: make_default_context() wasn't able to create a context on any of the 8 detected devices

I use CUDA + OpenGL images from gitlab.com/nvidia/cudagl, particularly 10.0-devel-ubuntu18.04

pycuda sources are from the latest master branch, configured like this

./configure.py --cuda-root=/usr/local/cuda --cuda-enable-gl --cudadrv-lib-dir=/usr/lib/x86_64-linux-gnu

glxgears works, CUDA works (tested by pytorch)

glxinfo output https://pastebin.com/Qp1thpHB

I use xvfb to fake X server

Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.