Skip to content

Commit

Permalink
fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Feb 18, 2024
1 parent 71e7531 commit 224eba0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 3 additions & 2 deletions tests/test_cpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,18 @@ def test_asarray():


def test_cuda_array_interface():
dev_sync = importorskip("cuvec.dev_sync")
cupy = importorskip("cupy")
v = cu.asarray(np.random.random(shape))
assert hasattr(v, '__cuda_array_interface__')

c = cupy.asarray(v)
assert (c == v).all()
c[0, 0, 0] = 1
cu.dev_sync()
dev_sync()
assert c[0, 0, 0] == v[0, 0, 0]
c[0, 0, 0] = 0
cu.dev_sync()
dev_sync()
assert c[0, 0, 0] == v[0, 0, 0]

ndarr = v + 1
Expand Down
3 changes: 1 addition & 2 deletions tests/test_pybind11.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import numpy as np
from pytest import importorskip, mark, raises

from cuvec import dev_sync

cu = importorskip("cuvec.pybind11")
shape = 127, 344, 344

Expand Down Expand Up @@ -119,6 +117,7 @@ def test_asarray():


def test_cuda_array_interface():
dev_sync = importorskip("cuvec.dev_sync")
cupy = importorskip("cupy")
v = cu.asarray(np.random.random(shape))
assert hasattr(v, '__cuda_array_interface__')
Expand Down
3 changes: 1 addition & 2 deletions tests/test_swig.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import numpy as np
from pytest import importorskip, mark, raises

from cuvec import dev_sync

cu = importorskip("cuvec.swig")
shape = 127, 344, 344

Expand Down Expand Up @@ -119,6 +117,7 @@ def test_asarray():


def test_cuda_array_interface():
dev_sync = importorskip("cuvec.dev_sync")
cupy = importorskip("cupy")
v = cu.asarray(np.random.random(shape))
assert hasattr(v, '__cuda_array_interface__')
Expand Down

0 comments on commit 224eba0

Please sign in to comment.