提交 e7f6b32e authored 作者: abergeron's avatar abergeron

Merge pull request #2817 from lamblin/detect_nvcc_cast_bug

Try to detect bug in nvcc.
......@@ -69,5 +69,24 @@ def test_nvidia_driver3():
assert any([isinstance(node.op, cuda.GpuElemwise) for node in topo])
assert theano.sandbox.cuda.use.device_number is not None
def test_nvcc_cast():
"""Test that the casting behaviour is correct.
Some versions of nvcc, in particular the one in 6.5.14, return an incorrect
value in this case.
Reported by Zijung Zhang at
https://groups.google.com/d/topic/theano-dev/LzHtP2OWeRE/discussion
"""
var = theano.tensor.fvector()
f = theano.function([var], -1. * (var > 0), mode=mode_with_gpu)
if not numpy.allclose(f([-1, 0, 1]), [0, 0, -1]):
raise Exception(
"The version of nvcc that Theano detected on your system "
"has a bug during conversion from integers to floating point. "
"Installing CUDA 7.0 (or more recent) should fix the problem.")
# TODO make sure the test_nvidia_driver test are executed when we make manually
# a CudaNdarray like this: cuda.CudaNdarray.zeros((5,4))
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论