Skip to content

Commit 6cff8e9

Browse files
iannapre-commit-ci[bot]jpivarski
authored
fix: wait for Jitify performing a one-time only warm-up (#3113)
* fix: wait for Jitify that is performing a one-time only warm-up * fix: move cupy test to test-cuda * style: pre-commit fixes * fix: move cupy test * style: pre-commit fixes * fix: move cupy test from test_2649_dlpack_support.py * fix: move cupy test out --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jim Pivarski <[email protected]>
1 parent 727ff9c commit 6cff8e9

File tree

4 files changed

+39
-18
lines changed

4 files changed

+39
-18
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward/blob/main/LICENSE
2+
3+
from __future__ import annotations
4+
5+
import pytest
6+
7+
import awkward as ak
8+
9+
10+
def test_wrap_index_cupy():
11+
cp = pytest.importorskip("cupy")
12+
data = cp.arange(10, dtype=cp.int64)
13+
index = ak.index.Index64(data)
14+
other_data = cp.asarray(index)
15+
result = cp.shares_memory(data, other_data)
16+
assert result is True
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward/blob/main/LICENSE
2+
3+
from __future__ import annotations
4+
5+
import numpy as np
6+
import pytest
7+
from packaging.version import parse as parse_version
8+
9+
import awkward as ak
10+
11+
if parse_version(np.__version__) < parse_version("1.23.0"):
12+
pytest.skip(
13+
"NumPy 1.23 or greater is required for DLPack testing", allow_module_level=True
14+
)
15+
16+
17+
def test_from_dlpack_cupy():
18+
# This test only checks cupy usage, it doesn't explicitly test GPU & CPU
19+
cp = pytest.importorskip("cupy")
20+
cp_array = cp.arange(2 * 3 * 4 * 5).reshape(2, 3, 4, 5)
21+
array = ak.from_dlpack(cp_array)
22+
cp_from_ak = ak.to_cupy(array)
23+
assert cp.shares_memory(cp_array, cp_from_ak)

tests/test_2327_array_interface.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,10 @@
33
from __future__ import annotations
44

55
import numpy as np
6-
import pytest
76

87
import awkward as ak
98

109

11-
def test_wrap_index_cupy():
12-
cp = pytest.importorskip("cupy")
13-
data = cp.arange(10, dtype=cp.int64)
14-
index = ak.index.Index64(data)
15-
other_data = cp.asarray(index)
16-
assert cp.shares_memory(data, other_data)
17-
18-
1910
def test_wrap_index_numpy():
2011
data = np.arange(10, dtype=np.int64)
2112
index = ak.index.Index64(data)

tests/test_2649_dlpack_support.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,6 @@ def test_from_dlpack_numpy():
2121
assert np.shares_memory(np_array, np_from_ak)
2222

2323

24-
def test_from_dlpack_cupy():
25-
# This test only checks cupy usage, it doesn't explicitly test GPU & CPU
26-
cp = pytest.importorskip("cupy")
27-
cp_array = cp.arange(2 * 3 * 4 * 5).reshape(2, 3, 4, 5)
28-
array = ak.from_dlpack(cp_array)
29-
cp_from_ak = ak.to_cupy(array)
30-
assert cp.shares_memory(cp_array, cp_from_ak)
31-
32-
3324
class DLPackOf:
3425
def __init__(self, array):
3526
self._array = array

0 commit comments

Comments
 (0)