Discussion:
[PyCUDA] Bug in register_host_memory
Tomasz Rybak
2013-06-20 20:28:19 UTC
Permalink
Hello.
I've been packaging PyCUDA for Debian.
I run all the tests to ensure that package works on Python 2
and Python 3. All tests pass except for on from test_driver.py:

$ python test_driver.py
============================= test session starts
==============================
platform linux2 -- Python 2.7.5 -- pytest-2.3.5
collected 21 items

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

=================================== FAILURES
===================================
_____________________ TestDriver.test_register_host_memory
_____________________

args = (<test_driver.TestDriver instance at 0x24e7d88>,), kwargs = {}
pycuda = <module 'pycuda' from
'/usr/lib/python2.7/dist-packages/pycuda/__init__.pyc'>
ctx = <pycuda._driver.Context object at 0x2504488>
clear_context_caches = <function clear_context_caches at 0x1dbf848>
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)
/usr/lib/python2.7/dist-packages/pycuda/tools.py:434:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _

self = <test_driver.TestDriver instance at 0x24e7d88>

@mark_cuda_test
def test_register_host_memory(self):
if drv.get_version() < (4,):
from py.test import skip
skip("register_host_memory only exists on CUDA 4.0 and
later")

import sys
if sys.platform == "darwin":
from py.test import skip
skip("register_host_memory is not supported on OS X")

a = drv.aligned_empty((2**20,), np.float64, alignment=4096)
drv.register_host_memory(a)
E LogicError: cuMemHostRegister failed: invalid value

test_driver.py:559: LogicError
==================== 1 failed, 20 passed in 116.85 seconds
=====================

This test fails both on ION (GeForce 9400M, CC 1.1) and GeForce 460
(CC 2.1). I've compiled PyCUDA with gcc 4.8, run with kernel 3.9
and drivers 304.88.

Regards.
--
Tomasz Rybak GPG/PGP key ID: 2AD5 9860
Fingerprint A481 824E 7DD3 9C0E C40A 488E C654 FB33 2AD5 9860
http://member.acm.org/~tomaszrybak

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.tiker.net/pipermail/pycuda/attachments/20130620/06abdabc/attachment.sig>
Andreas Kloeckner
2013-06-21 06:16:29 UTC
Permalink
Hi Tomasz,
Post by Tomasz Rybak
I've been packaging PyCUDA for Debian.
I run all the tests to ensure that package works on Python 2
$ python test_driver.py
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
self = <test_driver.TestDriver instance at 0x24e7d88>
@mark_cuda_test
from py.test import skip
skip("register_host_memory only exists on CUDA 4.0 and
later")
import sys
from py.test import skip
skip("register_host_memory is not supported on OS X")
a = drv.aligned_empty((2**20,), np.float64, alignment=4096)
drv.register_host_memory(a)
E LogicError: cuMemHostRegister failed: invalid value
test_driver.py:559: LogicError
==================== 1 failed, 20 passed in 116.85 seconds
=====================
This test fails both on ION (GeForce 9400M, CC 1.1) and GeForce 460
(CC 2.1). I've compiled PyCUDA with gcc 4.8, run with kernel 3.9
and drivers 304.88.
Oddly enough, I know about this issue already--my CI server keeps
bugging me about it. I looked into it, but unfortunately I don't quite
know what to make of it. The pointer that gets fed to CUDA has the right
alignment. The same code used to work. The docs for cuMemHostRegister
don't require anything in particular about the arguments passed. I'm
really at a loss.

My leading theory is "driver bug", but again, I'm not sure. I'd very
much appreciate any insight...

Andreas
Andreas Kloeckner
2014-07-17 19:20:18 UTC
Permalink
Post by Andreas Kloeckner
Hi Tomasz,
Post by Tomasz Rybak
I've been packaging PyCUDA for Debian.
I run all the tests to ensure that package works on Python 2
$ python test_driver.py
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
self = <test_driver.TestDriver instance at 0x24e7d88>
@mark_cuda_test
from py.test import skip
skip("register_host_memory only exists on CUDA 4.0 and
later")
import sys
from py.test import skip
skip("register_host_memory is not supported on OS X")
a = drv.aligned_empty((2**20,), np.float64, alignment=4096)
drv.register_host_memory(a)
E LogicError: cuMemHostRegister failed: invalid value
test_driver.py:559: LogicError
==================== 1 failed, 20 passed in 116.85 seconds
=====================
This test fails both on ION (GeForce 9400M, CC 1.1) and GeForce 460
(CC 2.1). I've compiled PyCUDA with gcc 4.8, run with kernel 3.9
and drivers 304.88.
Oddly enough, I know about this issue already--my CI server keeps
bugging me about it. I looked into it, but unfortunately I don't quite
know what to make of it. The pointer that gets fed to CUDA has the right
alignment. The same code used to work. The docs for cuMemHostRegister
don't require anything in particular about the arguments passed. I'm
really at a loss.
My leading theory is "driver bug", but again, I'm not sure. I'd very
much appreciate any insight...
This issue is now tracked at https://github.com/inducer/pycuda/issues/46
.

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.tiker.net/pipermail/pycuda/attachments/20140717/c608aba2/attachment.sig>
Tomasz Rybak
2014-08-04 17:20:30 UTC
Permalink
Dnia 2014-07-17, czw o godzinie 14:20 -0500, Andreas Kloeckner pisze:
[ cut ]
Post by Andreas Kloeckner
This issue is now tracked at https://github.com/inducer/pycuda/issues/46
Thanks for the information, I'll test it soon.
--
Tomasz Rybak GPG/PGP key ID: 2AD5 9860
Fingerprint A481 824E 7DD3 9C0E C40A 488E C654 FB33 2AD5 9860
http://member.acm.org/~tomaszrybak

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.tiker.net/pipermail/pycuda/attachments/20140804/02c273dc/attachment.sig>
Loading...