Theano / libgpuarray

Library to manipulate tensors on the GPU.
Other
189 stars 96 forks source link

pygpu tests fail on numpy 1.11 #197

Closed gokul-uf closed 7 years ago

gokul-uf commented 8 years ago

This is related to #184 After installing libgpuarray and pygpu. when you run python -c "import pygpu; pygpu.test( )

You get the following output.

pygpu is installed in /home/gokul/Envs/theano_reduce_gpu_code/local/lib/python2.7/site-packages/pygpu-0.2.1-py2.7-linux-x86_64.egg/pygpu
NumPy version 1.11.0
NumPy relaxed strides checking option: False
NumPy is installed in /home/gokul/Envs/theano_reduce_gpu_code/local/lib/python2.7/site-packages/numpy
Python version 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2]
nose version 1.3.7

======================================================================
FAIL: pygpu.tests.test_operations.test_xsplit('h', (4, 4), [3, 6])
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/gokul/Envs/theano_reduce_gpu_code/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/gokul/Envs/theano_reduce_gpu_code/local/lib/python2.7/site-packages/pygpu-0.2.1-py2.7-linux-x86_64.egg/pygpu/tests/test_operations.py", line 36, in xsplit
    numpy.testing.assert_allclose(pc, numpy.asarray(pg))
  File "/home/gokul/Envs/theano_reduce_gpu_code/local/lib/python2.7/site-packages/numpy/testing/utils.py", line 1391, in assert_allclose
    verbose=verbose, header=header)
  File "/home/gokul/Envs/theano_reduce_gpu_code/local/lib/python2.7/site-packages/numpy/testing/utils.py", line 688, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

(shapes (4, 0), (0,) mismatch)
 x: array([], shape=(4, 0), dtype=float32)
 y: array([], dtype=float32)

======================================================================
FAIL: pygpu.tests.test_operations.test_xsplit('v', (4, 4), [3, 6])
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/gokul/Envs/theano_reduce_gpu_code/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/gokul/Envs/theano_reduce_gpu_code/local/lib/python2.7/site-packages/pygpu-0.2.1-py2.7-linux-x86_64.egg/pygpu/tests/test_operations.py", line 36, in xsplit
    numpy.testing.assert_allclose(pc, numpy.asarray(pg))
  File "/home/gokul/Envs/theano_reduce_gpu_code/local/lib/python2.7/site-packages/numpy/testing/utils.py", line 1391, in assert_allclose
    verbose=verbose, header=header)
  File "/home/gokul/Envs/theano_reduce_gpu_code/local/lib/python2.7/site-packages/numpy/testing/utils.py", line 688, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

(shapes (0, 4), (0,) mismatch)
 x: array([], shape=(0, 4), dtype=float32)
 y: array([], dtype=float32)

======================================================================
FAIL: pygpu.tests.test_operations.test_xsplit('d', (2, 2, 4), [3, 6])
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/gokul/Envs/theano_reduce_gpu_code/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/gokul/Envs/theano_reduce_gpu_code/local/lib/python2.7/site-packages/pygpu-0.2.1-py2.7-linux-x86_64.egg/pygpu/tests/test_operations.py", line 36, in xsplit
    numpy.testing.assert_allclose(pc, numpy.asarray(pg))
  File "/home/gokul/Envs/theano_reduce_gpu_code/local/lib/python2.7/site-packages/numpy/testing/utils.py", line 1391, in assert_allclose
    verbose=verbose, header=header)
  File "/home/gokul/Envs/theano_reduce_gpu_code/local/lib/python2.7/site-packages/numpy/testing/utils.py", line 688, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

(shapes (2, 2, 0), (0,) mismatch)
 x: array([], shape=(2, 2, 0), dtype=float32)
 y: array([], dtype=float32)

This is because of Numpy 1.11. https://github.com/numpy/numpy/blob/master/doc/release/1.11.0-notes.rst#futurewarning-to-changed-behavior

@abergeron had told me that this was to be expected. This ticket is to fix this for future versions of libgpuarray @nouiz

notoraptor commented 7 years ago

Hello! I re-ran python -c "import pygpu; pygpu.test()" in a conda env with NumPy 1.11.0 and the last version of libgpuarray, and the issue seems to be fixed now:

(python2-7-6-numpy-1-11-0) ~/mila/dev/git$ DEVICE=cuda0 python -c "import pygpu; pygpu.test()"
pygpu is installed in /home/notoraptor/Programmes/anaconda3/envs/python2-7-6-numpy-1-11-0/lib/python2.7/site-packages/pygpu-0.2.1-py2.7-linux-x86_64.egg/pygpu
NumPy version 1.11.0
NumPy relaxed strides checking option: False
NumPy is installed in /home/notoraptor/Programmes/anaconda3/envs/python2-7-6-numpy-1-11-0/lib/python2.7/site-packages/numpy
Python version 2.7.6 |Continuum Analytics, Inc.| (default, May 27 2014, 14:50:58) [GCC 4.1.2 20080704 (Red Hat 4.1.2-54)]
nose version 1.3.7
*** Testing for GeForce 840M
S.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 6590 tests in 245.863s

OK (SKIP=1)

So this ticket could be closed.

nouiz commented 7 years ago

thanks