Skip to content

Commit

Permalink
Move dpctl.SyclQueue() calls inside try:
Browse files Browse the repository at this point in the history
  • Loading branch information
khaled committed May 18, 2023
1 parent 735424d commit 43470c7
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 32 deletions.
6 changes: 2 additions & 4 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_empty.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ def func(shape, queue):
c = dpnp.empty(shape, dtype=dtype, usm_type=usm_type, sycl_queue=queue)
return c

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
c = func(shape, queue)
except Exception:
pytest.fail("Calling dpnp.empty() inside dpjit failed.")
Expand Down Expand Up @@ -125,9 +124,8 @@ def func(shape, queue):
c = dpnp.empty(shape, sycl_queue=queue, device=device)
return c

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
func(10, queue)
except Exception as e:
assert isinstance(e, errors.TypingError)
Expand Down
6 changes: 2 additions & 4 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_empty_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ def func(x, queue):
y = dpnp.empty_like(x, dtype=dtype, usm_type=usm_type, sycl_queue=queue)
return y

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
a = dpnp.ones(shape, dtype=dtype, usm_type=usm_type, sycl_queue=queue)
c = func(a, queue)
except Exception:
Expand Down Expand Up @@ -130,9 +129,8 @@ def func1(x, queue):
y = dpnp.empty_like(x, sycl_queue=queue, device=device)
return y

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
a = dpnp.ones(10)
func1(a, queue)
except Exception as e:
Expand Down
6 changes: 2 additions & 4 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,8 @@ def func(shape, fill_value, queue):
)
return c

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
c = func(shape, fill_value, queue)
except Exception:
pytest.fail("Calling dpnp.full() inside dpjit failed.")
Expand Down Expand Up @@ -158,9 +157,8 @@ def func(shape, fill_value, queue):
c = dpnp.ones(shape, fill_value, sycl_queue=queue, device=device)
return c

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
func(10, 7, queue)
except Exception as e:
assert isinstance(e, errors.TypingError)
Expand Down
6 changes: 2 additions & 4 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_full_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ def func(x, fill_value, queue):
)
return y

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
a = dpnp.zeros(shape, dtype=dtype, usm_type=usm_type, sycl_queue=queue)
c = func(a, fill_value, queue)
except Exception:
Expand Down Expand Up @@ -162,9 +161,8 @@ def func1(x, fill_value, queue):
y = dpnp.full_like(x, 7, sycl_queue=queue, device=device)
return y

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
a = dpnp.zeros(10)
func1(a, 7, queue)
except Exception as e:
Expand Down
6 changes: 2 additions & 4 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_ones.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,8 @@ def func(shape, queue):
c = dpnp.ones(shape, dtype=dtype, usm_type=usm_type, sycl_queue=queue)
return c

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
c = func(shape, queue)
except Exception:
pytest.fail("Calling dpnp.ones() inside dpjit failed.")
Expand Down Expand Up @@ -127,9 +126,8 @@ def func(shape, queue):
c = dpnp.ones(shape, sycl_queue=queue, device=device)
return c

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
func(10, queue)
except Exception as e:
assert isinstance(e, errors.TypingError)
Expand Down
6 changes: 2 additions & 4 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_ones_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ def func(x, queue):
y = dpnp.ones_like(x, dtype=dtype, usm_type=usm_type, sycl_queue=queue)
return y

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
a = dpnp.zeros(shape, dtype=dtype, usm_type=usm_type, sycl_queue=queue)
c = func(a, queue)
except Exception:
Expand Down Expand Up @@ -134,9 +133,8 @@ def func1(x, queue):
y = dpnp.ones_like(x, sycl_queue=queue, device=device)
return y

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
a = dpnp.zeros(10)
func1(a, queue)
except Exception as e:
Expand Down
6 changes: 2 additions & 4 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_zeros.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ def func(shape, queue):
c = dpnp.zeros(shape, dtype=dtype, usm_type=usm_type, sycl_queue=queue)
return c

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
c = func(shape, queue)
except Exception:
pytest.fail("Calling dpnp.zeros() inside dpjit failed.")
Expand Down Expand Up @@ -128,9 +127,8 @@ def func(shape, queue):
c = dpnp.zeros(shape, sycl_queue=queue, device=device)
return c

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
func(10, queue)
except Exception as e:
assert isinstance(e, errors.TypingError)
Expand Down
6 changes: 2 additions & 4 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_zeros_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ def func(x, queue):
y = dpnp.zeros_like(x, dtype=dtype, usm_type=usm_type, sycl_queue=queue)
return y

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
a = dpnp.ones(shape, dtype=dtype, usm_type=usm_type, sycl_queue=queue)
c = func(a, queue)
except Exception:
Expand Down Expand Up @@ -134,9 +133,8 @@ def func1(x, queue):
y = dpnp.zeros_like(x, sycl_queue=queue, device=device)
return y

queue = dpctl.SyclQueue()

try:
queue = dpctl.SyclQueue()
a = dpnp.ones(10)
func1(a, queue)
except Exception as e:
Expand Down

0 comments on commit 43470c7

Please sign in to comment.