Skip to content

Commit a4acb81

Browse files
authored
Merge branch 'master' into cupy_reduce_cub_backend2
2 parents a44c0bb + 265b446 commit a4acb81

60 files changed

Lines changed: 1691 additions & 420 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.mergify.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ pull_request_rules:
55
- label=st:test-and-merge
66
- status-success=Jenkins
77
- status-success=continuous-integration/travis-ci/pr
8-
- status-success=pfn-public-ci/cupy.py2.cv.examples
9-
- status-success=pfn-public-ci/cupy.py2.cv.gpu
108
- status-success=pfn-public-ci/cupy.py3.amd
11-
- status-success=pfn-public-ci/cupy.py3.cv.examples
12-
- status-success=pfn-public-ci/cupy.py3.cv.gpu
139
actions:
1410
merge:
1511
method: merge

.pfnci/config.pbtxt

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -107,39 +107,26 @@ configs {
107107
}
108108
}
109109
110-
# Nightly wheels for ChainerCV tests
110+
# ROCm build test
111111
configs {
112-
key: "cupy.wheel.nightly"
112+
key: "cupy.py37.amd"
113113
value {
114114
requirement {
115115
cpu: 2
116-
memory: 12
116+
memory: 10
117117
}
118-
time_limit {
119-
seconds: 1800
118+
time_limit: {
119+
seconds: 3600
120120
}
121-
command: "sh .pfnci/wheel_nightly.sh"
121+
command: "bash .pfnci/script.sh py37.amd"
122122
}
123123
}
124124
125-
# Python 2 tests are disabled in the master branch, but configs can be removed
126-
# only after removing web hooks.
127-
# TODO(niboshi): Completely remove them after discontinuing v6 series.
128-
configs {
129-
key: "cupy.py2.cv.gpu"
130-
value {
131-
command: "true"
132-
}
133-
}
134-
configs {
135-
key: "cupy.py2.cv.examples"
136-
value {
137-
command: "true"
138-
}
139-
}
140125
141126
# ChainerCV's tests are disabled in the master branch, but configs can be removed
142127
# only after removing web hooks.
128+
# TODO(maehashi): when discontinuing v7 branch, remove the web hooks and remove
129+
# configurations below.
143130
configs {
144131
key: "cupy.py3.cv.gpu"
145132
value {
@@ -152,18 +139,3 @@ configs {
152139
command: "true"
153140
}
154141
}
155-
156-
# ROCm build test
157-
configs {
158-
key: "cupy.py37.amd"
159-
value {
160-
requirement {
161-
cpu: 2
162-
memory: 10
163-
}
164-
time_limit: {
165-
seconds: 3600
166-
}
167-
command: "bash .pfnci/script.sh py37.amd"
168-
}
169-
}

cupy/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ def is_available():
320320
from cupy.manipulation.tiling import tile # NOQA
321321

322322
from cupy.manipulation.add_remove import unique # NOQA
323+
from cupy.manipulation.add_remove import trim_zeros # NOQA
323324

324325
from cupy.manipulation.rearrange import flip # NOQA
325326
from cupy.manipulation.rearrange import fliplr # NOQA
@@ -643,6 +644,7 @@ def isscalar(element):
643644
# -----------------------------------------------------------------------------
644645
from cupy.misc import may_share_memory # NOQA
645646
from cupy.misc import shares_memory # NOQA
647+
from cupy.misc import who # NOQA
646648

647649

648650
# -----------------------------------------------------------------------------
@@ -670,6 +672,7 @@ def isscalar(element):
670672
from cupy._sorting.sort import argsort # NOQA
671673
from cupy._sorting.sort import lexsort # NOQA
672674
from cupy._sorting.sort import msort # NOQA
675+
from cupy._sorting.sort import sort_complex # NOQA
673676
from cupy._sorting.sort import partition # NOQA
674677
from cupy._sorting.sort import sort # NOQA
675678

cupy/_environment.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,24 @@
77
import shutil
88

99

10-
_cuda_path = None
11-
_nvcc_path = None
10+
# '' for uninitialized, None for non-existing
11+
_cuda_path = ''
12+
_nvcc_path = ''
1213
_cub_path = ''
1314

1415

1516
def get_cuda_path():
1617
# Returns the CUDA installation path or None if not found.
1718
global _cuda_path
18-
if _cuda_path is None:
19+
if _cuda_path == '':
1920
_cuda_path = _get_cuda_path()
2021
return _cuda_path
2122

2223

2324
def get_nvcc_path():
2425
# Returns the path to the nvcc command or None if not found.
2526
global _nvcc_path
26-
if _nvcc_path is None:
27+
if _nvcc_path == '':
2728
_nvcc_path = _get_nvcc_path()
2829
return _nvcc_path
2930

cupy/_sorting/sort.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,25 @@ def msort(a):
127127
return sort(a, axis=0)
128128

129129

130-
# TODO(okuta): Implement sort_complex
130+
def sort_complex(a):
131+
"""Sort a complex array using the real part first,
132+
then the imaginary part.
133+
134+
Args:
135+
a (cupy.ndarray): Array to be sorted.
136+
137+
Returns:
138+
cupy.ndarray: sorted complex array.
139+
140+
.. seealso:: :func:`numpy.sort_complex`
141+
142+
"""
143+
if a.dtype.char in 'bhBHF':
144+
a = a.astype('F')
145+
else:
146+
a = a.astype('D')
147+
a.sort()
148+
return a
131149

132150

133151
def partition(a, kth, axis=-1):

cupy/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '8.0.0b2'
1+
__version__ = '8.0.0b3'

cupy/core/_dtype.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ all_type_chars = '?bhilqBHILQefdFD'
99
# b ... int8
1010
# h ... int16
1111
# i ... int32
12-
# l ... int64
12+
# l ... int64 (int32 in windows)
1313
# q ... int64
1414
# B ... uint8
1515
# H ... uint16
1616
# I ... uint32
17-
# L ... uint64
17+
# L ... uint64 (uint32 in windows)
1818
# Q ... uint64
1919
# e ... float16
2020
# f ... float32

cupy/core/_routines_statistics.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ cdef _nanmean_func = create_reduction_func(
521521

522522
_count_non_nan = create_reduction_func(
523523
'cupy_count_non_nan',
524-
('e->l', 'f->l', 'd->l'),
524+
('e->q', 'f->q', 'd->q'),
525525
('isnan(in0) ? 0 : 1', 'a + b', 'out0 = a', None), 0)
526526

527527

cupy/core/core.pxd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ cpdef ndarray asfortranarray(ndarray a, dtype=*)
100100
cpdef Module compile_with_cache(str source, tuple options=*, arch=*,
101101
cachd_dir=*, prepend_cupy_headers=*,
102102
backend=*, translate_cucomplex=*,
103-
enable_cooperative_groups=*)
103+
enable_cooperative_groups=*,
104+
name_expressions=*)
104105

105106

106107
# TODO(niboshi): Move to _routines_creation.pyx

cupy/core/core.pyx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,7 @@ cdef inline str _translate_cucomplex_to_thrust(str source):
18051805
cpdef function.Module compile_with_cache(
18061806
str source, tuple options=(), arch=None, cachd_dir=None,
18071807
prepend_cupy_headers=True, backend='nvrtc', translate_cucomplex=False,
1808-
enable_cooperative_groups=False):
1808+
enable_cooperative_groups=False, name_expressions=None):
18091809
if translate_cucomplex:
18101810
source = _translate_cucomplex_to_thrust(source)
18111811
_cupy_header_list.append('cupy/cuComplex_bridge.h')
@@ -1853,7 +1853,8 @@ cpdef function.Module compile_with_cache(
18531853

18541854
return cuda.compile_with_cache(
18551855
source, options, arch, cachd_dir, extra_source, backend,
1856-
enable_cooperative_groups=enable_cooperative_groups)
1856+
enable_cooperative_groups=enable_cooperative_groups,
1857+
name_expressions=name_expressions)
18571858

18581859

18591860
# =============================================================================

0 commit comments

Comments
 (0)