Skip to content

Backport gh 1833 #1834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ The full list of changes that went into this release are:
* Avoid dead-locking by releasing GIL around blocking operations in libtensor [gh-1753](https://github.com/IntelPython/dpctl/pull/1753)
* Element-wise `tensor.divide` and comparison operations allow greater range of Python integer and integer array combinations [gh-1771](https://github.com/IntelPython/dpctl/pull/1771)
* Fix for unexpected behavior when using floating point types for array indexing [gh-1792](https://github.com/IntelPython/dpctl/pull/1792)
* Enable `pytest --pyargs dpctl.tests` [gh-1833](https://github.com/IntelPython/dpctl/pull/1833)

### Maintenance

Expand Down
19 changes: 19 additions & 0 deletions dpctl/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Data Parallel Control (dpctl)
#
# Copyright 2020-2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

__doc__ = r"""
Test suite of `dpctl`. Running test suite requires Cython,
and a working compiler."""
5 changes: 3 additions & 2 deletions dpctl/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
import sys

import pytest
from _device_attributes_checks import (

from ._device_attributes_checks import (
check,
device_selector,
invalid_filter,
valid_filter,
)
from _numpy_warnings import suppress_invalid_numpy_warnings
from ._numpy_warnings import suppress_invalid_numpy_warnings

sys.path.append(os.path.join(os.path.dirname(__file__), "helper"))

Expand Down
3 changes: 2 additions & 1 deletion dpctl/tests/test_sycl_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
"""

import pytest
from helper import create_invalid_capsule

import dpctl

from .helper import create_invalid_capsule

list_of_valid_filter_selectors = [
"opencl",
"opencl:gpu",
Expand Down
3 changes: 2 additions & 1 deletion dpctl/tests/test_sycl_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
"""

import pytest
from helper import get_queue_or_skip

import dpctl
from dpctl import SyclDeviceCreationError

from .helper import get_queue_or_skip


def test_standard_selectors(device_selector, check):
"""Tests if the standard SYCL device_selectors are able to select a
Expand Down
3 changes: 2 additions & 1 deletion dpctl/tests/test_sycl_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
"""

import pytest
from helper import create_invalid_capsule

import dpctl
import dpctl.memory as dpctl_mem
import dpctl.program as dpctl_prog
import dpctl.tensor as dpt
from dpctl import event_status_type as esty

from .helper import create_invalid_capsule


def produce_event(profiling=False):
oclSrc = " \
Expand Down
3 changes: 2 additions & 1 deletion dpctl/tests/test_sycl_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
import sys

import pytest
from helper import has_sycl_platforms

import dpctl

from .helper import has_sycl_platforms

list_of_valid_filter_selectors = [
"opencl",
"opencl:gpu",
Expand Down
3 changes: 2 additions & 1 deletion dpctl/tests/test_sycl_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
import sys

import pytest
from helper import create_invalid_capsule

import dpctl

from .helper import create_invalid_capsule


def test_standard_selectors(device_selector, check):
"""
Expand Down
3 changes: 2 additions & 1 deletion dpctl/tests/test_tensor_accumulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
from random import randrange

import pytest
from helper import get_queue_or_skip, skip_if_dtype_not_supported

import dpctl.tensor as dpt
from dpctl.utils import ExecutionPlacementError

from .helper import get_queue_or_skip, skip_if_dtype_not_supported

sint_types = [
dpt.int8,
dpt.int16,
Expand Down
3 changes: 2 additions & 1 deletion dpctl/tests/test_tensor_asarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@

import numpy as np
import pytest
from helper import get_queue_or_skip

import dpctl
import dpctl.tensor as dpt

from .helper import get_queue_or_skip


@pytest.mark.parametrize(
"src_usm_type, dst_usm_type",
Expand Down
3 changes: 2 additions & 1 deletion dpctl/tests/test_tensor_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import numpy as np
import pytest
from helper import get_queue_or_skip, skip_if_dtype_not_supported
from numpy.testing import assert_raises_regex

import dpctl
Expand All @@ -29,6 +28,8 @@
)
from dpctl.utils import ExecutionPlacementError

from .helper import get_queue_or_skip, skip_if_dtype_not_supported

_all_dtypes = [
"?",
"u1",
Expand Down
3 changes: 2 additions & 1 deletion dpctl/tests/test_usm_ndarray_ctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@

import numpy as np
import pytest
from helper import get_queue_or_skip, skip_if_dtype_not_supported

import dpctl
import dpctl.memory as dpm
import dpctl.tensor as dpt
from dpctl.tensor import Device

from .helper import get_queue_or_skip, skip_if_dtype_not_supported


@pytest.mark.parametrize(
"shape",
Expand Down
3 changes: 2 additions & 1 deletion dpctl/tests/test_usm_ndarray_dlpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@

import numpy as np
import pytest
from helper import get_queue_or_skip, skip_if_dtype_not_supported

import dpctl
import dpctl.tensor as dpt
import dpctl.tensor._dlpack as _dlp
import dpctl.tensor._usmarray as dpt_arr

from .helper import get_queue_or_skip, skip_if_dtype_not_supported

device_CPU = dpt_arr.DLDeviceType.kDLCPU
device_oneAPI = dpt_arr.DLDeviceType.kDLOneAPI

Expand Down
3 changes: 2 additions & 1 deletion dpctl/tests/test_usm_ndarray_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@

import numpy as np
import pytest
from helper import get_queue_or_skip, skip_if_dtype_not_supported
from numpy.testing import assert_array_equal

import dpctl
import dpctl.tensor as dpt
import dpctl.tensor._tensor_impl as ti
from dpctl.utils import ExecutionPlacementError

from .helper import get_queue_or_skip, skip_if_dtype_not_supported

_all_dtypes = [
"u1",
"i1",
Expand Down
3 changes: 2 additions & 1 deletion dpctl/tests/test_usm_ndarray_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@

import numpy as np
import pytest
from helper import get_queue_or_skip, skip_if_dtype_not_supported

import dpctl
import dpctl.tensor as dpt

from .helper import get_queue_or_skip, skip_if_dtype_not_supported


class TestPrint:
def setup_method(self):
Expand Down
3 changes: 2 additions & 1 deletion dpctl/tests/test_usm_ndarray_search_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@

import numpy as np
import pytest
from helper import get_queue_or_skip, skip_if_dtype_not_supported
from numpy.testing import assert_array_equal

import dpctl.tensor as dpt
from dpctl.tensor._search_functions import _where_result_type
from dpctl.tensor._type_utils import _all_data_types
from dpctl.utils import ExecutionPlacementError

from .helper import get_queue_or_skip, skip_if_dtype_not_supported

_all_dtypes = [
"?",
"u1",
Expand Down
3 changes: 2 additions & 1 deletion dpctl/tests/test_usm_ndarray_searchsorted.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import numpy as np
import pytest
from helper import get_queue_or_skip, skip_if_dtype_not_supported

import dpctl
import dpctl.tensor as dpt
import dpctl.utils as dpu

from .helper import get_queue_or_skip, skip_if_dtype_not_supported


def _check(hay_stack, needles, needles_np):
assert hay_stack.dtype == needles.dtype
Expand Down
Loading