|
12 | 12 | import naive
|
13 | 13 |
|
14 | 14 | if cuda.is_available():
|
15 |
| - from stumpy.core import _gpu_searchsorted_left, _gpu_searchsorted_right |
16 |
| -else: # pragma: no cover |
17 |
| - from stumpy.core import ( |
18 |
| - _gpu_searchsorted_left_driver_not_found as _gpu_searchsorted_left, |
19 |
| - ) |
20 |
| - from stumpy.core import ( |
21 |
| - _gpu_searchsorted_right_driver_not_found as _gpu_searchsorted_right, |
22 |
| - ) |
| 15 | + |
| 16 | + @cuda.jit("(f8[:, :], f8[:], i8[:], i8, b1, i8[:])") |
| 17 | + def _gpu_searchsorted_kernel(a, v, bfs, nlevel, is_left, idx): |
| 18 | + # A wrapper kernel for calling device function _gpu_searchsorted_left/right. |
| 19 | + i = cuda.grid(1) |
| 20 | + if i < a.shape[0]: |
| 21 | + if is_left: |
| 22 | + idx[i] = core._gpu_searchsorted_left(a[i], v[i], bfs, nlevel) |
| 23 | + else: |
| 24 | + idx[i] = core._gpu_searchsorted_right(a[i], v[i], bfs, nlevel) |
| 25 | + |
23 | 26 |
|
24 | 27 | try:
|
25 | 28 | from numba.errors import NumbaPerformanceWarning
|
|
28 | 31 |
|
29 | 32 | TEST_THREADS_PER_BLOCK = 10
|
30 | 33 |
|
31 |
| -if not cuda.is_available(): # pragma: no cover |
32 |
| - pytest.skip("Skipping Tests No GPUs Available", allow_module_level=True) |
33 |
| - |
34 |
| - |
35 |
| -@cuda.jit("(f8[:, :], f8[:], i8[:], i8, b1, i8[:])") |
36 |
| -def _gpu_searchsorted_kernel(a, v, bfs, nlevel, is_left, idx): |
37 |
| - # A wrapper kernel for calling device function _gpu_searchsorted_left/right. |
38 |
| - i = cuda.grid(1) |
39 |
| - if i < a.shape[0]: |
40 |
| - if is_left: |
41 |
| - idx[i] = _gpu_searchsorted_left(a[i], v[i], bfs, nlevel) |
42 |
| - else: |
43 |
| - idx[i] = _gpu_searchsorted_right(a[i], v[i], bfs, nlevel) |
44 |
| - |
45 | 34 |
|
46 | 35 | def naive_rolling_window_dot_product(Q, T):
|
47 | 36 | window = len(Q)
|
@@ -1403,7 +1392,7 @@ def test_find_matches_maxmatch():
|
1403 | 1392 | @patch("stumpy.config.STUMPY_THREADS_PER_BLOCK", TEST_THREADS_PER_BLOCK)
|
1404 | 1393 | def test_gpu_searchsorted():
|
1405 | 1394 | if not cuda.is_available(): # pragma: no cover
|
1406 |
| - pytest.skip("Skipping Tests No GPUs Available", allow_module_level=True) |
| 1395 | + pytest.skip("Skipping Tests No GPUs Available") |
1407 | 1396 |
|
1408 | 1397 | n = 3 * config.STUMPY_THREADS_PER_BLOCK + 1
|
1409 | 1398 | V = np.empty(n, dtype=np.float64)
|
|
0 commit comments