From dfe44658fe43c0b8aa138d8c026bd75d637b0453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20And=C3=A9n?= Date: Tue, 28 May 2024 12:08:00 +0200 Subject: [PATCH 1/2] python: improve testing of modeord option Integrate it into the matrix of tests for type 1 and add it for the type 2 tests as well. --- python/finufft/test/test_finufft_plan.py | 41 ++++++++++-------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/python/finufft/test/test_finufft_plan.py b/python/finufft/test/test_finufft_plan.py index 5df87c38e..4d8a57ee2 100644 --- a/python/finufft/test/test_finufft_plan.py +++ b/python/finufft/test/test_finufft_plan.py @@ -12,16 +12,18 @@ N_PTS = [10, 11] DTYPES = [np.complex64, np.complex128] OUTPUT_ARGS = [False, True] +MODEORDS = [0, 1] @pytest.mark.parametrize("dtype", DTYPES) @pytest.mark.parametrize("shape", SHAPES) @pytest.mark.parametrize("n_pts", N_PTS) @pytest.mark.parametrize("output_arg", OUTPUT_ARGS) -def test_finufft1_plan(dtype, shape, n_pts, output_arg): +@pytest.mark.parametrize("modeord", MODEORDS) +def test_finufft1_plan(dtype, shape, n_pts, output_arg, modeord): pts, coefs = utils.type1_problem(dtype, shape, n_pts) - plan = Plan(1, shape, dtype=dtype) + plan = Plan(1, shape, dtype=dtype, modeord=modeord) plan.setpts(*pts) @@ -31,6 +33,9 @@ def test_finufft1_plan(dtype, shape, n_pts, output_arg): sig = np.empty(shape, dtype=dtype) plan.execute(coefs, out=sig) + if modeord == 1: + sig = np.fft.fftshift(sig) + utils.verify_type1(pts, coefs, shape, sig, 1e-6) @@ -38,18 +43,24 @@ def test_finufft1_plan(dtype, shape, n_pts, output_arg): @pytest.mark.parametrize("shape", SHAPES) @pytest.mark.parametrize("n_pts", N_PTS) @pytest.mark.parametrize("output_arg", OUTPUT_ARGS) -def test_finufft2_plan(dtype, shape, n_pts, output_arg): +@pytest.mark.parametrize("modeord", MODEORDS) +def test_finufft2_plan(dtype, shape, n_pts, output_arg, modeord): pts, sig = utils.type2_problem(dtype, shape, n_pts) - plan = Plan(2, shape, dtype=dtype) + plan = Plan(2, shape, dtype=dtype, modeord=modeord) plan.setpts(*pts) + if modeord == 1: + _sig = np.fft.ifftshift(sig) + else: + _sig = sig + if not output_arg: - coefs = plan.execute(sig) + coefs = plan.execute(_sig) else: coefs = np.empty(n_pts, dtype=dtype) - plan.execute(sig, out=coefs) + plan.execute(_sig, out=coefs) utils.verify_type2(pts, sig, coefs, 1e-6) @@ -76,24 +87,6 @@ def test_finufft3_plan(dtype, dim, n_source_pts, n_target_pts, output_arg): utils.verify_type3(source_pts, source_coefs, target_pts, target_coefs, 1e-6) -def test_finufft_plan_modeord(): - dtype = "complex64" - shape = (8, 8) - n_pts = 17 - - plan = Plan(1, shape, dtype=dtype, modeord=1) - - pts, coefs = utils.type1_problem(dtype, shape, n_pts) - - plan.setpts(*pts) - - sig = plan.execute(coefs) - - sig = np.fft.fftshift(sig) - - utils.verify_type1(pts, coefs, shape, sig, 1e-6) - - def test_finufft_plan_errors(): with pytest.raises(RuntimeError, match="must be single or double"): Plan(1, (8, 8), dtype="uint32") From b1b907b0c3e5f0bea088bfccf9a83fa136838441 Mon Sep 17 00:00:00 2001 From: Libin Lu Date: Wed, 29 May 2024 06:51:25 -0400 Subject: [PATCH 2/2] Update cmake_ci.yml Switch to gcc-12 on macos-13 gh runner image, gcc >= 13.3.0 seems to have incompatible headers with macos sdk --- .github/workflows/cmake_ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake_ci.yml b/.github/workflows/cmake_ci.yml index 6f74a00ea..d5cf0cd14 100644 --- a/.github/workflows/cmake_ci.yml +++ b/.github/workflows/cmake_ci.yml @@ -16,7 +16,7 @@ jobs: - macos-13 compiler: - llvm - - gcc + - gcc-12 # you can specify the version after `-` like `llvm-13.0.0`. generator: - "Ninja" @@ -32,7 +32,7 @@ jobs: finufft_static_linking: "OFF" exclude: - os: "windows-2022" - compiler: "gcc" + compiler: "gcc-12" generator: "Ninja" build_type: "Release" steps: