|
9 | 9 | from typing import Any
|
10 | 10 |
|
11 | 11 | import numpy as np
|
12 |
| -from numba import cuda, guvectorize, types |
| 12 | +from numba import cuda, types |
13 | 13 |
|
| 14 | +from sgkit.accelerate import numba_guvectorize |
14 | 15 | from sgkit.typing import ArrayLike
|
15 | 16 |
|
16 | 17 | # The number of parameters for the map step of the respective distance metric
|
|
20 | 21 | }
|
21 | 22 |
|
22 | 23 |
|
23 |
| -@guvectorize( # type: ignore |
| 24 | +@numba_guvectorize( # type: ignore |
24 | 25 | [
|
25 | 26 | "void(float32[:], float32[:], float32[:], float32[:])",
|
26 | 27 | "void(float64[:], float64[:], float64[:], float64[:])",
|
27 | 28 | "void(int8[:], int8[:], int8[:], float64[:])",
|
28 | 29 | ],
|
29 | 30 | "(n),(n),(p)->(p)",
|
30 |
| - nopython=True, |
31 |
| - cache=True, |
32 | 31 | )
|
33 | 32 | def euclidean_map_cpu(
|
34 | 33 | x: ArrayLike, y: ArrayLike, _: ArrayLike, out: ArrayLike
|
@@ -78,15 +77,13 @@ def euclidean_reduce_cpu(v: ArrayLike) -> ArrayLike: # pragma: no cover
|
78 | 77 | return out
|
79 | 78 |
|
80 | 79 |
|
81 |
| -@guvectorize( # type: ignore |
| 80 | +@numba_guvectorize( # type: ignore |
82 | 81 | [
|
83 | 82 | "void(float32[:], float32[:], float32[:], float32[:])",
|
84 | 83 | "void(float64[:], float64[:], float64[:], float64[:])",
|
85 | 84 | "void(int8[:], int8[:], int8[:], float64[:])",
|
86 | 85 | ],
|
87 | 86 | "(n),(n),(p)->(p)",
|
88 |
| - nopython=True, |
89 |
| - cache=True, |
90 | 87 | )
|
91 | 88 | def correlation_map_cpu(
|
92 | 89 | x: ArrayLike, y: ArrayLike, _: ArrayLike, out: ArrayLike
|
@@ -141,14 +138,12 @@ def correlation_map_cpu(
|
141 | 138 | )
|
142 | 139 |
|
143 | 140 |
|
144 |
| -@guvectorize( # type: ignore |
| 141 | +@numba_guvectorize( # type: ignore |
145 | 142 | [
|
146 | 143 | "void(float32[:, :], float32[:])",
|
147 | 144 | "void(float64[:, :], float64[:])",
|
148 | 145 | ],
|
149 | 146 | "(p, m)->()",
|
150 |
| - nopython=True, |
151 |
| - cache=True, |
152 | 147 | )
|
153 | 148 | def correlation_reduce_cpu(v: ArrayLike, out: ArrayLike) -> None: # pragma: no cover
|
154 | 149 | """Corresponding "reduce" function for pearson correlation
|
|
0 commit comments