Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test fails when using numpy with MKL backend #2467

Open
gwtnb opened this issue Sep 14, 2019 · 6 comments
Open

Test fails when using numpy with MKL backend #2467

gwtnb opened this issue Sep 14, 2019 · 6 comments
Labels
cat:test Test code / CI prio:medium to-be-backported Pull-requests to be backported to stable branch

Comments

@gwtnb
Copy link
Member

gwtnb commented Sep 14, 2019

% pytest -m 'not slow' -x tests/cupy_tests/fft_tests/test_fft.py                                                                                                                                                                                              
==================================================================================================================== test session starts =====================================================================================================================
platform linux -- Python 3.6.9, pytest-4.6.2, py-1.8.0, pluggy-0.12.0
rootdir: /path/to/cupy, inifile: setup.cfg
plugins: xdist-1.28.0, forked-1.0.2
collected 389 items / 1 deselected / 388 selected                                                                                                                                                                                                            

tests/cupy_tests/fft_tests/test_fft.py ......................................................................................F

========================================================================================================================== FAILURES ==========================================================================================================================
_________________________________________________________________________________________________________________ TestFft2_param_1.test_fft2 _________________________________________________________________________________________________________________

self = <cupy.testing.parameterized.TestFft2_param_1 testMethod=test_fft2>, args = (), kw = {'enable_nd': True}, planning_state = True, nd_planning = True

    @functools.wraps(impl)
    def test_func(self, *args, **kw):
        # get original global planning state
        planning_state = config.enable_nd_planning
        try:
            for nd_planning in states:
                try:
                    # enable or disable nd planning
                    config.enable_nd_planning = nd_planning
    
                    kw[name] = nd_planning
>                   impl(self, *args, **kw)

tests/cupy_tests/fft_tests/test_fft.py:41: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
cupy/testing/helper.py:627: in test_func
    impl(self, *args, **kw)
cupy/testing/helper.py:156: in test_func
    accept_error=accept_error)
cupy/testing/helper.py:92: in _check_cupy_numpy_error
    self.fail('Only numpy raises error\n\n' + numpy_tb)
E   AssertionError: Parameterized test failed.
E   
E   Base test method: TestFft2.test_fft2
E   Test parameters:
E     shape: (3, 4)
E     s: (1, None)
E     axes: None
E     norm: None
E   
E   AssertionError: Only numpy raises error
E   
E   Traceback (most recent call last):
E     File "/path/to/cupy/cupy/testing/helper.py", line 28, in _call_func
E       result = impl(self, *args, **kw)
E     File "/path/to/cupy/tests/cupy_tests/fft_tests/test_fft.py", line 207, in test_fft2
E       out = xp.fft.fft2(a, s=self.s, norm=self.norm)
E     File "/some/path/lib/python3.6/site-packages/mkl_fft/_numpy_fft.py", line 875, in fft2
E       return fftn(x, s=s, axes=axes, norm=norm)
E     File "/some/path/lib/python3.6/site-packages/mkl_fft/_numpy_fft.py", line 683, in fftn
E       output = mkl_fft.fftn(x, s, axes)
E     File "mkl_fft/_pydfti.pyx", line 860, in mkl_fft._pydfti.fftn
E     File "mkl_fft/_pydfti.pyx", line 846, in mkl_fft._pydfti._fftnd_impl
E     File "mkl_fft/_pydfti.pyx", line 724, in mkl_fft._pydfti._iter_fftnd
E     File "mkl_fft/_pydfti.pyx", line 684, in mkl_fft._pydfti._init_nd_shape_and_axes
E   ValueError: when given, shape values must be integers
-------------------------------------------------------------------------------------------------------------------- Captured stdout call --------------------------------------------------------------------------------------------------------------------
dtype is <class 'numpy.float64'>
enable_nd is True
===================================================================================================== 1 failed, 86 passed, 1 deselected in 3.68 seconds ======================================================================================================
@gwtnb
Copy link
Member Author

gwtnb commented Sep 14, 2019

Note that numpy with MKL backend is default on conda.

@gwtnb gwtnb added the to-be-backported Pull-requests to be backported to stable branch label Sep 14, 2019
@leofang
Copy link
Member

leofang commented Sep 17, 2019

It'd be nice to get this fixed. It's indeed annoying when I was testing the FFT module. But I am not sure if we are able to detect the NumPy's backend in tests?

@grlee77
Copy link
Contributor

grlee77 commented Sep 17, 2019

But I am not sure if we are able to detect the NumPy's backend in tests?

Even when MKL is present, non-MKL versions of the functions should still be available. For NumPy <1.17, these are numpy.fft.fftpack.*, etc. (for numpy >=1.17 numpy.fft.pocketfft.*)`.

@leofang
Copy link
Member

leofang commented Sep 17, 2019

@grlee77 wow is numpy.fft.fftpack an undocumented feature of numpy.fft?

@gwtnb
Copy link
Member Author

gwtnb commented Sep 17, 2019

chainer/chainer-test#177

@kmaehashi
Copy link
Member

We discussed and using numpy.fft.fftpack in unit tests sounds reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:test Test code / CI prio:medium to-be-backported Pull-requests to be backported to stable branch
Projects
None yet
Development

No branches or pull requests

4 participants