Skip to content

Commit

Permalink
Remove driver.py and move tests/types tests into tests/core/types
Browse files Browse the repository at this point in the history
Refactored tests/core/types/USMNdArray/test_array_creation_errors.py, since we got rid of filter_string and USMNdArray allocates int64 by default, not float64, like they do in numpy and dpnp

Need to use dpctl._sycl_queue_manager
  • Loading branch information
khaled committed May 10, 2023
1 parent f3c7509 commit 60d8783
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 28 deletions.
19 changes: 0 additions & 19 deletions driver.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def test_init():
usma = USMNdArray(1, device=None, queue=None)
assert usma.dtype.name == "float64"
assert usma.dtype.name == "int64"
assert usma.ndim == 1
assert usma.layout == "C"
assert usma.addrspace == 1
Expand All @@ -16,16 +16,21 @@ def test_init():
or str(usma.queue.sycl_device.device_type) == "device_type.gpu"
)

usma = USMNdArray(1, device="cpu", queue=None)
assert usma.dtype.name == "float64"
device = dpctl.SyclDevice().filter_string

usma = USMNdArray(1, device=device, queue=None)
assert usma.dtype.name == "int64"
assert usma.ndim == 1
assert usma.layout == "C"
assert usma.addrspace == 1
assert usma.usm_type == "device"
assert str(usma.queue.sycl_device.device_type) == "device_type.cpu"
assert (
str(usma.queue.sycl_device.device_type) == "device_type.cpu"
or str(usma.queue.sycl_device.device_type) == "device_type.gpu"
)

# usma = USMNdArray(1, device="gpu", queue=None)
# assert usma.dtype.name == "float64"
# assert usma.dtype.name == "int64"
# assert usma.ndim == 1
# assert usma.layout == "C"
# assert usma.addrspace == 1
Expand All @@ -34,15 +39,15 @@ def test_init():

queue = dpctl.SyclQueue()
usma = USMNdArray(1, device=None, queue=queue)
assert usma.dtype.name == "float64"
assert usma.dtype.name == "int64"
assert usma.ndim == 1
assert usma.layout == "C"
assert usma.addrspace == 1
assert usma.usm_type == "device"
assert usma.queue.addressof_ref() > 0

try:
usma = USMNdArray(1, device="cpu", queue=queue)
usma = USMNdArray(1, device=device, queue=queue)
except Exception as e:
assert "exclusive keywords" in str(e)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ def test_default_type_construction():
assert usma.usm_type == "device"

default_device = dpctl.SyclDevice()
cached_queue = dpctl.get_device_cached_queue(default_device)
cached_queue = dpctl._sycl_queue_manager.get_device_cached_queue(
default_device
)

assert usma.device == default_device.filter_string
assert usma.queue == cached_queue
Expand All @@ -38,7 +40,9 @@ def test_type_creation_with_device():

assert usma.device == default_device_str

cached_queue = dpctl.get_device_cached_queue(default_device_str)
cached_queue = dpctl._sycl_queue_manager.get_device_cached_queue(
default_device_str
)

assert usma.queue == cached_queue

Expand Down

0 comments on commit 60d8783

Please sign in to comment.