-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SyclQueue boxing without parent test
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# SPDX-FileCopyrightText: 2020 - 2023 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
""" | ||
Tests for boxing for dpnp.ndarray | ||
""" | ||
|
||
import dpnp | ||
from dpctl import SyclQueue | ||
|
||
from numba_dpex import dpjit | ||
|
||
|
||
def test_boxing_without_parent(): | ||
"""Tests basic boxing and unboxing of a dpnp.ndarray object. | ||
Checks if we can pass in and return a dpctl.ndarray object to and | ||
from a dpjit decorated function. | ||
""" | ||
|
||
@dpjit | ||
def func(arr): | ||
queue = arr.sycl_queue | ||
return queue | ||
|
||
arr = dpnp.empty(10) | ||
|
||
q = func(arr) | ||
|
||
assert q is not None | ||
assert isinstance(q, SyclQueue) | ||
assert id(q) != id(arr.sycl_queue) |