Skip to content

Commit

Permalink
update the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vtavana committed May 19, 2023
1 parent aef6de3 commit f774228
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
15 changes: 12 additions & 3 deletions dpctl/tests/elementwise/test_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,18 @@ def test_add_dtype_out_keyword(op1_dtype, op2_dtype):


def test_add_errors():
ar1 = dpt.ones(2, dtype="float32", device="gpu")
ar2 = dpt.ones_like(ar1, dtype="int32", device="gpu")
y = dpt.empty_like(ar1, device="cpu")
try:
gpu_queue = dpctl.SyclQueue("gpu")
except dpctl.SyclQueueCreationError:
pytest.skip("SyclQueue('gpu') failed, skipping")
try:
cpu_queue = dpctl.SyclQueue("cpu")
except dpctl.SyclQueueCreationError:
pytest.skip("SyclQueue('cpu') failed, skipping")

ar1 = dpt.ones(2, dtype="float32", sycl_queue=gpu_queue)
ar2 = dpt.ones_like(ar1, sycl_queue=gpu_queue)
y = dpt.empty_like(ar1, sycl_queue=cpu_queue)
assert_raises_regex(
TypeError,
"Input and output allocation queues are not compatible",
Expand Down
14 changes: 12 additions & 2 deletions dpctl/tests/elementwise/test_cos.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pytest
from numpy.testing import assert_raises_regex

import dpctl
import dpctl.tensor as dpt
from dpctl.tests.helper import get_queue_or_skip, skip_if_dtype_not_supported

Expand Down Expand Up @@ -109,8 +110,17 @@ def test_cos_out_keyword(dtype):


def test_cos_errors():
x = dpt.zeros(2, device="gpu")
y = dpt.empty_like(x, device="cpu")
try:
gpu_queue = dpctl.SyclQueue("gpu")
except dpctl.SyclQueueCreationError:
pytest.skip("SyclQueue('gpu') failed, skipping")
try:
cpu_queue = dpctl.SyclQueue("cpu")
except dpctl.SyclQueueCreationError:
pytest.skip("SyclQueue('cpu') failed, skipping")

x = dpt.zeros(2, sycl_queue=gpu_queue)
y = dpt.empty_like(x, sycl_queue=cpu_queue)
assert_raises_regex(
TypeError,
"Input and output allocation queues are not compatible",
Expand Down

0 comments on commit f774228

Please sign in to comment.