Skip to content

Commit 5fb850e

Browse files
committed
unmute tests
1 parent d2c623b commit 5fb850e

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

tests/test_fft.py

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,8 @@
1313
get_all_dtypes,
1414
get_complex_dtypes,
1515
get_float_dtypes,
16-
is_cpu_device,
1716
)
1817

19-
# aspects of default device:
20-
_def_device = dpctl.SyclQueue().sycl_device
21-
_def_dev_has_fp64 = _def_device.has_aspect_fp64
22-
is_gpu_with_fp64 = not is_cpu_device() and _def_dev_has_fp64
23-
2418

2519
# TODO: `assert_dtype_allclose` calls in this file have `check_only_type_kind=True`
2620
# since stock NumPy is currently used in public CI for code coverege which
@@ -396,6 +390,10 @@ def test_hfft_1D(self, dtype, n, norm):
396390
def test_hfft_1D_complex(self, dtype, n, norm):
397391
x = dpnp.linspace(-1, 1, 11)
398392
a = dpnp.sin(x) + 1j * dpnp.cos(x)
393+
# input should be Hermitian
394+
a[0].imag = 0
395+
if n in [None, 20]: # Nyquist mode
396+
a[-1].imag = 0
399397
a = dpnp.asarray(a, dtype=dtype)
400398
a_np = dpnp.asnumpy(a)
401399

@@ -446,13 +444,16 @@ def test_fft_1D(self, dtype, n, norm):
446444
# but dpnp return float32 if input is float32
447445
assert_dtype_allclose(result, expected, check_only_type_kind=True)
448446

449-
@pytest.mark.skipif(is_gpu_with_fp64, reason="MKLD17702")
450447
@pytest.mark.parametrize("dtype", get_complex_dtypes())
451448
@pytest.mark.parametrize("n", [None, 5, 20])
452449
@pytest.mark.parametrize("norm", ["forward", "backward", "ortho"])
453450
def test_fft_1D_complex(self, dtype, n, norm):
454451
x = dpnp.linspace(-1, 1, 11)
455452
a = dpnp.sin(x) + 1j * dpnp.cos(x)
453+
# input should be Hermitian
454+
a[0].imag = 0
455+
if n in [None, 20]: # Nyquist mode
456+
a[-1].imag = 0
456457
a = dpnp.asarray(a, dtype=dtype)
457458
a_np = dpnp.asnumpy(a)
458459

@@ -473,29 +474,39 @@ def test_fft_1D_on_2D_array(self, dtype, n, axis, norm, order):
473474
expected = numpy.fft.irfft(a_np, n=n, axis=axis, norm=norm)
474475
assert_dtype_allclose(result, expected, check_only_type_kind=True)
475476

476-
@pytest.mark.skipif(is_gpu_with_fp64, reason="MKLD17702")
477477
@pytest.mark.parametrize("dtype", get_complex_dtypes())
478478
@pytest.mark.parametrize("n", [None, 5, 8])
479479
@pytest.mark.parametrize("axis", [0, 1, 2])
480480
@pytest.mark.parametrize("norm", ["forward", "backward", "ortho"])
481481
@pytest.mark.parametrize("order", ["C", "F"])
482482
def test_fft_1D_on_3D_array(self, dtype, n, axis, norm, order):
483-
x1 = numpy.random.uniform(-10, 10, 24)
484-
x2 = numpy.random.uniform(-10, 10, 24)
483+
x1 = numpy.random.uniform(-10, 10, 120)
484+
x2 = numpy.random.uniform(-10, 10, 120)
485485
a_np = numpy.array(x1 + 1j * x2, dtype=dtype).reshape(
486-
2, 3, 4, order=order
486+
4, 5, 6, order=order
487487
)
488+
# each 1-D array of input should be Hermitian
489+
a_np[0].imag = 0
490+
a_np[:, 0, :].imag = 0
491+
a_np[..., 0].imag = 0
492+
# If output size is even, this is Nyquist mode
493+
a_np[-1].imag = 0
494+
a_np[:, -1, :].imag = 0
495+
a_np[..., -1].imag = 0
488496
a = dpnp.asarray(a_np)
489497

490498
result = dpnp.fft.irfft(a, n=n, axis=axis, norm=norm)
491499
expected = numpy.fft.irfft(a_np, n=n, axis=axis, norm=norm)
492500
assert_dtype_allclose(result, expected, check_only_type_kind=True)
493501

494-
@pytest.mark.skipif(is_gpu_with_fp64, reason="MKLD17702")
495502
@pytest.mark.parametrize("n", [None, 5, 20])
496503
def test_fft_usm_ndarray(self, n):
497504
x = dpt.linspace(-1, 1, 11)
498505
a = dpt.sin(x) + 1j * dpt.cos(x)
506+
# input should be Hermitian
507+
a[0] = dpt.sin(x[0])
508+
if n in [None, 20]: # Nyquist mode
509+
a[-1] = dpt.sin(x[-1])
499510
a_usm = dpt.asarray(a, dtype=dpt.complex64)
500511
a_np = dpt.asnumpy(a_usm)
501512
out_shape = n if n is not None else 2 * (a_usm.shape[0] - 1)
@@ -506,13 +517,16 @@ def test_fft_usm_ndarray(self, n):
506517
expected = numpy.fft.irfft(a_np, n=n)
507518
assert_dtype_allclose(result, expected, check_only_type_kind=True)
508519

509-
@pytest.mark.skipif(is_gpu_with_fp64, reason="MKLD17702")
510520
@pytest.mark.parametrize("dtype", get_complex_dtypes())
511521
@pytest.mark.parametrize("n", [None, 5, 20])
512522
@pytest.mark.parametrize("norm", ["forward", "backward", "ortho"])
513523
def test_fft_1D_out(self, dtype, n, norm):
514524
x = dpnp.linspace(-1, 1, 11)
515525
a = dpnp.sin(x) + 1j * dpnp.cos(x)
526+
# input should be Hermitian
527+
a[0].imag = 0
528+
if n in [None, 20]: # Nyquist mode
529+
a[-1].imag = 0
516530
a = dpnp.asarray(a, dtype=dtype)
517531
a_np = dpnp.asnumpy(a)
518532

tests/test_sycl_queue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ def test_fft(func, device):
12391239

12401240
expected = getattr(numpy.fft, func)(data)
12411241
result = getattr(dpnp.fft, func)(dpnp_data)
1242-
assert_dtype_allclose(result, expected)
1242+
assert_dtype_allclose(result, expected, factor=16)
12431243

12441244
expected_queue = dpnp_data.get_array().sycl_queue
12451245
result_queue = result.get_array().sycl_queue

tests/test_umath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def test_large_values(self, dtype):
313313
assert_dtype_allclose(result, expected)
314314

315315

316-
class TestLogaddexp:
316+
class TestLogAddExp:
317317
@pytest.mark.parametrize("dtype", get_all_dtypes(no_complex=True))
318318
def test_logaddexp(self, dtype):
319319
np_array1, np_array2, expected = _get_numpy_arrays_2in_1out(

0 commit comments

Comments
 (0)