Skip to content

Commit

Permalink
modify related tests to work without float64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
vtavana committed Aug 23, 2023
1 parent a9d0346 commit e17db34
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 30 deletions.
26 changes: 0 additions & 26 deletions tests/skipped_tests_gpu_no_fp64.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,6 @@ tests/test_umath.py::TestArctan2::test_invalid_shape[(2,2)]

tests/test_umath.py::TestSqrt::test_sqrt_complex[complex64]

tests/third_party/cupy/core_tests/test_ndarray_math.py::TestRound_param_0_{decimals=-2}::test_round_out
tests/third_party/cupy/core_tests/test_ndarray_math.py::TestRound_param_1_{decimals=-1}::test_round_out
tests/third_party/cupy/core_tests/test_ndarray_math.py::TestRound_param_2_{decimals=0}::test_round_out
tests/third_party/cupy/core_tests/test_ndarray_math.py::TestRound_param_3_{decimals=1}::test_round_out
tests/third_party/cupy/core_tests/test_ndarray_math.py::TestRound_param_4_{decimals=2}::test_round_out

tests/third_party/cupy/creation_tests/test_ranges.py::TestRanges::test_arange_no_dtype_float
tests/third_party/cupy/creation_tests/test_ranges.py::TestRanges::test_linspace_array_start_stop
tests/third_party/cupy/creation_tests/test_ranges.py::TestRanges::test_linspace_float_overflow
Expand Down Expand Up @@ -1189,26 +1183,6 @@ tests/third_party/cupy/math_tests/test_arithmetic.py::TestArithmeticBinary2_para
tests/third_party/cupy/math_tests/test_arithmetic.py::TestArithmeticBinary2_param_1824_{arg1=-2.0, arg2=array([-3, -2, -1, 1, 2, 3]), dtype=float64, name='fmod', use_dtype=True}::test_binary
tests/third_party/cupy/math_tests/test_arithmetic.py::TestArithmeticBinary2_param_1825_{arg1=-2.0, arg2=array([-3, -2, -1, 1, 2, 3]), dtype=float64, name='fmod', use_dtype=False}::test_binary

tests/third_party/cupy/math_tests/test_rounding.py::TestRound_param_0_{decimals=-2}::test_round_out
tests/third_party/cupy/math_tests/test_rounding.py::TestRound_param_1_{decimals=-1}::test_round_out
tests/third_party/cupy/math_tests/test_rounding.py::TestRound_param_2_{decimals=0}::test_round_out
tests/third_party/cupy/math_tests/test_rounding.py::TestRound_param_3_{decimals=1}::test_round_out
tests/third_party/cupy/math_tests/test_rounding.py::TestRound_param_4_{decimals=2}::test_round_out
tests/third_party/cupy/math_tests/test_rounding.py::TestRoundExtreme_param_0_{decimals=-100}::test_round_large
tests/third_party/cupy/math_tests/test_rounding.py::TestRoundExtreme_param_0_{decimals=-100}::test_round_small
tests/third_party/cupy/math_tests/test_rounding.py::TestRoundExtreme_param_1_{decimals=-99}::test_round_large
tests/third_party/cupy/math_tests/test_rounding.py::TestRoundExtreme_param_1_{decimals=-99}::test_round_small
tests/third_party/cupy/math_tests/test_rounding.py::TestRoundExtreme_param_2_{decimals=-90}::test_round_large
tests/third_party/cupy/math_tests/test_rounding.py::TestRoundExtreme_param_2_{decimals=-90}::test_round_small
tests/third_party/cupy/math_tests/test_rounding.py::TestRoundExtreme_param_3_{decimals=0}::test_round_large
tests/third_party/cupy/math_tests/test_rounding.py::TestRoundExtreme_param_3_{decimals=0}::test_round_small
tests/third_party/cupy/math_tests/test_rounding.py::TestRoundExtreme_param_4_{decimals=90}::test_round_large
tests/third_party/cupy/math_tests/test_rounding.py::TestRoundExtreme_param_4_{decimals=90}::test_round_small
tests/third_party/cupy/math_tests/test_rounding.py::TestRoundExtreme_param_5_{decimals=99}::test_round_large
tests/third_party/cupy/math_tests/test_rounding.py::TestRoundExtreme_param_5_{decimals=99}::test_round_small
tests/third_party/cupy/math_tests/test_rounding.py::TestRoundExtreme_param_6_{decimals=100}::test_round_large
tests/third_party/cupy/math_tests/test_rounding.py::TestRoundExtreme_param_6_{decimals=100}::test_round_small

tests/third_party/cupy/math_tests/test_explog.py::TestExplog::test_exp
tests/third_party/cupy/math_tests/test_explog.py::TestExplog::test_exp2
tests/third_party/cupy/math_tests/test_explog.py::TestExplog::test_expm1
Expand Down
4 changes: 3 additions & 1 deletion tests/third_party/cupy/core_tests/test_ndarray_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pytest

import dpnp as cupy
from tests.helper import has_support_aspect64
from tests.third_party.cupy import testing


Expand Down Expand Up @@ -34,7 +35,8 @@ def test_round(self, xp, dtype):

@testing.numpy_cupy_array_equal()
def test_round_out(self, xp):
a = testing.shaped_random(self.shape, xp, scale=100, dtype="d")
dtype = "d" if has_support_aspect64() else "f"
a = testing.shaped_random(self.shape, xp, scale=100, dtype=dtype)
out = xp.empty_like(a)
a.round(self.decimals, out)
return out
Expand Down
19 changes: 16 additions & 3 deletions tests/third_party/cupy/math_tests/test_rounding.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def test_round(self, xp, dtype):

@testing.numpy_cupy_array_equal()
def test_round_out(self, xp):
a = testing.shaped_random(self.shape, xp, scale=100, dtype="d")
dtype = "d" if has_support_aspect64() else "f"
a = testing.shaped_random(self.shape, xp, scale=100, dtype=dtype)
out = xp.empty_like(a)
xp.around(a, self.decimals, out)
return out
Expand All @@ -120,13 +121,25 @@ def test_round_out(self, xp):
class TestRoundExtreme(unittest.TestCase):
shape = (20,)

@testing.for_dtypes([numpy.float64, numpy.complex128])
dtype_ = (
[numpy.float64, numpy.complex128]
if has_support_aspect64()
else [numpy.float32, numpy.complex64]
)

@testing.for_dtypes(dtype_)
@testing.numpy_cupy_allclose()
def test_round_large(self, xp, dtype):
a = testing.shaped_random(self.shape, xp, scale=1e100, dtype=dtype)
return xp.around(a, self.decimals)

@testing.for_dtypes([numpy.float64, numpy.complex128])
dtype_ = (
[numpy.float64, numpy.complex128]
if has_support_aspect64()
else [numpy.float32, numpy.complex64]
)

@testing.for_dtypes(dtype_)
@testing.numpy_cupy_allclose()
def test_round_small(self, xp, dtype):
a = testing.shaped_random(self.shape, xp, scale=1e-100, dtype=dtype)
Expand Down

0 comments on commit e17db34

Please sign in to comment.