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

[backport] Fix ravel for strides 0 #5998

Merged
merged 1 commit into from Nov 8, 2021

Conversation

chainer-ci
Copy link
Member

Backport of #5978 by @emcastillo

@chainer-ci chainer-ci added backport Pull-requests backported from development branch cat:bug Bugs prio:high labels Nov 4, 2021
@chainer-ci
Copy link
Member Author

[automatic post] Jenkins, test this please.

@chainer-ci
Copy link
Member Author

Jenkins CI test (for commit 5d37283, target branch v9) succeeded!

@toslunar
Copy link
Member

toslunar commented Nov 5, 2021

pfn-public-ci/cupy.experimental.win.cuda100

The failure seems unrelated to the change. with tempfile.TemporaryDirectory() as root_dir failed on exit. 🤔
https://storage.googleapis.com/chainer-artifacts-pfn-public-ci/cupy-ci/83460/cupy_test_log.txt

================================== FAILURES ===================================
_ TestCubReduction.test_cub_sum[_param_10_{backend='block', order='C', shape=(10, 20, 30)}] _

self = <<cupy_tests.math_tests.test_sumprod.TestCubReduction object at 0x000001F11F4AE198>  parameter: {'backend': 'block', 'order': 'C', 'shape': (10, 20, 30)}>
xp = <module 'cupy' from 'C:\\Development\\Python\\Python37\\lib\\site-packages\\cupy\\__init__.py'>
dtype = <class 'numpy.float64'>, axis = (1, 2)

    @testing.for_contiguous_axes()
    # sum supports less dtypes; don't test float16 as it's not as accurate?
    @testing.for_dtypes('qQfdFD')
    @testing.numpy_cupy_allclose(rtol=1E-5)
    def test_cub_sum(self, xp, dtype, axis):
        a = testing.shaped_random(self.shape, xp, dtype)
        if self.order in ('c', 'C'):
            a = xp.ascontiguousarray(a)
        elif self.order in ('f', 'F'):
            a = xp.asfortranarray(a)
    
        if xp is numpy:
            return a.sum(axis=axis)
    
        # xp is cupy, first ensure we really use CUB
        ret = cupy.empty(())  # Cython checks return type, need to fool it
        if self.backend == 'device':
            func_name = 'cupy._core._routines_math.cub.'
            if len(axis) == len(self.shape):
                func_name += 'device_reduce'
            else:
                func_name += 'device_segmented_reduce'
            with testing.AssertFunctionIsCalled(func_name, return_value=ret):
                a.sum(axis=axis)
        elif self.backend == 'block':
            # this is the only function we can mock; the rest is cdef'd
            func_name = 'cupy._core._cub_reduction.'
            func_name += '_SimpleCubReductionKernel_get_cached_function'
            func = _cub_reduction._SimpleCubReductionKernel_get_cached_function
            if len(axis) == len(self.shape):
                times_called = 2  # two passes
            else:
                times_called = 1  # one pass
            with testing.AssertFunctionIsCalled(
                    func_name, wraps=func, times_called=times_called):
>               a.sum(axis=axis)

cupy_tests\math_tests\test_sumprod.py:266: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cupy\_core\core.pyx:953: in cupy._core.core.ndarray.sum
    ???
cupy\_core\core.pyx:961: in cupy._core.core.ndarray.sum
    ???
cupy\_core\_routines_math.pyx:118: in cupy._core._routines_math._ndarray_sum
    ???
cupy\_core\_reduction.pyx:564: in cupy._core._reduction._SimpleReductionKernel.__call__
    ???
cupy\_core\_reduction.pyx:349: in cupy._core._reduction._AbstractReductionKernel._call
    ???
cupy\_core\_cub_reduction.pyx:700: in cupy._core._cub_reduction._try_to_call_cub_reduction
    ???
cupy\_core\_cub_reduction.pyx:550: in cupy._core._cub_reduction._launch_cub
    ???
C:\Development\Python\Python37\lib\unittest\mock.py:951: in __call__
    return _mock_self._mock_call(*args, **kwargs)
C:\Development\Python\Python37\lib\unittest\mock.py:1026: in _mock_call
    return self._mock_wraps(*args, **kwargs)
cupy\_util.pyx:59: in cupy._util.memoize.decorator.ret
    ???
cupy\_core\_cub_reduction.pyx:243: in cupy._core._cub_reduction._SimpleCubReductionKernel_get_cached_function
    ???
cupy\_core\_cub_reduction.pyx:228: in cupy._core._cub_reduction._create_cub_reduction_function
    ???
cupy\_core\core.pyx:2043: in cupy._core.core.compile_with_cache
    ???
C:\Development\Python\Python37\lib\site-packages\cupy\cuda\compiler.py:463: in compile_with_cache
    cache_in_memory, jitify)
C:\Development\Python\Python37\lib\site-packages\cupy\cuda\compiler.py:556: in _compile_with_cache_cuda
    log_stream=log_stream)
C:\Development\Python\Python37\lib\site-packages\cupy\cuda\compiler.py:391: in compile_using_nvcc
    assert False, code_type
C:\Development\Python\Python37\lib\tempfile.py:805: in __exit__
    self.cleanup()
C:\Development\Python\Python37\lib\tempfile.py:809: in cleanup
    _shutil.rmtree(self.name)
C:\Development\Python\Python37\lib\shutil.py:513: in rmtree
    return _rmtree_unsafe(path, onerror)
C:\Development\Python\Python37\lib\shutil.py:401: in _rmtree_unsafe
    onerror(os.rmdir, path, sys.exc_info())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

path = 'C:\\Windows\\TEMP\\flexci\\run-00170418\\tmp\\tmp1yexlmce'
onerror = <function rmtree.<locals>.onerror at 0x000001F1C24FC268>

    def _rmtree_unsafe(path, onerror):
        try:
            with os.scandir(path) as scandir_it:
                entries = list(scandir_it)
        except OSError:
            onerror(os.scandir, path, sys.exc_info())
            entries = []
        for entry in entries:
            fullname = entry.path
            try:
                is_dir = entry.is_dir(follow_symlinks=False)
            except OSError:
                is_dir = False
            if is_dir:
                try:
                    if entry.is_symlink():
                        # This can only happen if someone replaces
                        # a directory with a symlink after the call to
                        # os.scandir or entry.is_dir above.
                        raise OSError("Cannot call rmtree on a symbolic link")
                except OSError:
                    onerror(os.path.islink, fullname, sys.exc_info())
                    continue
                _rmtree_unsafe(fullname, onerror)
            else:
                try:
                    os.unlink(fullname)
                except OSError:
                    onerror(os.unlink, fullname, sys.exc_info())
        try:
>           os.rmdir(path)
E           AssertionError: Only cupy raises error
E           
E           Traceback (most recent call last):
E             File "C:\Development\Python\Python37\lib\site-packages\cupy\testing\_helper.py", line 47, in _call_func
E               result = impl(*args, **kw)
E             File "C:\Windows\TEMP\flexci\run-00170418\work\src\tests\cupy_tests\math_tests\test_sumprod.py", line 266, in test_cub_sum
E               a.sum(axis=axis)
E             File "cupy\_core\core.pyx", line 953, in cupy._core.core.ndarray.sum
E             File "cupy\_core\core.pyx", line 961, in cupy._core.core.ndarray.sum
E             File "cupy\_core\_routines_math.pyx", line 118, in cupy._core._routines_math._ndarray_sum
E             File "cupy\_core\_reduction.pyx", line 564, in cupy._core._reduction._SimpleReductionKernel.__call__
E             File "cupy\_core\_reduction.pyx", line 349, in cupy._core._reduction._AbstractReductionKernel._call
E             File "cupy\_core\_cub_reduction.pyx", line 700, in cupy._core._cub_reduction._try_to_call_cub_reduction
E             File "cupy\_core\_cub_reduction.pyx", line 550, in cupy._core._cub_reduction._launch_cub
E             File "C:\Development\Python\Python37\lib\unittest\mock.py", line 951, in __call__
E               return _mock_self._mock_call(*args, **kwargs)
E             File "C:\Development\Python\Python37\lib\unittest\mock.py", line 1026, in _mock_call
E               return self._mock_wraps(*args, **kwargs)
E             File "cupy\_util.pyx", line 59, in cupy._util.memoize.decorator.ret
E             File "cupy\_core\_cub_reduction.pyx", line 243, in cupy._core._cub_reduction._SimpleCubReductionKernel_get_cached_function
E             File "cupy\_core\_cub_reduction.pyx", line 228, in cupy._core._cub_reduction._create_cub_reduction_function
E             File "cupy\_core\core.pyx", line 2043, in cupy._core.core.compile_with_cache
E             File "C:\Development\Python\Python37\lib\site-packages\cupy\cuda\compiler.py", line 463, in compile_with_cache
E               cache_in_memory, jitify)
E             File "C:\Development\Python\Python37\lib\site-packages\cupy\cuda\compiler.py", line 556, in _compile_with_cache_cuda
E               log_stream=log_stream)
E             File "C:\Development\Python\Python37\lib\site-packages\cupy\cuda\compiler.py", line 391, in compile_using_nvcc
E               assert False, code_type
E             File "C:\Development\Python\Python37\lib\tempfile.py", line 805, in __exit__
E               self.cleanup()
E             File "C:\Development\Python\Python37\lib\tempfile.py", line 809, in cleanup
E               _shutil.rmtree(self.name)
E             File "C:\Development\Python\Python37\lib\shutil.py", line 513, in rmtree
E               return _rmtree_unsafe(path, onerror)
E             File "C:\Development\Python\Python37\lib\shutil.py", line 401, in _rmtree_unsafe
E               onerror(os.rmdir, path, sys.exc_info())
E             File "C:\Development\Python\Python37\lib\shutil.py", line 399, in _rmtree_unsafe
E               os.rmdir(path)
E           OSError: [WinError 145] The directory is not empty: 'C:\\Windows\\TEMP\\flexci\\run-00170418\\tmp\\tmp1yexlmce'

C:\Development\Python\Python37\lib\shutil.py:399: AssertionError
---------------------------- Captured stdout call -----------------------------
dtype is d
axis is (1, 2) , ndim is 3 , shape is (10, 20, 30) , order is C

@emcastillo
Copy link
Member

Jenkins, test this please

@chainer-ci
Copy link
Member Author

Jenkins CI test (for commit 5d37283, target branch v9) failed with status FAILURE.

@emcastillo
Copy link
Member

Jenkins failures unrelated

@emcastillo emcastillo merged commit f2d2622 into cupy:v9 Nov 8, 2021
@emcastillo emcastillo added this to the v9.6.0 milestone Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Pull-requests backported from development branch cat:bug Bugs prio:high
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants