Skip to content
Open
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
34 changes: 34 additions & 0 deletions dpnp/tests/third_party/cupy/binary_tests/test_elementwise.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import unittest

from dpnp.tests.third_party.cupy import testing
Expand Down Expand Up @@ -27,6 +29,38 @@ def test_bitwise_or(self):
def test_bitwise_xor(self):
self.check_binary_int("bitwise_xor")

@testing.with_requires("numpy>=2.0.0")
@testing.for_int_dtypes(no_bool=True)
@testing.numpy_cupy_array_equal()
def test_bitwise_count(self, xp, dtype):
info = xp.iinfo(dtype)
if xp.issubdtype(dtype, xp.signedinteger):
a = xp.array(
[
0,
-1,
1,
info.min,
info.min + 1,
info.max,
info.max - 1,
info.max // 2,
],
dtype=dtype,
)
else:
a = xp.array(
[
0,
1,
info.max,
info.max - 1,
info.max // 2,
],
dtype=dtype,
)
return xp.bitwise_count(a)

def test_invert(self):
self.check_unary_int("invert")

Expand Down
4 changes: 3 additions & 1 deletion dpnp/tests/third_party/cupy/core_tests/test_core.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import sys
import unittest

Expand Down Expand Up @@ -97,7 +99,7 @@ def test_cupy_ndarray(self, dtype):
@testing.parameterize(
*testing.product(
{
"cxx": (None, "--std=c++11"),
"cxx": (None, "--std=c++14"),
}
)
)
Expand Down
7 changes: 3 additions & 4 deletions dpnp/tests/third_party/cupy/core_tests/test_function.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import unittest

import numpy
import pytest

import dpnp as cupy
Expand All @@ -18,9 +19,7 @@
def _compile_func(kernel_name, code):
# workaround for hipRTC
extra_source = core._get_header_source() if runtime.is_hip else None
mod = compiler._compile_module_with_cache(
code, options=("--std=c++11",), extra_source=extra_source
)
mod = compiler._compile_module_with_cache(code, extra_source=extra_source)
return mod.get_function(kernel_name)


Expand Down
23 changes: 23 additions & 0 deletions dpnp/tests/third_party/cupy/functional_tests/test_vectorize.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import unittest

import numpy
Expand All @@ -8,9 +10,24 @@

# from cupy.cuda import runtime


# def _rocm_version_major():
# if not getattr(runtime, "is_hip", False):
# return -1

# version = runtime.runtimeGetVersion()
# major = version // 10_000_000
# return int(major)


# _ROCM_VER_MAJOR = _rocm_version_major()
# _IS_HIP_LT7 = bool(_ROCM_VER_MAJOR != -1 and int(_ROCM_VER_MAJOR) < 7)


pytest.skip("dpnp.vectorize is not implemented", allow_module_level=True)


# @pytest.mark.skipif(_IS_HIP_LT7, reason="Skip on ROCm < 7 (HIP).")
class TestVectorizeOps(unittest.TestCase):

def _run(self, func, xp, dtypes):
Expand Down Expand Up @@ -225,6 +242,7 @@ def my_usub(x):
return self._run(my_usub, xp, [dtype])


# @pytest.mark.skipif(_IS_HIP_LT7, reason="Skip on ROCm < 7 (HIP).")
class TestVectorizeExprs(unittest.TestCase):

@testing.for_all_dtypes(name="cond_dtype", no_complex=True)
Expand Down Expand Up @@ -293,6 +311,7 @@ def my_typecast(x):
return f(x)


# @pytest.mark.skipif(_IS_HIP_LT7, reason="Skip on ROCm < 7 (HIP).")
class TestVectorizeInstructions(unittest.TestCase):

@testing.for_all_dtypes()
Expand Down Expand Up @@ -371,6 +390,7 @@ def my_nonconst_result(x):
return f(x)


# @pytest.mark.skipif(_IS_HIP_LT7, reason="Skip on ROCm < 7 (HIP).")
class TestVectorizeStmts(unittest.TestCase):

@testing.numpy_cupy_array_equal()
Expand Down Expand Up @@ -567,6 +587,7 @@ def __init__(self, x):
self.x = x


# @pytest.mark.skipif(_IS_HIP_LT7, reason="Skip on ROCm < 7 (HIP).")
class TestVectorizeConstants(unittest.TestCase):

@testing.numpy_cupy_array_equal()
Expand Down Expand Up @@ -594,6 +615,7 @@ def my_func(x1, x2):
return f(x1, x2)


# @pytest.mark.skipif(_IS_HIP_LT7, reason="Skip on ROCm < 7 (HIP).")
class TestVectorizeBroadcast(unittest.TestCase):

@testing.for_all_dtypes(no_bool=True)
Expand Down Expand Up @@ -630,6 +652,7 @@ def my_func(x1, x2):
return f(x1, x2)


# @pytest.mark.skipif(_IS_HIP_LT7, reason="Skip on ROCm < 7 (HIP).")
class TestVectorize(unittest.TestCase):

@testing.for_all_dtypes(no_bool=True)
Expand Down
Loading