From 8fdb7bbc50834c29aca877d5e47e9d4efa899b73 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 10 Nov 2025 11:30:26 +0100 Subject: [PATCH 1/4] Add pyupgrade hook to automatically upgrade syntax for newer versions of the language. --- .pre-commit-config.yaml | 4 ++ benchmarks/benchmarks/__init__.py | 1 - benchmarks/benchmarks/bench_elementwise.py | 1 - benchmarks/benchmarks/bench_linalg.py | 1 - benchmarks/benchmarks/bench_random.py | 1 - benchmarks/benchmarks/common.py | 1 - benchmarks/pytest_benchmark/test_random.py | 1 - doc/conf.py | 1 - doc/docstring_template.py | 1 - dpnp/__init__.py | 1 - dpnp/_version.py | 5 +- dpnp/config.py | 1 - dpnp/dpnp_algo/__init__.py | 1 - dpnp/dpnp_algo/dpnp_arraycreation.py | 1 - dpnp/dpnp_algo/dpnp_elementwise_common.py | 1 - dpnp/dpnp_algo/dpnp_fill.py | 1 - dpnp/dpnp_array.py | 1 - dpnp/dpnp_array_api_info.py | 1 - dpnp/dpnp_container.py | 1 - dpnp/dpnp_flatiter.py | 1 - dpnp/dpnp_iface.py | 1 - dpnp/dpnp_iface_arraycreation.py | 1 - dpnp/dpnp_iface_bitwise.py | 1 - dpnp/dpnp_iface_counting.py | 1 - dpnp/dpnp_iface_histograms.py | 1 - dpnp/dpnp_iface_indexing.py | 1 - dpnp/dpnp_iface_linearalgebra.py | 1 - dpnp/dpnp_iface_logic.py | 1 - dpnp/dpnp_iface_manipulation.py | 1 - dpnp/dpnp_iface_mathematical.py | 1 - dpnp/dpnp_iface_nanfunctions.py | 1 - dpnp/dpnp_iface_searching.py | 1 - dpnp/dpnp_iface_sorting.py | 1 - dpnp/dpnp_iface_statistics.py | 1 - dpnp/dpnp_iface_trigonometric.py | 1 - dpnp/dpnp_iface_types.py | 1 - dpnp/dpnp_iface_utils.py | 1 - dpnp/dpnp_utils/__init__.py | 1 - dpnp/exceptions/__init__.py | 1 - dpnp/fft/__init__.py | 1 - dpnp/fft/dpnp_iface_fft.py | 1 - dpnp/linalg/__init__.py | 1 - dpnp/memory/__init__.py | 1 - dpnp/memory/_memory.py | 1 - dpnp/random/__init__.py | 1 - dpnp/random/dpnp_iface_random.py | 1 - dpnp/random/dpnp_random_state.py | 1 - dpnp/scipy/__init__.py | 1 - dpnp/scipy/linalg/__init__.py | 1 - dpnp/scipy/linalg/_decomp_lu.py | 1 - dpnp/scipy/linalg/_utils.py | 1 - dpnp/scipy/special/__init__.py | 1 - dpnp/scipy/special/_erf.py | 1 - dpnp/tests/conftest.py | 1 - dpnp/tests/test_arraymanipulation.py | 14 ++--- dpnp/tests/test_ndarray.py | 4 +- dpnp/tests/test_random.py | 2 +- dpnp/tests/testing/array.py | 1 - dpnp/tests/tests_perf/data_generator.py | 1 - dpnp/tests/tests_perf/test_perf_base.py | 1 - .../cupy/core_tests/test_include.py | 2 +- .../cupy/core_tests/test_ndarray.py | 60 +++++++++---------- .../test_ndarray_cuda_array_interface.py | 2 +- .../third_party/cupy/core_tests/test_scan.py | 2 - .../third_party/cupy/fft_tests/test_cache.py | 12 ++-- .../cupy/random_tests/common_distributions.py | 6 +- .../cupy/random_tests/test_generator.py | 6 +- .../third_party/cupy/testing/_condition.py | 4 +- dpnp/tests/third_party/cupy/testing/_loops.py | 6 +- .../cupy/testing/_parameterized.py | 2 +- dpnp/tests/third_party/numpy_ext/__init__.py | 1 - examples/example1.py | 1 - examples/example10.py | 1 - examples/example2.py | 1 - examples/example4.py | 1 - examples/example6.py | 1 - examples/example7.py | 1 - examples/example_bs.py | 1 - examples/example_cfd.py | 1 - examples/example_sum.py | 1 - scripts/build_locally.py | 1 - scripts/gen_coverage.py | 1 - 82 files changed, 63 insertions(+), 135 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6ea210b1cdeb..1e9911f27b37 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,6 +52,10 @@ repos: - id: rst-directive-colons - id: rst-inline-touching-normal - id: text-unicode-replacement-char +- repo: https://github.com/asottile/pyupgrade + rev: v3.21.1 + hooks: + - id: pyupgrade - repo: https://github.com/codespell-project/codespell rev: v2.4.1 hooks: diff --git a/benchmarks/benchmarks/__init__.py b/benchmarks/benchmarks/__init__.py index aac5f0a7bb22..75e277849b30 100644 --- a/benchmarks/benchmarks/__init__.py +++ b/benchmarks/benchmarks/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2020, Intel Corporation # All rights reserved. diff --git a/benchmarks/benchmarks/bench_elementwise.py b/benchmarks/benchmarks/bench_elementwise.py index a77cae6eff0c..10cd0aea8397 100644 --- a/benchmarks/benchmarks/bench_elementwise.py +++ b/benchmarks/benchmarks/bench_elementwise.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2020, Intel Corporation # All rights reserved. diff --git a/benchmarks/benchmarks/bench_linalg.py b/benchmarks/benchmarks/bench_linalg.py index bef07465e09c..9d8c08a5e587 100644 --- a/benchmarks/benchmarks/bench_linalg.py +++ b/benchmarks/benchmarks/bench_linalg.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2020, Intel Corporation # All rights reserved. diff --git a/benchmarks/benchmarks/bench_random.py b/benchmarks/benchmarks/bench_random.py index 7a031ccdc040..191569842371 100644 --- a/benchmarks/benchmarks/bench_random.py +++ b/benchmarks/benchmarks/bench_random.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2020, Intel Corporation # All rights reserved. diff --git a/benchmarks/benchmarks/common.py b/benchmarks/benchmarks/common.py index 346e5bf98c0c..ce0956cec5d6 100644 --- a/benchmarks/benchmarks/common.py +++ b/benchmarks/benchmarks/common.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2020, Intel Corporation # All rights reserved. diff --git a/benchmarks/pytest_benchmark/test_random.py b/benchmarks/pytest_benchmark/test_random.py index f7af64d2bda8..5c91894b2480 100644 --- a/benchmarks/pytest_benchmark/test_random.py +++ b/benchmarks/pytest_benchmark/test_random.py @@ -1,5 +1,4 @@ # cython: language_level=3 -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/doc/conf.py b/doc/conf.py index 3e7340b140a3..ddc5ab552f83 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # diff --git a/doc/docstring_template.py b/doc/docstring_template.py index 5b12465bc79f..a5bd168028ae 100644 --- a/doc/docstring_template.py +++ b/doc/docstring_template.py @@ -1,5 +1,4 @@ # cython: language_level=3 -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/__init__.py b/dpnp/__init__.py index df9cfeadbee6..e506e0fb6f61 100644 --- a/dpnp/__init__.py +++ b/dpnp/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/_version.py b/dpnp/_version.py index 8d544b299b0d..e905d59e6d13 100644 --- a/dpnp/_version.py +++ b/dpnp/_version.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2020, Intel Corporation # All rights reserved. @@ -142,7 +141,7 @@ def run_command( return None, None else: if verbose: - print("unable to find command, tried %s" % (commands,)) + print("unable to find command, tried {}".format(commands)) return None, None stdout = process.communicate()[0].strip().decode() if process.returncode != 0: @@ -190,7 +189,7 @@ def git_get_keywords(versionfile_abs: str) -> Dict[str, str]: # _version.py. keywords: Dict[str, str] = {} try: - with open(versionfile_abs, "r") as fobj: + with open(versionfile_abs) as fobj: for line in fobj: if line.strip().startswith("git_refnames ="): mo = re.search(r'=\s*"(.*)"', line) diff --git a/dpnp/config.py b/dpnp/config.py index 55529a87c407..0d973cdd298e 100644 --- a/dpnp/config.py +++ b/dpnp/config.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_algo/__init__.py b/dpnp/dpnp_algo/__init__.py index a4bafb21574a..070c28df7bc9 100644 --- a/dpnp/dpnp_algo/__init__.py +++ b/dpnp/dpnp_algo/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_algo/dpnp_arraycreation.py b/dpnp/dpnp_algo/dpnp_arraycreation.py index 00c1eaa80dd4..a76736d27bb5 100644 --- a/dpnp/dpnp_algo/dpnp_arraycreation.py +++ b/dpnp/dpnp_algo/dpnp_arraycreation.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_algo/dpnp_elementwise_common.py b/dpnp/dpnp_algo/dpnp_elementwise_common.py index 5bb5cc715d8e..e2f75a92ed24 100644 --- a/dpnp/dpnp_algo/dpnp_elementwise_common.py +++ b/dpnp/dpnp_algo/dpnp_elementwise_common.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2023, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_algo/dpnp_fill.py b/dpnp/dpnp_algo/dpnp_fill.py index 1aa58a164dad..112ea3af0fdb 100644 --- a/dpnp/dpnp_algo/dpnp_fill.py +++ b/dpnp/dpnp_algo/dpnp_fill.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_array.py b/dpnp/dpnp_array.py index 456cc84b5b26..5963b0b8ebcd 100644 --- a/dpnp/dpnp_array.py +++ b/dpnp/dpnp_array.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_array_api_info.py b/dpnp/dpnp_array_api_info.py index e7618800b234..d8cd58d9473f 100644 --- a/dpnp/dpnp_array_api_info.py +++ b/dpnp/dpnp_array_api_info.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2025, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_container.py b/dpnp/dpnp_container.py index 4152f399c69c..f019989a2ca8 100644 --- a/dpnp/dpnp_container.py +++ b/dpnp/dpnp_container.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_flatiter.py b/dpnp/dpnp_flatiter.py index 3922365e1ba9..7375e03d8020 100644 --- a/dpnp/dpnp_flatiter.py +++ b/dpnp/dpnp_flatiter.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface.py b/dpnp/dpnp_iface.py index af944bffab19..4989d1a8beca 100644 --- a/dpnp/dpnp_iface.py +++ b/dpnp/dpnp_iface.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_arraycreation.py b/dpnp/dpnp_iface_arraycreation.py index b137a136de3f..5e492ba92f50 100644 --- a/dpnp/dpnp_iface_arraycreation.py +++ b/dpnp/dpnp_iface_arraycreation.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_bitwise.py b/dpnp/dpnp_iface_bitwise.py index e823863b43c7..8d8b7e3570df 100644 --- a/dpnp/dpnp_iface_bitwise.py +++ b/dpnp/dpnp_iface_bitwise.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_counting.py b/dpnp/dpnp_iface_counting.py index 76065e0533f0..443823c3faa0 100644 --- a/dpnp/dpnp_iface_counting.py +++ b/dpnp/dpnp_iface_counting.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_histograms.py b/dpnp/dpnp_iface_histograms.py index f6e647542e26..b7e884a663c3 100644 --- a/dpnp/dpnp_iface_histograms.py +++ b/dpnp/dpnp_iface_histograms.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2024, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_indexing.py b/dpnp/dpnp_iface_indexing.py index 97f50a1c1489..13fc26ec30bc 100644 --- a/dpnp/dpnp_iface_indexing.py +++ b/dpnp/dpnp_iface_indexing.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_linearalgebra.py b/dpnp/dpnp_iface_linearalgebra.py index cbba1bb56e6e..a76f10c55884 100644 --- a/dpnp/dpnp_iface_linearalgebra.py +++ b/dpnp/dpnp_iface_linearalgebra.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_logic.py b/dpnp/dpnp_iface_logic.py index 3ee993487877..01cc1eee478f 100644 --- a/dpnp/dpnp_iface_logic.py +++ b/dpnp/dpnp_iface_logic.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_manipulation.py b/dpnp/dpnp_iface_manipulation.py index b6ffdc763075..d56c8ebbf5ec 100644 --- a/dpnp/dpnp_iface_manipulation.py +++ b/dpnp/dpnp_iface_manipulation.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_mathematical.py b/dpnp/dpnp_iface_mathematical.py index bd7e83ae3a8a..cd8a69574ae9 100644 --- a/dpnp/dpnp_iface_mathematical.py +++ b/dpnp/dpnp_iface_mathematical.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_nanfunctions.py b/dpnp/dpnp_iface_nanfunctions.py index c9a42c150d27..711baf3015e3 100644 --- a/dpnp/dpnp_iface_nanfunctions.py +++ b/dpnp/dpnp_iface_nanfunctions.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2023, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_searching.py b/dpnp/dpnp_iface_searching.py index e699ef8c034b..4447baf81a91 100644 --- a/dpnp/dpnp_iface_searching.py +++ b/dpnp/dpnp_iface_searching.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_sorting.py b/dpnp/dpnp_iface_sorting.py index 2579ec84dad2..036f96e3b53a 100644 --- a/dpnp/dpnp_iface_sorting.py +++ b/dpnp/dpnp_iface_sorting.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_statistics.py b/dpnp/dpnp_iface_statistics.py index c04b59c6bf6f..877baedfd4ea 100644 --- a/dpnp/dpnp_iface_statistics.py +++ b/dpnp/dpnp_iface_statistics.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_trigonometric.py b/dpnp/dpnp_iface_trigonometric.py index e7916f167fb7..b068cfee2314 100644 --- a/dpnp/dpnp_iface_trigonometric.py +++ b/dpnp/dpnp_iface_trigonometric.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_types.py b/dpnp/dpnp_iface_types.py index 36d1b82c0326..aa9489a00f6c 100644 --- a/dpnp/dpnp_iface_types.py +++ b/dpnp/dpnp_iface_types.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_iface_utils.py b/dpnp/dpnp_iface_utils.py index d807b81471a6..a577d44ac125 100644 --- a/dpnp/dpnp_iface_utils.py +++ b/dpnp/dpnp_iface_utils.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2024, Intel Corporation # All rights reserved. diff --git a/dpnp/dpnp_utils/__init__.py b/dpnp/dpnp_utils/__init__.py index e79d6c1671eb..bd310371c388 100644 --- a/dpnp/dpnp_utils/__init__.py +++ b/dpnp/dpnp_utils/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/exceptions/__init__.py b/dpnp/exceptions/__init__.py index dff67e64ca25..26d78a853f41 100644 --- a/dpnp/exceptions/__init__.py +++ b/dpnp/exceptions/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2025, Intel Corporation # All rights reserved. diff --git a/dpnp/fft/__init__.py b/dpnp/fft/__init__.py index 68a0803deddb..8176d353eb57 100644 --- a/dpnp/fft/__init__.py +++ b/dpnp/fft/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/fft/dpnp_iface_fft.py b/dpnp/fft/dpnp_iface_fft.py index d7b4fc10c150..46e614f6140a 100644 --- a/dpnp/fft/dpnp_iface_fft.py +++ b/dpnp/fft/dpnp_iface_fft.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/linalg/__init__.py b/dpnp/linalg/__init__.py index 5ba57900cefa..46c8740ffa3e 100644 --- a/dpnp/linalg/__init__.py +++ b/dpnp/linalg/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/memory/__init__.py b/dpnp/memory/__init__.py index 61528b886d5d..2252c3c00a2d 100644 --- a/dpnp/memory/__init__.py +++ b/dpnp/memory/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2025, Intel Corporation # All rights reserved. diff --git a/dpnp/memory/_memory.py b/dpnp/memory/_memory.py index ab66a514dbea..f978c5e50db2 100644 --- a/dpnp/memory/_memory.py +++ b/dpnp/memory/_memory.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2025, Intel Corporation # All rights reserved. diff --git a/dpnp/random/__init__.py b/dpnp/random/__init__.py index 178e5d6bd38a..976bfabacc82 100644 --- a/dpnp/random/__init__.py +++ b/dpnp/random/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/random/dpnp_iface_random.py b/dpnp/random/dpnp_iface_random.py index 40d5daa51e3f..564a0cad9e60 100644 --- a/dpnp/random/dpnp_iface_random.py +++ b/dpnp/random/dpnp_iface_random.py @@ -1,5 +1,4 @@ # cython: language_level=3 -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/random/dpnp_random_state.py b/dpnp/random/dpnp_random_state.py index f3c22104251b..52a866f08f0b 100644 --- a/dpnp/random/dpnp_random_state.py +++ b/dpnp/random/dpnp_random_state.py @@ -1,5 +1,4 @@ # cython: language_level=3 -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/scipy/__init__.py b/dpnp/scipy/__init__.py index bdca0614dd9c..56cf27f56342 100644 --- a/dpnp/scipy/__init__.py +++ b/dpnp/scipy/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2025, Intel Corporation # All rights reserved. diff --git a/dpnp/scipy/linalg/__init__.py b/dpnp/scipy/linalg/__init__.py index d75856bc9fb2..a97f2cfb829c 100644 --- a/dpnp/scipy/linalg/__init__.py +++ b/dpnp/scipy/linalg/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2025, Intel Corporation # All rights reserved. diff --git a/dpnp/scipy/linalg/_decomp_lu.py b/dpnp/scipy/linalg/_decomp_lu.py index 772c24b299d6..b74781827315 100644 --- a/dpnp/scipy/linalg/_decomp_lu.py +++ b/dpnp/scipy/linalg/_decomp_lu.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2025, Intel Corporation # All rights reserved. diff --git a/dpnp/scipy/linalg/_utils.py b/dpnp/scipy/linalg/_utils.py index eab46b8e92dc..274a3593f2cf 100644 --- a/dpnp/scipy/linalg/_utils.py +++ b/dpnp/scipy/linalg/_utils.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2025, Intel Corporation # All rights reserved. diff --git a/dpnp/scipy/special/__init__.py b/dpnp/scipy/special/__init__.py index ef8ccfe07c25..b4ffff1ab87d 100644 --- a/dpnp/scipy/special/__init__.py +++ b/dpnp/scipy/special/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2025, Intel Corporation # All rights reserved. diff --git a/dpnp/scipy/special/_erf.py b/dpnp/scipy/special/_erf.py index fef621c9ea4a..ea960916e744 100644 --- a/dpnp/scipy/special/_erf.py +++ b/dpnp/scipy/special/_erf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2025, Intel Corporation # All rights reserved. diff --git a/dpnp/tests/conftest.py b/dpnp/tests/conftest.py index 67c9bb833f81..bd6c71f9a92b 100644 --- a/dpnp/tests/conftest.py +++ b/dpnp/tests/conftest.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/tests/test_arraymanipulation.py b/dpnp/tests/test_arraymanipulation.py index da058ffb938d..0ea0498b5be8 100644 --- a/dpnp/tests/test_arraymanipulation.py +++ b/dpnp/tests/test_arraymanipulation.py @@ -294,7 +294,7 @@ def test_broadcast_arrays_empty_input(self): assert dpnp.broadcast_arrays() == [] def test_subok_error(self): - x = dpnp.ones((4)) + x = dpnp.ones(4) with pytest.raises(NotImplementedError): dpnp.broadcast_arrays(x, subok=True) @@ -327,7 +327,7 @@ def test_1d_2d_arrays(self, data1, data2, dtype): def test_generator(self): with pytest.raises(TypeError, match="arrays to stack must be"): - dpnp.column_stack((dpnp.arange(3) for _ in range(2))) + dpnp.column_stack(dpnp.arange(3) for _ in range(2)) with pytest.raises(TypeError, match="arrays to stack must be"): dpnp.column_stack(map(lambda x: x, dpnp.ones((3, 2)))) @@ -680,7 +680,7 @@ def test_arrays(self, data1, data2, dtype): def test_generator(self): with pytest.raises(TypeError, match="arrays to stack must be"): - dpnp.dstack((dpnp.arange(3) for _ in range(2))) + dpnp.dstack(dpnp.arange(3) for _ in range(2)) with pytest.raises(TypeError, match="arrays to stack must be"): dpnp.dstack(map(lambda x: x, dpnp.ones((3, 2)))) @@ -715,7 +715,7 @@ def test_2D_array(self): def test_generator(self): with pytest.raises(TypeError, match="arrays to stack must be"): - dpnp.hstack((dpnp.arange(3) for _ in range(2))) + dpnp.hstack(dpnp.arange(3) for _ in range(2)) with pytest.raises(TypeError, match="arrays to stack must be"): dpnp.hstack(map(lambda x: x, dpnp.ones((3, 2)))) @@ -979,7 +979,7 @@ def test_invalid_shapes_input(self, sh1, sh2, dtype): def test_generator_input(self): with pytest.raises(TypeError): - dpnp.stack((x for x in range(3))) + dpnp.stack(x for x in range(3)) @pytest.mark.usefixtures("suppress_complex_warning") @pytest.mark.parametrize("arr_dtype", get_all_dtypes()) @@ -1029,7 +1029,7 @@ def test_stack_out_dtype(self): def test_generator(self): with pytest.raises(TypeError, match="arrays to stack must be"): - dpnp.stack((dpnp.arange(3) for _ in range(2))) + dpnp.stack(dpnp.arange(3) for _ in range(2)) with pytest.raises(TypeError, match="arrays to stack must be"): dpnp.stack(map(lambda x: x, dpnp.ones((3, 2)))) @@ -1150,7 +1150,7 @@ def test_2D_array2(self): def test_generator(self): with pytest.raises(TypeError, match="arrays to stack must be"): - dpnp.vstack((dpnp.arange(3) for _ in range(2))) + dpnp.vstack(dpnp.arange(3) for _ in range(2)) with pytest.raises(TypeError, match="arrays to stack must be"): dpnp.vstack(map(lambda x: x, dpnp.ones((3, 2)))) diff --git a/dpnp/tests/test_ndarray.py b/dpnp/tests/test_ndarray.py index 2aa6c0f49acc..6fe5638d7857 100644 --- a/dpnp/tests/test_ndarray.py +++ b/dpnp/tests/test_ndarray.py @@ -149,7 +149,7 @@ def test_sep(self, tmp_filename): a.tofile(f, sep=",") # reconstruct the array - with open(tmp_filename, "r") as f: + with open(tmp_filename) as f: s = f.read() b = dpnp.array([float(p) for p in s.split(",")], dtype=a.dtype) assert_array_equal(a, b.asnumpy()) @@ -161,7 +161,7 @@ def test_format(self, tmp_filename): a.tofile(f, sep=",", format="%.2f") # reconstruct the array as a string - with open(tmp_filename, "r") as f: + with open(tmp_filename) as f: s = f.read() assert_equal(s, "1.51,2.00,3.51,4.00") diff --git a/dpnp/tests/test_random.py b/dpnp/tests/test_random.py index 7524d124acd2..656ffe67e2fe 100644 --- a/dpnp/tests/test_random.py +++ b/dpnp/tests/test_random.py @@ -252,7 +252,7 @@ def test_moments(self): 2 * (dfden**2) * (dfnum + dfden - 2) - / (dfnum * ((dfden - 2) ** 2) * ((dfden - 4))) + / (dfnum * ((dfden - 2) ** 2) * (dfden - 4)) ) self.check_moments( "f", expected_mean, expected_var, {"dfnum": dfnum, "dfden": dfden} diff --git a/dpnp/tests/testing/array.py b/dpnp/tests/testing/array.py index e750267585d2..d309cdd8725b 100644 --- a/dpnp/tests/testing/array.py +++ b/dpnp/tests/testing/array.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/tests/tests_perf/data_generator.py b/dpnp/tests/tests_perf/data_generator.py index a5eee4c9f82b..f99c9b681314 100755 --- a/dpnp/tests/tests_perf/data_generator.py +++ b/dpnp/tests/tests_perf/data_generator.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/tests/tests_perf/test_perf_base.py b/dpnp/tests/tests_perf/test_perf_base.py index fa4fb49e5105..30597e495dbd 100755 --- a/dpnp/tests/tests_perf/test_perf_base.py +++ b/dpnp/tests/tests_perf/test_perf_base.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/dpnp/tests/third_party/cupy/core_tests/test_include.py b/dpnp/tests/third_party/cupy/core_tests/test_include.py index aca13ff8f667..9c6372cf2bcd 100644 --- a/dpnp/tests/third_party/cupy/core_tests/test_include.py +++ b/dpnp/tests/third_party/cupy/core_tests/test_include.py @@ -43,7 +43,7 @@ class TestIncludesCompileCUDA: def _get_cuda_archs(self): cuda_ver = cupy.cuda.runtime.runtimeGetVersion() - to_exclude = set((int(a) for a in cupy.cuda.compiler._tegra_archs)) + to_exclude = {int(a) for a in cupy.cuda.compiler._tegra_archs} if cuda_ver < 11000: # CUDA 10.2 (Tegra excluded) archs = (30, 35, 50, 52, 60, 61, 70, 75) diff --git a/dpnp/tests/third_party/cupy/core_tests/test_ndarray.py b/dpnp/tests/third_party/cupy/core_tests/test_ndarray.py index 3c7c2c9ed77c..c7afd483e596 100644 --- a/dpnp/tests/third_party/cupy/core_tests/test_ndarray.py +++ b/dpnp/tests/third_party/cupy/core_tests/test_ndarray.py @@ -310,17 +310,15 @@ def test_cuda_array_interface(self): arr = cupy.zeros(shape=(2, 3), dtype=cupy.float64) iface = arr.__cuda_array_interface__ assert iface["version"] == 3 - assert set(iface.keys()) == set( - [ - "shape", - "typestr", - "data", - "version", - "descr", - "stream", - "strides", - ] - ) + assert set(iface.keys()) == { + "shape", + "typestr", + "data", + "version", + "descr", + "stream", + "strides", + } assert iface["shape"] == (2, 3) assert iface["typestr"] == " numpy): %f""" % ( +p: {:f} +D+ (cupy < numpy): {:f} +D- (cupy > numpy): {:f}""".format( p_value, d_plus, d_minus, diff --git a/dpnp/tests/third_party/cupy/random_tests/test_generator.py b/dpnp/tests/third_party/cupy/random_tests/test_generator.py index 2aa5aba73b4a..9d1a3d233473 100644 --- a/dpnp/tests/third_party/cupy/random_tests/test_generator.py +++ b/dpnp/tests/third_party/cupy/random_tests/test_generator.py @@ -51,9 +51,9 @@ def test_func(self, *args, **kw): ) if p_value < significance_level: message = """Rejected null hypothesis: -p: %f -D+ (cupy < numpy): %f -D- (cupy > numpy): %f""" % ( +p: {:f} +D+ (cupy < numpy): {:f} +D- (cupy > numpy): {:f}""".format( p_value, d_plus, d_minus, diff --git a/dpnp/tests/third_party/cupy/testing/_condition.py b/dpnp/tests/third_party/cupy/testing/_condition.py index 903a3c07be55..890783a75354 100644 --- a/dpnp/tests/third_party/cupy/testing/_condition.py +++ b/dpnp/tests/third_party/cupy/testing/_condition.py @@ -3,7 +3,7 @@ import unittest -class QuietTestRunner(object): +class QuietTestRunner: def run(self, suite): result = unittest.TestResult() suite(result) @@ -38,7 +38,7 @@ def wrapper(*args, **kwargs): results = [] def fail(): - msg = "\nFail: {0}, Success: {1}".format( + msg = "\nFail: {}, Success: {}".format( failure_counter, success_counter ) if len(results) > 0: diff --git a/dpnp/tests/third_party/cupy/testing/_loops.py b/dpnp/tests/third_party/cupy/testing/_loops.py index 4e459ac4a02f..6a383780b9ca 100644 --- a/dpnp/tests/third_party/cupy/testing/_loops.py +++ b/dpnp/tests/third_party/cupy/testing/_loops.py @@ -265,7 +265,7 @@ def isdtype(v): else: return False - vs = set(v for v in kw.values() if isdtype(v)) + vs = {v for v in kw.values() if isdtype(v)} return any(d in vs for d in _unsigned_dtypes) and any( d in vs for d in _float_dtypes + _signed_dtypes ) @@ -914,8 +914,8 @@ def test_func(*args, **kw): if cupy_result != numpy_result: message = """Results are not equal: -cupy: %s -numpy: %s""" % ( +cupy: {} +numpy: {}""".format( str(cupy_result), str(numpy_result), ) diff --git a/dpnp/tests/third_party/cupy/testing/_parameterized.py b/dpnp/tests/third_party/cupy/testing/_parameterized.py index 7bf81353f3c0..30b9ebe65da9 100644 --- a/dpnp/tests/third_party/cupy/testing/_parameterized.py +++ b/dpnp/tests/third_party/cupy/testing/_parameterized.py @@ -52,7 +52,7 @@ def _parameterize_test_case(base, i, param): def __repr__(self): name = base.__repr__(self) - return "<%s parameter: %s>" % (name, param) + return "<{} parameter: {}>".format(name, param) mb = {"__repr__": __repr__} for k, v in sorted(param.items()): diff --git a/dpnp/tests/third_party/numpy_ext/__init__.py b/dpnp/tests/third_party/numpy_ext/__init__.py index 0033262a4fe6..382f3402676a 100644 --- a/dpnp/tests/third_party/numpy_ext/__init__.py +++ b/dpnp/tests/third_party/numpy_ext/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/examples/example1.py b/examples/example1.py index ba5e1c05ab96..fdcbfbac9249 100644 --- a/examples/example1.py +++ b/examples/example1.py @@ -1,5 +1,4 @@ # cython: language_level=3 -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/examples/example10.py b/examples/example10.py index b8acc58dd62b..efc9e44303ae 100644 --- a/examples/example10.py +++ b/examples/example10.py @@ -1,5 +1,4 @@ # cython: language_level=3 -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/examples/example2.py b/examples/example2.py index b0197919fc9f..853f879a7f11 100644 --- a/examples/example2.py +++ b/examples/example2.py @@ -1,5 +1,4 @@ # cython: language_level=3 -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/examples/example4.py b/examples/example4.py index 22d8e67d660d..0149c22f7ced 100644 --- a/examples/example4.py +++ b/examples/example4.py @@ -1,5 +1,4 @@ # cython: language_level=3 -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/examples/example6.py b/examples/example6.py index 22e52fefac11..89d469937054 100644 --- a/examples/example6.py +++ b/examples/example6.py @@ -1,5 +1,4 @@ # cython: language_level=3 -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/examples/example7.py b/examples/example7.py index 68336dddee90..2b418e0082ca 100644 --- a/examples/example7.py +++ b/examples/example7.py @@ -1,5 +1,4 @@ # cython: language_level=3 -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/examples/example_bs.py b/examples/example_bs.py index 7f379d5b4ec4..2901fb3c4dba 100644 --- a/examples/example_bs.py +++ b/examples/example_bs.py @@ -1,5 +1,4 @@ # cython: language_level=3 -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/examples/example_cfd.py b/examples/example_cfd.py index d2ce2569a90e..0d7d2920f2fe 100644 --- a/examples/example_cfd.py +++ b/examples/example_cfd.py @@ -1,5 +1,4 @@ # cython: language_level=3 -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2023, Intel Corporation # All rights reserved. diff --git a/examples/example_sum.py b/examples/example_sum.py index bb230da0181a..a14a3c2e1f8d 100644 --- a/examples/example_sum.py +++ b/examples/example_sum.py @@ -1,5 +1,4 @@ # cython: language_level=3 -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2023, Intel Corporation # All rights reserved. diff --git a/scripts/build_locally.py b/scripts/build_locally.py index ebd148c2d897..1197de9d9455 100644 --- a/scripts/build_locally.py +++ b/scripts/build_locally.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2016, Intel Corporation # All rights reserved. diff --git a/scripts/gen_coverage.py b/scripts/gen_coverage.py index b49cf4cc9032..a624bd570e2d 100644 --- a/scripts/gen_coverage.py +++ b/scripts/gen_coverage.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2023, Intel Corporation # All rights reserved. From 09633d10b722a7ee47fccc9982e407a5b4832e16 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 10 Nov 2025 12:02:45 +0100 Subject: [PATCH 2/4] Add actionlint as a static checker for GitHub Actions workflow files --- .github/workflows/build-sphinx.yml | 13 ++++++----- .github/workflows/conda-package.yml | 28 ++++++++++++++---------- .github/workflows/generate_coverage.yaml | 2 +- .pre-commit-config.yaml | 4 ++++ 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build-sphinx.yml b/.github/workflows/build-sphinx.yml index a9ca25f426fe..b35cf81784a4 100644 --- a/.github/workflows/build-sphinx.yml +++ b/.github/workflows/build-sphinx.yml @@ -66,7 +66,7 @@ jobs: if: env.oneapi-pkgs-env == '' run: | wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB - cat GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null + < GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list sudo apt update @@ -177,10 +177,11 @@ jobs: - name: Set a project number to current release run: | - export PROJECT_NUMBER=$(git describe --tags --abbrev=0) + PROJECT_NUMBER=$(git describe --tags --abbrev=0) + export PROJECT_NUMBER - echo PROJECT_NUMBER=${PROJECT_NUMBER} - echo "PROJECT_NUMBER=$PROJECT_NUMBER" >> $GITHUB_ENV + echo "PROJECT_NUMBER=${PROJECT_NUMBER}" + echo "PROJECT_NUMBER=$PROJECT_NUMBER" >> "$GITHUB_ENV" - name: Build backend docs uses: mattnotmitt/doxygen-action@b84fe17600245bb5db3d6c247cc274ea98c15a3b # v1.12 @@ -259,8 +260,8 @@ jobs: git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpnp.git git fetch tokened_docs git checkout --track tokened_docs/gh-pages - echo `pwd` - [ -d pull/${PR_NUM} ] && git rm -rf pull/${PR_NUM} + pwd + [ -d pull/"${PR_NUM}" ] && git rm -rf pull/"${PR_NUM}" git config --global user.name ${{ env.GH_BOT_NAME }} git config --global user.email ${{ env.GH_BOT_EMAIL }} git commit -m "Removing docs for closed pull request ${PR_NUM}" diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index 8c6deeb9735f..30266a4ddf5f 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -85,8 +85,8 @@ jobs: - name: Store conda paths as envs shell: bash -el {0} run: | - echo "CONDA_BLD=$CONDA_PREFIX/conda-bld/${{ runner.os == 'Linux' && 'linux' || 'win' }}-64/" | tr "\\\\" '/' >> $GITHUB_ENV - echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE${{ runner.os == 'Linux' && '/' || '\\' }}" >> $GITHUB_ENV + echo "CONDA_BLD=$CONDA_PREFIX/conda-bld/${{ runner.os == 'Linux' && 'linux' || 'win' }}-64/" | tr "\\\\" '/' >> "$GITHUB_ENV" + echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE${{ runner.os == 'Linux' && '/' || '\\' }}" >> "$GITHUB_ENV" - name: Build conda package id: build_conda_pkg @@ -188,10 +188,11 @@ jobs: - name: Get package version run: | - export PACKAGE_VERSION=$(python -c "${{ env.ver-script-part1 }} ${{ env.ver-script-part2 }}") + PACKAGE_VERSION=$(python -c "${{ env.ver-script-part1 }} ${{ env.ver-script-part2 }}") + export PACKAGE_VERSION - echo PACKAGE_VERSION=${PACKAGE_VERSION} - echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV + echo "PACKAGE_VERSION=${PACKAGE_VERSION}" + echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_ENV" - name: Install dpnp id: install_dpnp @@ -468,7 +469,7 @@ jobs: - name: Package version shell: bash -el {0} run: | - echo "PACKAGE_VERSION=$(basename ${{ env.package-name }}-*.conda | sed 's/^${{ env.package-name }}-\([^-]*\).*/\1/')" >> $GITHUB_ENV + echo "PACKAGE_VERSION=$(basename ${{ env.package-name }}-*.conda | sed 's/^${{ env.package-name }}-\([^-]*\).*/\1/')" >> "$GITHUB_ENV" - name: Upload run: | @@ -561,10 +562,11 @@ jobs: - name: Get package version run: | - export PACKAGE_VERSION=$(python -c "${{ env.ver-script-part1 }} ${{ env.ver-script-part2 }}") + PACKAGE_VERSION=$(python -c "${{ env.ver-script-part1 }} ${{ env.ver-script-part2 }}") + export PACKAGE_VERSION - echo PACKAGE_VERSION=${PACKAGE_VERSION} - echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV + echo "PACKAGE_VERSION=${PACKAGE_VERSION}" + echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_ENV" - name: Install dpnp id: install_dpnp @@ -634,9 +636,11 @@ jobs: Passed: $PASSED_TESTS Failed: $FAILED_TESTS Skipped: $SKIPPED_TESTS" - echo "MESSAGE<> $GITHUB_ENV - echo "$MESSAGE" >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV + { + echo "MESSAGE<> "$GITHUB_ENV" else echo "Array API standard conformance tests failed to run for dpnp=$PACKAGE_VERSION." exit 1 diff --git a/.github/workflows/generate_coverage.yaml b/.github/workflows/generate_coverage.yaml index 5697c423589a..aa5927aa71a2 100644 --- a/.github/workflows/generate_coverage.yaml +++ b/.github/workflows/generate_coverage.yaml @@ -41,7 +41,7 @@ jobs: if: env.oneapi-pkgs-env == '' run: | wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB - cat GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null + < GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list sudo apt update diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1e9911f27b37..4ed2307610ab 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -123,3 +123,7 @@ repos: hooks: - id: pretty-format-toml args: [--autofix] +- repo: https://github.com/rhysd/actionlint + rev: v1.7.8 + hooks: + - id: actionlint From d574ea334593cff941b7fb49a9f7e50336b998c1 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 10 Nov 2025 12:38:56 +0100 Subject: [PATCH 3/4] Add gersemi as a formatter for CMake files --- .../workflows/Windows-IntelLLVM_3.22.cmake | 28 ++-- .../workflows/Windows-IntelLLVM_3.26.cmake | 86 +++++++------ .pre-commit-config.yaml | 6 + CMakeLists.txt | 121 +++++++++--------- dpnp/CMakeLists.txt | 92 ++++++------- dpnp/backend/CMakeLists.txt | 60 ++++----- dpnp/backend/extensions/blas/CMakeLists.txt | 65 ++++++---- dpnp/backend/extensions/fft/CMakeLists.txt | 69 +++++----- .../extensions/indexing/CMakeLists.txt | 65 ++++++---- dpnp/backend/extensions/lapack/CMakeLists.txt | 65 ++++++---- .../extensions/statistics/CMakeLists.txt | 70 +++++----- dpnp/backend/extensions/ufunc/CMakeLists.txt | 72 ++++++----- dpnp/backend/extensions/vm/CMakeLists.txt | 57 ++++++--- dpnp/backend/extensions/window/CMakeLists.txt | 65 ++++++---- dpnp/backend/tests/CMakeLists.txt | 13 +- dpnp/cmake/copy_existing.cmake | 4 +- dpnp/dpnp_algo/CMakeLists.txt | 10 +- dpnp/dpnp_utils/CMakeLists.txt | 2 +- dpnp/random/CMakeLists.txt | 2 +- 19 files changed, 529 insertions(+), 423 deletions(-) diff --git a/.github/workflows/Windows-IntelLLVM_3.22.cmake b/.github/workflows/Windows-IntelLLVM_3.22.cmake index 603fe243b520..0f981fc513d7 100644 --- a/.github/workflows/Windows-IntelLLVM_3.22.cmake +++ b/.github/workflows/Windows-IntelLLVM_3.22.cmake @@ -1,24 +1,28 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. - # This module is shared by multiple languages; use include blocker. if(__WINDOWS_INTEL) - return() + return() endif() set(__WINDOWS_INTEL 1) include(Platform/Windows-MSVC) macro(__windows_compiler_intel lang) - __windows_compiler_msvc(${lang}) - - set(CMAKE_${lang}_LINK_EXECUTABLE " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} -link -out: -implib: -pdb: -version:.${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") - set(CMAKE_${lang}_CREATE_SHARED_LIBRARY " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} -LD -link -out: -implib: -pdb: -version:.${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") - set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) - if (NOT "${lang}" STREQUAL "Fortran") # Fortran driver does not support -fuse-ld, yet - set(CMAKE_${lang}_CREATE_STATIC_LIBRARY " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} -fuse-ld=llvm-lib -o -link ${CMAKE_END_TEMP_FILE}") - endif() - set(CMAKE_DEPFILE_FLAGS_${lang} "-QMMD -QMT -QMF ") - set(CMAKE_${lang}_DEPFILE_FORMAT gcc) + __windows_compiler_msvc(${lang}) + set(CMAKE_${lang}_LINK_EXECUTABLE + " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} -link -out: -implib: -pdb: -version:.${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}" + ) + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} -LD -link -out: -implib: -pdb: -version:.${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}" + ) + set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) + if(NOT "${lang}" STREQUAL "Fortran") # Fortran driver does not support -fuse-ld, yet + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY + " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} -fuse-ld=llvm-lib -o -link ${CMAKE_END_TEMP_FILE}" + ) + endif() + set(CMAKE_DEPFILE_FLAGS_${lang} "-QMMD -QMT -QMF ") + set(CMAKE_${lang}_DEPFILE_FORMAT gcc) endmacro() diff --git a/.github/workflows/Windows-IntelLLVM_3.26.cmake b/.github/workflows/Windows-IntelLLVM_3.26.cmake index eac3f0a9a827..7f30420dc83e 100644 --- a/.github/workflows/Windows-IntelLLVM_3.26.cmake +++ b/.github/workflows/Windows-IntelLLVM_3.26.cmake @@ -1,10 +1,9 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. - # This module is shared by multiple languages; use include blocker. if(__WINDOWS_INTEL_LLVM) - return() + return() endif() set(__WINDOWS_INTEL_LLVM 1) @@ -15,52 +14,65 @@ set(__WINDOWS_INTEL_LLVM 1) # Save original CMAKE_${t}_LINKER_FLAGS_INIT foreach(t EXE SHARED MODULE STATIC) - set(_saved_cmake_${t}_linker_flags_init ${CMAKE_${t}_LINKER_FLAGS_INIT}) - set(CMAKE_${t}_LINKER_FLAGS_INIT "") + set(_saved_cmake_${t}_linker_flags_init ${CMAKE_${t}_LINKER_FLAGS_INIT}) + set(CMAKE_${t}_LINKER_FLAGS_INIT "") endforeach() include(Platform/Windows-MSVC) # Wrap linker flags from Windows-MSVC set(_IntelLLVM_LINKER_WRAPPER_FLAG "/Qoption,link,") set(_IntelLLVM_LINKER_WRAPPER_FLAG_SEP ",") foreach(t EXE SHARED MODULE STATIC) - set(_wrapped_linker_flags "") - foreach(flag ${CMAKE_${t}_LINKER_FLAGS_INIT}) - string(STRIP ${flag} flag) - list(APPEND _wrapped_linker_flags "${_IntelLLVM_LINKER_WRAPPER_FLAG}${flag}") - endforeach() - set(CMAKE_${t}_LINKER_FLAGS_INIT "") - list(APPEND CMAKE_${t}_LINKER_FLAGS_INIT - ${_saved_cmake_${t}_linker_flags_init} ${_wrapped_linker_flags}) + set(_wrapped_linker_flags "") + foreach(flag ${CMAKE_${t}_LINKER_FLAGS_INIT}) + string(STRIP ${flag} flag) + list(APPEND _wrapped_linker_flags "${_IntelLLVM_LINKER_WRAPPER_FLAG}${flag}") + endforeach() + set(CMAKE_${t}_LINKER_FLAGS_INIT "") + list( + APPEND CMAKE_${t}_LINKER_FLAGS_INIT + ${_saved_cmake_${t}_linker_flags_init} + ${_wrapped_linker_flags} + ) endforeach() macro(__windows_compiler_intel lang) - __windows_compiler_msvc(${lang}) + __windows_compiler_msvc(${lang}) - set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "${_IntelLLVM_LINKER_WRAPPER_FLAG}") - set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP "${_IntelLLVM_LINKER_WRAPPER_FLAG_SEP}") - set(CMAKE_${lang}_CREATE_WIN32_EXE "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/subsystem:windows") - set(CMAKE_${lang}_CREATE_CONSOLE_EXE "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/subsystem:console") - set(CMAKE_LINK_DEF_FILE_FLAG "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/DEF:") - set(CMAKE_LIBRARY_PATH_FLAG "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/LIBPATH:") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "${_IntelLLVM_LINKER_WRAPPER_FLAG}") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP "${_IntelLLVM_LINKER_WRAPPER_FLAG_SEP}") + set(CMAKE_${lang}_CREATE_WIN32_EXE + "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/subsystem:windows" + ) + set(CMAKE_${lang}_CREATE_CONSOLE_EXE + "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/subsystem:console" + ) + set(CMAKE_LINK_DEF_FILE_FLAG "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/DEF:") + set(CMAKE_LIBRARY_PATH_FLAG "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/LIBPATH:") - # Features for LINK_LIBRARY generator expression - if(MSVC_VERSION GREATER "1900") - ## WHOLE_ARCHIVE: Force loading all members of an archive - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:/WHOLEARCHIVE:") - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) - endif() + # Features for LINK_LIBRARY generator expression + if(MSVC_VERSION GREATER "1900") + ## WHOLE_ARCHIVE: Force loading all members of an archive + set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:/WHOLEARCHIVE:") + set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) + endif() - set(CMAKE_${lang}_LINK_EXECUTABLE - "${_CMAKE_VS_LINK_EXE} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /link /out: /implib: /pdb: /version:.${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") - set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - "${_CMAKE_VS_LINK_DLL} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} -LD -link /out: /implib: /pdb: /version:.${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") - set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) - if (NOT "${lang}" STREQUAL "Fortran" OR CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 2022.1) - # The Fortran driver does not support -fuse-ld=llvm-lib before compiler version 2022.1 - set(CMAKE_${lang}_CREATE_STATIC_LIBRARY - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} -fuse-ld=llvm-lib -o ${CMAKE_END_TEMP_FILE}") - endif() + set(CMAKE_${lang}_LINK_EXECUTABLE + "${_CMAKE_VS_LINK_EXE} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /link /out: /implib: /pdb: /version:.${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}" + ) + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "${_CMAKE_VS_LINK_DLL} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} -LD -link /out: /implib: /pdb: /version:.${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}" + ) + set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) + if( + NOT "${lang}" STREQUAL "Fortran" + OR CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 2022.1 + ) + # The Fortran driver does not support -fuse-ld=llvm-lib before compiler version 2022.1 + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY + " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} -fuse-ld=llvm-lib -o ${CMAKE_END_TEMP_FILE}" + ) + endif() - set(CMAKE_DEPFILE_FLAGS_${lang} "-QMD -QMT -QMF ") - set(CMAKE_${lang}_DEPFILE_FORMAT gcc) + set(CMAKE_DEPFILE_FLAGS_${lang} "-QMD -QMT -QMF ") + set(CMAKE_${lang}_DEPFILE_FORMAT gcc) endmacro() diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4ed2307610ab..2c7b88c40db2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -127,3 +127,9 @@ repos: rev: v1.7.8 hooks: - id: actionlint +- repo: https://github.com/BlankSpruce/gersemi + rev: 0.23.1 + hooks: + - id: gersemi + exclude: "dpnp/backend/cmake/Modules/" + args: ["-i", "-l", "88", "--no-warn-about-unknown-commands"] diff --git a/CMakeLists.txt b/CMakeLists.txt index 091e6f2b3ecf..bab387bd6e5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,22 +29,26 @@ cmake_minimum_required(VERSION 3.21...3.27 FATAL_ERROR) -project(dpnp - VERSION 0.20 - LANGUAGES CXX - DESCRIPTION "NumPy-like API accelerated by SYCL." +project( + dpnp + VERSION 0.20 + LANGUAGES CXX + DESCRIPTION "NumPy-like API accelerated by SYCL." ) option(DPNP_GENERATE_COVERAGE "Enable build DPNP with coverage instrumentation" OFF) option(DPNP_BACKEND_TESTS "Enable building of DPNP backend test suite" OFF) -option(DPNP_WITH_REDIST "Build DPNP assuming DPC++ redistributable is installed into Python prefix" OFF) +option( + DPNP_WITH_REDIST + "Build DPNP assuming DPC++ redistributable is installed into Python prefix" + OFF +) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) - # find_package() search order in CONFIG mode: # 1. _ROOT variables (CMake variable / environment) # 2. CMake-specific cache variables (on the command line with -D_DIR=...) @@ -63,11 +67,12 @@ set(MKL_ARCH "intel64") set(MKL_LINK "dynamic") set(MKL_THREADING "tbb_thread") set(MKL_INTERFACE "ilp64") -find_package(MKL REQUIRED - HINTS ${MKL_ROOT}/lib/cmake - ${MKL_ROOT}/lib/cmake/mkl - $ENV{MKLROOT} - PATHS ${path_to_cmake_dir}) +find_package( + MKL + REQUIRED + HINTS ${MKL_ROOT}/lib/cmake ${MKL_ROOT}/lib/cmake/mkl $ENV{MKLROOT} + PATHS ${path_to_cmake_dir} +) set(ONEDPL_PAR_BACKEND tbb) find_package(oneDPL REQUIRED PATHS ${path_to_cmake_dir}) @@ -94,10 +99,7 @@ find_package(Dpctl REQUIRED) message(STATUS "Dpctl_INCLUDE_DIR=" ${Dpctl_INCLUDE_DIR}) message(STATUS "Dpctl_TENSOR_INCLUDE_DIR=" ${Dpctl_TENSOR_INCLUDE_DIR}) -option(DPNP_USE_ONEMATH - "Build DPNP with oneMath" - OFF -) +option(DPNP_USE_ONEMATH "Build DPNP with oneMath" OFF) set(DPNP_TARGET_CUDA "" CACHE STRING @@ -115,15 +117,16 @@ set(_use_onemath_hip OFF) set(_dpnp_sycl_target_compile_options) set(_dpnp_sycl_target_link_options) -if ("x${DPNP_SYCL_TARGETS}" STREQUAL "x") - if (DPNP_TARGET_CUDA) +if("x${DPNP_SYCL_TARGETS}" STREQUAL "x") + if(DPNP_TARGET_CUDA) set(_dpnp_cuda_arch) if(DPNP_TARGET_CUDA MATCHES "^sm_") set(_dpnp_cuda_arch ${DPNP_TARGET_CUDA}) elseif(DPNP_TARGET_CUDA MATCHES "^(ON|TRUE|YES|Y|1)$") set(_dpnp_cuda_arch "sm_50") else() - message(FATAL_ERROR + message( + FATAL_ERROR "Invalid value for DPNP_TARGET_CUDA: \"${DPNP_TARGET_CUDA}\". " "Expected 'ON', 'TRUE', 'YES', 'Y', '1', or a CUDA architecture like 'sm_80'." ) @@ -132,16 +135,17 @@ if ("x${DPNP_SYCL_TARGETS}" STREQUAL "x") set(_use_onemath_cuda ON) endif() - if (HIP_TARGETS) - if (HIP_TARGETS MATCHES "^gfx") - if ("x${_dpnp_sycl_targets}" STREQUAL "x") + if(HIP_TARGETS) + if(HIP_TARGETS MATCHES "^gfx") + if("x${_dpnp_sycl_targets}" STREQUAL "x") set(_dpnp_sycl_targets "amd_gpu_${HIP_TARGETS},spir64-unknown-unknown") else() set(_dpnp_sycl_targets "amd_gpu_${HIP_TARGETS},${_dpnp_sycl_targets}") endif() set(_use_onemath_hip ON) else() - message(FATAL_ERROR + message( + FATAL_ERROR "Invalid value for HIP_TARGETS: \"${HIP_TARGETS}\". " "Expected an architecture name starting with 'gfx', e.g. 'gfx1030'." ) @@ -154,26 +158,27 @@ else() set(_use_onemath_cuda ON) endif() - if ("${DPNP_SYCL_TARGETS}" MATCHES "amd_gpu_") + if("${DPNP_SYCL_TARGETS}" MATCHES "amd_gpu_") set(_use_onemath_hip ON) - if ("x${HIP_TARGETS}" STREQUAL "x") + if("x${HIP_TARGETS}" STREQUAL "x") message(FATAL_ERROR "HIP_TARGETS must be specified when using HIP backend") endif() endif() - if ("${DPNP_SYCL_TARGETS}" MATCHES "amdgcn-amd-amdhsa") - message(FATAL_ERROR + if("${DPNP_SYCL_TARGETS}" MATCHES "amdgcn-amd-amdhsa") + message( + FATAL_ERROR "Legacy target 'amdgcn-amd-amdhsa' is not supported. " "Use alias form 'amd_gpu_' instead" ) endif() endif() -if (_dpnp_sycl_targets) - message(STATUS "Compiling for -fsycl-targets=${_dpnp_sycl_targets}") - list(APPEND _dpnp_sycl_target_compile_options -fsycl-targets=${_dpnp_sycl_targets}) - list(APPEND _dpnp_sycl_target_link_options -fsycl-targets=${_dpnp_sycl_targets}) +if(_dpnp_sycl_targets) + message(STATUS "Compiling for -fsycl-targets=${_dpnp_sycl_targets}") + list(APPEND _dpnp_sycl_target_compile_options -fsycl-targets=${_dpnp_sycl_targets}) + list(APPEND _dpnp_sycl_target_link_options -fsycl-targets=${_dpnp_sycl_targets}) endif() if(DPNP_USE_ONEMATH) @@ -208,8 +213,9 @@ if(_use_onemath) else() FetchContent_Declare( onemath_library - GIT_REPOSITORY https://github.com/uxlfoundation/oneMath.git - GIT_TAG 5c7e1e7a710556e51f70ecc8dd26dfd04e3abf41 # v0.8 + GIT_REPOSITORY https://github.com/uxlfoundation/oneMath.git + GIT_TAG + 5c7e1e7a710556e51f70ecc8dd26dfd04e3abf41 # v0.8 ) endif() @@ -225,7 +231,8 @@ if(_use_onemath) set(CMAKE_INSTALL_RPATH "${CMAKE_BINARY_DIR}/lib") else() if(_use_onemath_cuda OR _use_onemath_hip) - message(FATAL_ERROR + message( + FATAL_ERROR "CUDA or HIP targets are enabled, but oneMath is not. " "Please set DPNP_USE_ONEMATH=ON to enable them." ) @@ -233,7 +240,8 @@ else() endif() if(WIN32) - string(CONCAT WARNING_FLAGS + string( + CONCAT WARNING_FLAGS "-Wall " "-Wextra " "-Winit-self " @@ -242,10 +250,7 @@ if(WIN32) "-Wmissing-declarations " "-Wno-unused-parameter " ) - string(CONCAT SDL_FLAGS - "/GS " - "/DynamicBase " - ) + string(CONCAT SDL_FLAGS "/GS " "/DynamicBase ") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Ox ${WARNING_FLAGS} ${SDL_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Ox ${WARNING_FLAGS} ${SDL_FLAGS}") set(CMAKE_C_FLAGS_DEBUG @@ -256,7 +261,8 @@ if(WIN32) ) set(DPNP_LDFLAGS "/NXCompat;/DynamicBase") elseif(UNIX) - string(CONCAT WARNING_FLAGS + string( + CONCAT WARNING_FLAGS "-Wall " "-Wextra " "-Winit-self " @@ -265,7 +271,8 @@ elseif(UNIX) "-Wmissing-declarations " "-fdiagnostics-color=auto " ) - string(CONCAT SDL_FLAGS + string( + CONCAT SDL_FLAGS "-fstack-protector " "-fstack-protector-all " "-fpic " @@ -273,48 +280,36 @@ elseif(UNIX) "-D_FORTIFY_SOURCE=2 " "-Wformat " "-Wformat-security " -# "-fno-strict-overflow " # implied by -fwrapv + # "-fno-strict-overflow " # implied by -fwrapv "-fno-delete-null-pointer-checks " "-fwrapv " ) - string(CONCAT CFLAGS - "${WARNING_FLAGS}" - "${SDL_FLAGS}" - ) - string(CONCAT CXXFLAGS - "${WARNING_FLAGS}" - "${SDL_FLAGS}" - "-fsycl " - ) + string(CONCAT CFLAGS "${WARNING_FLAGS}" "${SDL_FLAGS}") + string(CONCAT CXXFLAGS "${WARNING_FLAGS}" "${SDL_FLAGS}" "-fsycl ") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 ${CFLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 ${CXXFLAGS}") - set(CMAKE_C_FLAGS_DEBUG - "${CMAKE_C_FLAGS_DEBUG} ${CFLAGS} -O0 -g1 -DDEBUG" - ) - set(CMAKE_CXX_FLAGS_DEBUG - "${CMAKE_CXX_FLAGS_DEBUG} ${CXXFLAGS} -O0 -g1 -DDEBUG" - ) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${CFLAGS} -O0 -g1 -DDEBUG") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CXXFLAGS} -O0 -g1 -DDEBUG") set(DPNP_LDFLAGS "-z,noexecstack,-z,relro,-z,now") else() message(FATAL_ERROR "Unsupported system.") endif() -if (DPNP_GENERATE_COVERAGE) - string(CONCAT PROFILE_FLAGS +if(DPNP_GENERATE_COVERAGE) + string( + CONCAT PROFILE_FLAGS "-fprofile-instr-generate " "-fcoverage-mapping " "-fno-sycl-use-footer " -# "-save-temps=obj " + # "-save-temps=obj " ) # Add profiling flags - set(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} ${PROFILE_FLAGS}" - ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROFILE_FLAGS}") endif() if(DEFINED SKBUILD) - set(_ignore_me ${SKBUILD}) + set(_ignore_me ${SKBUILD}) endif() add_subdirectory(dpnp) diff --git a/dpnp/CMakeLists.txt b/dpnp/CMakeLists.txt index 5b35bb76fe92..6850b799735c 100644 --- a/dpnp/CMakeLists.txt +++ b/dpnp/CMakeLists.txt @@ -28,60 +28,67 @@ # ***************************************************************************** function(build_dpnp_cython_ext _trgt _src _dest) - set(options SYCL) - add_cython_target(${_trgt} ${_src} CXX OUTPUT_VAR _generated_src) - message(STATUS "Using ${_trgt}") + set(options SYCL) + add_cython_target(${_trgt} ${_src} CXX OUTPUT_VAR _generated_src) + message(STATUS "Using ${_trgt}") - Python_add_library(${_trgt} MODULE WITH_SOABI ${_generated_src}) - set(_trgt_deps "${_trgt}_deps") - add_custom_target(${_trgt_deps} DEPENDS ${_src}) - add_dependencies(${_trgt} ${_trgt_deps}) + python_add_library(${_trgt} MODULE WITH_SOABI ${_generated_src}) + set(_trgt_deps "${_trgt}_deps") + add_custom_target(${_trgt_deps} DEPENDS ${_src}) + add_dependencies(${_trgt} ${_trgt_deps}) - if (BUILD_DPNP_EXT_SYCL) - add_sycl_to_target(TARGET ${_trgt} SOURCES ${_generated_src}) - endif() + if(BUILD_DPNP_EXT_SYCL) + add_sycl_to_target(TARGET ${_trgt} SOURCES ${_generated_src}) + endif() - if (DPNP_GENERATE_COVERAGE) - target_compile_definitions(${_trgt} PRIVATE CYTHON_TRACE=1 CYTHON_TRACE_NOGIL=1) - target_compile_options(${_trgt} PRIVATE "-fno-sycl-use-footer") - endif() + if(DPNP_GENERATE_COVERAGE) + target_compile_definitions(${_trgt} PRIVATE CYTHON_TRACE=1 CYTHON_TRACE_NOGIL=1) + target_compile_options(${_trgt} PRIVATE "-fno-sycl-use-footer") + endif() - # NumPy - target_compile_definitions(${_trgt} PRIVATE NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION) - target_link_libraries(${_trgt} PRIVATE Python::NumPy) + # NumPy + target_compile_definitions( + ${_trgt} + PRIVATE NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION + ) + target_link_libraries(${_trgt} PRIVATE Python::NumPy) - # Dpctl - target_include_directories(${_trgt} PRIVATE ${Dpctl_INCLUDE_DIR}) - target_link_directories(${_trgt} PRIVATE ${Dpctl_INCLUDE_DIR}/..) - target_link_libraries(${_trgt} PRIVATE DPCTLSyclInterface) + # Dpctl + target_include_directories(${_trgt} PRIVATE ${Dpctl_INCLUDE_DIR}) + target_link_directories(${_trgt} PRIVATE ${Dpctl_INCLUDE_DIR}/..) + target_link_libraries(${_trgt} PRIVATE DPCTLSyclInterface) - set(_linker_options "LINKER:${DPNP_LDFLAGS}") - target_link_options(${_trgt} PRIVATE ${_linker_options}) + set(_linker_options "LINKER:${DPNP_LDFLAGS}") + target_link_options(${_trgt} PRIVATE ${_linker_options}) - if (DPNP_GENERATE_COVERAGE) - set(_copy_cxx_trgt "${_trgt}_copy_cxx") - add_custom_target( - ${_copy_cxx_trgt} ALL COMMAND ${CMAKE_COMMAND} - -DSOURCE_FILE=${_generated_src} - -DDEST=${CMAKE_CURRENT_SOURCE_DIR} - -P ${CMAKE_SOURCE_DIR}/dpnp/cmake/copy_existing.cmake - DEPENDS ${_trgt} - VERBATIM COMMENT "Copying Cython-generated source for target ${_trgt} to dpnp source layout" - ) - endif() + if(DPNP_GENERATE_COVERAGE) + set(_copy_cxx_trgt "${_trgt}_copy_cxx") + add_custom_target( + ${_copy_cxx_trgt} + ALL + COMMAND + ${CMAKE_COMMAND} -DSOURCE_FILE=${_generated_src} + -DDEST=${CMAKE_CURRENT_SOURCE_DIR} -P + ${CMAKE_SOURCE_DIR}/dpnp/cmake/copy_existing.cmake + DEPENDS ${_trgt} + VERBATIM + COMMENT + "Copying Cython-generated source for target ${_trgt} to dpnp source layout" + ) + endif() - set(_rpath_value "$ORIGIN/..") - if (DPNP_WITH_REDIST) - set(_rpath_value "${_rpath_value}:$ORIGIN/../../../../") - endif() - set_target_properties(${_trgt} PROPERTIES INSTALL_RPATH ${_rpath_value}) + set(_rpath_value "$ORIGIN/..") + if(DPNP_WITH_REDIST) + set(_rpath_value "${_rpath_value}:$ORIGIN/../../../../") + endif() + set_target_properties(${_trgt} PROPERTIES INSTALL_RPATH ${_rpath_value}) - install(TARGETS ${_trgt} LIBRARY DESTINATION ${_dest}) + install(TARGETS ${_trgt} LIBRARY DESTINATION ${_dest}) endfunction() function(build_dpnp_cython_ext_with_backend _trgt _src _dest) - build_dpnp_cython_ext(${_trgt} ${_src} ${_dest}) - target_link_libraries(${_trgt} PRIVATE dpnp_backend_library) + build_dpnp_cython_ext(${_trgt} ${_src} ${_dest}) + target_link_libraries(${_trgt} PRIVATE dpnp_backend_library) endfunction() add_subdirectory(backend) @@ -94,7 +101,6 @@ add_subdirectory(backend/extensions/ufunc) add_subdirectory(backend/extensions/vm) add_subdirectory(backend/extensions/window) - add_subdirectory(dpnp_algo) add_subdirectory(dpnp_utils) add_subdirectory(random) diff --git a/dpnp/backend/CMakeLists.txt b/dpnp/backend/CMakeLists.txt index f88e52e352f5..d6e9e57be307 100644 --- a/dpnp/backend/CMakeLists.txt +++ b/dpnp/backend/CMakeLists.txt @@ -38,15 +38,17 @@ set(DPNP_SRC src/queue_sycl.cpp src/verbose.cpp src/dpnp_random_state.cpp - ) +) set(_trgt "dpnp_backend_c") if(WIN32) - if (${CMAKE_VERSION} VERSION_LESS "3.27") + if(${CMAKE_VERSION} VERSION_LESS "3.27") # this is a work-around for target_link_options inserting option after -link option, cause # linker to ignore it. - set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel") + set(CMAKE_CXX_LINK_FLAGS + "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel" + ) endif() endif() @@ -56,16 +58,13 @@ set_target_properties(${_trgt} PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON) target_include_directories(${_trgt} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) target_include_directories(${_trgt} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) -if (WIN32) - target_compile_options(${_trgt} PRIVATE - /clang:-fno-approx-func - /clang:-fno-finite-math-only +if(WIN32) + target_compile_options( + ${_trgt} + PRIVATE /clang:-fno-approx-func /clang:-fno-finite-math-only ) else() - target_compile_options(${_trgt} PRIVATE - -fno-approx-func - -fno-finite-math-only - ) + target_compile_options(${_trgt} PRIVATE -fno-approx-func -fno-finite-math-only) endif() # if (WIN32) @@ -81,9 +80,9 @@ endif() target_link_libraries(${_trgt} PUBLIC MKL::MKL_SYCL) target_link_libraries(${_trgt} PUBLIC oneDPL) -if (UNIX) - # needed for STL headers with GCC < 11 - target_compile_definitions(${_trgt} PUBLIC _GLIBCXX_USE_TBB_PAR_BACKEND=0) +if(UNIX) + # needed for STL headers with GCC < 11 + target_compile_definitions(${_trgt} PUBLIC _GLIBCXX_USE_TBB_PAR_BACKEND=0) endif() target_compile_definitions(${_trgt} PUBLIC PSTL_USE_PARALLEL_POLICIES=0) @@ -97,27 +96,30 @@ target_link_directories(${_trgt} PUBLIC "${Dpctl_INCLUDE_DIR}/..") target_link_libraries(${_trgt} PUBLIC DPCTLSyclInterface) add_library(dpnp_backend_library INTERFACE IMPORTED GLOBAL) -target_include_directories(dpnp_backend_library BEFORE INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src) +target_include_directories( + dpnp_backend_library + BEFORE + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src +) target_link_libraries(dpnp_backend_library INTERFACE ${_trgt}) -if (DPNP_WITH_REDIST) - set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../") +if(DPNP_WITH_REDIST) + set_target_properties( + ${python_module_name} + PROPERTIES INSTALL_RPATH "$ORIGIN/../../../" + ) endif() -if (DPNP_BACKEND_TESTS) - add_subdirectory(tests) +if(DPNP_BACKEND_TESTS) + add_subdirectory(tests) endif() set(_lib_destination dpnp) set(_include_destination dpnp/backend/include) install( - TARGETS ${_trgt} - LIBRARY - DESTINATION ${_lib_destination} - ARCHIVE - DESTINATION ${_lib_destination} - RUNTIME - DESTINATION ${_lib_destination} - PUBLIC_HEADER - DESTINATION ${_include_destination} - ) + TARGETS ${_trgt} + LIBRARY DESTINATION ${_lib_destination} + ARCHIVE DESTINATION ${_lib_destination} + RUNTIME DESTINATION ${_lib_destination} + PUBLIC_HEADER DESTINATION ${_include_destination} +) diff --git a/dpnp/backend/extensions/blas/CMakeLists.txt b/dpnp/backend/extensions/blas/CMakeLists.txt index df39bc89fa86..267567c69e71 100644 --- a/dpnp/backend/extensions/blas/CMakeLists.txt +++ b/dpnp/backend/extensions/blas/CMakeLists.txt @@ -27,7 +27,6 @@ # THE POSSIBILITY OF SUCH DAMAGE. # ***************************************************************************** - set(python_module_name _blas_impl) set(_module_src ${CMAKE_CURRENT_SOURCE_DIR}/blas_py.cpp @@ -44,48 +43,57 @@ if(_dpnp_sycl_targets) # make fat binary target_compile_options( ${python_module_name} - PRIVATE - ${_dpnp_sycl_target_compile_options} - ) - target_link_options( - ${python_module_name} - PRIVATE - ${_dpnp_sycl_target_link_options} + PRIVATE ${_dpnp_sycl_target_compile_options} ) + target_link_options(${python_module_name} PRIVATE ${_dpnp_sycl_target_link_options}) endif() -if (WIN32) - if (${CMAKE_VERSION} VERSION_LESS "3.27") +if(WIN32) + if(${CMAKE_VERSION} VERSION_LESS "3.27") # this is a work-around for target_link_options inserting option after -link option, cause # linker to ignore it. - set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel") + set(CMAKE_CXX_LINK_FLAGS + "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel" + ) endif() endif() -set_target_properties(${python_module_name} PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON) +set_target_properties( + ${python_module_name} + PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON +) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../ +) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common +) target_include_directories(${python_module_name} PUBLIC ${Dpctl_INCLUDE_DIRS}) target_include_directories(${python_module_name} PUBLIC ${Dpctl_TENSOR_INCLUDE_DIR}) -if (WIN32) - target_compile_options(${python_module_name} PRIVATE - /clang:-fno-approx-func - /clang:-fno-finite-math-only +if(WIN32) + target_compile_options( + ${python_module_name} + PRIVATE /clang:-fno-approx-func /clang:-fno-finite-math-only ) else() - target_compile_options(${python_module_name} PRIVATE - -fno-approx-func - -fno-finite-math-only + target_compile_options( + ${python_module_name} + PRIVATE -fno-approx-func -fno-finite-math-only ) endif() target_link_options(${python_module_name} PUBLIC -fsycl-device-code-split=per_kernel) -if (DPNP_GENERATE_COVERAGE) - target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping) +if(DPNP_GENERATE_COVERAGE) + target_link_options( + ${python_module_name} + PRIVATE -fprofile-instr-generate -fcoverage-mapping + ) endif() if(_ues_onemath) @@ -98,10 +106,11 @@ else() target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::BLAS) endif() -if (DPNP_WITH_REDIST) - set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../") +if(DPNP_WITH_REDIST) + set_target_properties( + ${python_module_name} + PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../" + ) endif() -install(TARGETS ${python_module_name} - DESTINATION "dpnp/backend/extensions/blas" -) +install(TARGETS ${python_module_name} DESTINATION "dpnp/backend/extensions/blas") diff --git a/dpnp/backend/extensions/fft/CMakeLists.txt b/dpnp/backend/extensions/fft/CMakeLists.txt index ce5044e764f8..50468857e3b9 100644 --- a/dpnp/backend/extensions/fft/CMakeLists.txt +++ b/dpnp/backend/extensions/fft/CMakeLists.txt @@ -27,11 +27,8 @@ # THE POSSIBILITY OF SUCH DAMAGE. # ***************************************************************************** - set(python_module_name _fft_impl) -set(_module_src - ${CMAKE_CURRENT_SOURCE_DIR}/fft_py.cpp -) +set(_module_src ${CMAKE_CURRENT_SOURCE_DIR}/fft_py.cpp) pybind11_add_module(${python_module_name} MODULE ${_module_src}) add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_module_src}) @@ -40,48 +37,57 @@ if(_dpnp_sycl_targets) # make fat binary target_compile_options( ${python_module_name} - PRIVATE - ${_dpnp_sycl_target_compile_options} - ) - target_link_options( - ${python_module_name} - PRIVATE - ${_dpnp_sycl_target_link_options} + PRIVATE ${_dpnp_sycl_target_compile_options} ) + target_link_options(${python_module_name} PRIVATE ${_dpnp_sycl_target_link_options}) endif() -if (WIN32) - if (${CMAKE_VERSION} VERSION_LESS "3.27") +if(WIN32) + if(${CMAKE_VERSION} VERSION_LESS "3.27") # this is a work-around for target_link_options inserting option after -link option, cause # linker to ignore it. - set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel") + set(CMAKE_CXX_LINK_FLAGS + "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel" + ) endif() endif() -set_target_properties(${python_module_name} PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON) +set_target_properties( + ${python_module_name} + PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON +) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../include) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../src) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../include +) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../src +) target_include_directories(${python_module_name} PUBLIC ${Dpctl_INCLUDE_DIRS}) target_include_directories(${python_module_name} PUBLIC ${Dpctl_TENSOR_INCLUDE_DIR}) -if (WIN32) - target_compile_options(${python_module_name} PRIVATE - /clang:-fno-approx-func - /clang:-fno-finite-math-only +if(WIN32) + target_compile_options( + ${python_module_name} + PRIVATE /clang:-fno-approx-func /clang:-fno-finite-math-only ) else() - target_compile_options(${python_module_name} PRIVATE - -fno-approx-func - -fno-finite-math-only + target_compile_options( + ${python_module_name} + PRIVATE -fno-approx-func -fno-finite-math-only ) endif() target_link_options(${python_module_name} PUBLIC -fsycl-device-code-split=per_kernel) -if (DPNP_GENERATE_COVERAGE) - target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping) +if(DPNP_GENERATE_COVERAGE) + target_link_options( + ${python_module_name} + PRIVATE -fprofile-instr-generate -fcoverage-mapping + ) endif() if(_use_onemath) @@ -91,10 +97,11 @@ else() target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::DFT) endif() -if (DPNP_WITH_REDIST) - set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../") +if(DPNP_WITH_REDIST) + set_target_properties( + ${python_module_name} + PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../" + ) endif() -install(TARGETS ${python_module_name} - DESTINATION "dpnp/backend/extensions/fft" -) +install(TARGETS ${python_module_name} DESTINATION "dpnp/backend/extensions/fft") diff --git a/dpnp/backend/extensions/indexing/CMakeLists.txt b/dpnp/backend/extensions/indexing/CMakeLists.txt index c95416826361..78f6713bdf2f 100644 --- a/dpnp/backend/extensions/indexing/CMakeLists.txt +++ b/dpnp/backend/extensions/indexing/CMakeLists.txt @@ -27,7 +27,6 @@ # THE POSSIBILITY OF SUCH DAMAGE. # ***************************************************************************** - set(python_module_name _indexing_impl) set(_module_src ${CMAKE_CURRENT_SOURCE_DIR}/choose.cpp @@ -41,54 +40,64 @@ if(_dpnp_sycl_targets) # make fat binary target_compile_options( ${python_module_name} - PRIVATE - ${_dpnp_sycl_target_compile_options} - ) - target_link_options( - ${python_module_name} - PRIVATE - ${_dpnp_sycl_target_link_options} + PRIVATE ${_dpnp_sycl_target_compile_options} ) + target_link_options(${python_module_name} PRIVATE ${_dpnp_sycl_target_link_options}) endif() -if (WIN32) - if (${CMAKE_VERSION} VERSION_LESS "3.27") +if(WIN32) + if(${CMAKE_VERSION} VERSION_LESS "3.27") # this is a work-around for target_link_options inserting option after -link option, cause # linker to ignore it. - set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel") + set(CMAKE_CXX_LINK_FLAGS + "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel" + ) endif() endif() -set_target_properties(${python_module_name} PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON) +set_target_properties( + ${python_module_name} + PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON +) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../ +) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common +) target_include_directories(${python_module_name} PUBLIC ${Dpctl_INCLUDE_DIR}) target_include_directories(${python_module_name} PUBLIC ${Dpctl_TENSOR_INCLUDE_DIR}) -if (WIN32) - target_compile_options(${python_module_name} PRIVATE - /clang:-fno-approx-func - /clang:-fno-finite-math-only +if(WIN32) + target_compile_options( + ${python_module_name} + PRIVATE /clang:-fno-approx-func /clang:-fno-finite-math-only ) else() - target_compile_options(${python_module_name} PRIVATE - -fno-approx-func - -fno-finite-math-only + target_compile_options( + ${python_module_name} + PRIVATE -fno-approx-func -fno-finite-math-only ) endif() target_link_options(${python_module_name} PUBLIC -fsycl-device-code-split=per_kernel) -if (DPNP_GENERATE_COVERAGE) - target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping) +if(DPNP_GENERATE_COVERAGE) + target_link_options( + ${python_module_name} + PRIVATE -fprofile-instr-generate -fcoverage-mapping + ) endif() -if (DPNP_WITH_REDIST) - set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../") +if(DPNP_WITH_REDIST) + set_target_properties( + ${python_module_name} + PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../" + ) endif() -install(TARGETS ${python_module_name} - DESTINATION "dpnp/backend/extensions/indexing" -) +install(TARGETS ${python_module_name} DESTINATION "dpnp/backend/extensions/indexing") diff --git a/dpnp/backend/extensions/lapack/CMakeLists.txt b/dpnp/backend/extensions/lapack/CMakeLists.txt index 9c495e243592..5e8b95963e94 100644 --- a/dpnp/backend/extensions/lapack/CMakeLists.txt +++ b/dpnp/backend/extensions/lapack/CMakeLists.txt @@ -27,7 +27,6 @@ # THE POSSIBILITY OF SUCH DAMAGE. # ***************************************************************************** - set(python_module_name _lapack_impl) set(_module_src ${CMAKE_CURRENT_SOURCE_DIR}/lapack_py.cpp @@ -61,48 +60,57 @@ if(_dpnp_sycl_targets) # make fat binary target_compile_options( ${python_module_name} - PRIVATE - ${_dpnp_sycl_target_compile_options} - ) - target_link_options( - ${python_module_name} - PRIVATE - ${_dpnp_sycl_target_link_options} + PRIVATE ${_dpnp_sycl_target_compile_options} ) + target_link_options(${python_module_name} PRIVATE ${_dpnp_sycl_target_link_options}) endif() -if (WIN32) - if (${CMAKE_VERSION} VERSION_LESS "3.27") +if(WIN32) + if(${CMAKE_VERSION} VERSION_LESS "3.27") # this is a work-around for target_link_options inserting option after -link option, cause # linker to ignore it. - set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel") + set(CMAKE_CXX_LINK_FLAGS + "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel" + ) endif() endif() -set_target_properties(${python_module_name} PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON) +set_target_properties( + ${python_module_name} + PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON +) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../ +) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common +) target_include_directories(${python_module_name} PUBLIC ${Dpctl_INCLUDE_DIR}) target_include_directories(${python_module_name} PUBLIC ${Dpctl_TENSOR_INCLUDE_DIR}) -if (WIN32) - target_compile_options(${python_module_name} PRIVATE - /clang:-fno-approx-func - /clang:-fno-finite-math-only +if(WIN32) + target_compile_options( + ${python_module_name} + PRIVATE /clang:-fno-approx-func /clang:-fno-finite-math-only ) else() - target_compile_options(${python_module_name} PRIVATE - -fno-approx-func - -fno-finite-math-only + target_compile_options( + ${python_module_name} + PRIVATE -fno-approx-func -fno-finite-math-only ) endif() target_link_options(${python_module_name} PUBLIC -fsycl-device-code-split=per_kernel) -if (DPNP_GENERATE_COVERAGE) - target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping) +if(DPNP_GENERATE_COVERAGE) + target_link_options( + ${python_module_name} + PRIVATE -fprofile-instr-generate -fcoverage-mapping + ) endif() if(_use_onemath) @@ -112,10 +120,11 @@ else() target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::LAPACK) endif() -if (DPNP_WITH_REDIST) - set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../") +if(DPNP_WITH_REDIST) + set_target_properties( + ${python_module_name} + PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../" + ) endif() -install(TARGETS ${python_module_name} - DESTINATION "dpnp/backend/extensions/lapack" -) +install(TARGETS ${python_module_name} DESTINATION "dpnp/backend/extensions/lapack") diff --git a/dpnp/backend/extensions/statistics/CMakeLists.txt b/dpnp/backend/extensions/statistics/CMakeLists.txt index 2596745eee9e..9561daf27ce2 100644 --- a/dpnp/backend/extensions/statistics/CMakeLists.txt +++ b/dpnp/backend/extensions/statistics/CMakeLists.txt @@ -27,7 +27,6 @@ # THE POSSIBILITY OF SUCH DAMAGE. # ***************************************************************************** - set(python_module_name _statistics_impl) set(_module_src ${CMAKE_CURRENT_SOURCE_DIR}/bincount.cpp @@ -46,55 +45,68 @@ if(_dpnp_sycl_targets) # make fat binary target_compile_options( ${python_module_name} - PRIVATE - ${_dpnp_sycl_target_compile_options} - ) - target_link_options( - ${python_module_name} - PRIVATE - ${_dpnp_sycl_target_link_options} + PRIVATE ${_dpnp_sycl_target_compile_options} ) + target_link_options(${python_module_name} PRIVATE ${_dpnp_sycl_target_link_options}) endif() -if (WIN32) - if (${CMAKE_VERSION} VERSION_LESS "3.27") +if(WIN32) + if(${CMAKE_VERSION} VERSION_LESS "3.27") # this is a work-around for target_link_options inserting option after -link option, cause # linker to ignore it. - set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel") + set(CMAKE_CXX_LINK_FLAGS + "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel" + ) endif() endif() -set_target_properties(${python_module_name} PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON) +set_target_properties( + ${python_module_name} + PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON +) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../include) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../src) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../include +) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../src +) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common +) target_include_directories(${python_module_name} PUBLIC ${Dpctl_INCLUDE_DIR}) target_include_directories(${python_module_name} PUBLIC ${Dpctl_TENSOR_INCLUDE_DIR}) -if (WIN32) - target_compile_options(${python_module_name} PRIVATE - /clang:-fno-approx-func - /clang:-fno-finite-math-only +if(WIN32) + target_compile_options( + ${python_module_name} + PRIVATE /clang:-fno-approx-func /clang:-fno-finite-math-only ) else() - target_compile_options(${python_module_name} PRIVATE - -fno-approx-func - -fno-finite-math-only + target_compile_options( + ${python_module_name} + PRIVATE -fno-approx-func -fno-finite-math-only ) endif() target_link_options(${python_module_name} PUBLIC -fsycl-device-code-split=per_kernel) -if (DPNP_GENERATE_COVERAGE) - target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping) +if(DPNP_GENERATE_COVERAGE) + target_link_options( + ${python_module_name} + PRIVATE -fprofile-instr-generate -fcoverage-mapping + ) endif() -if (DPNP_WITH_REDIST) - set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../") +if(DPNP_WITH_REDIST) + set_target_properties( + ${python_module_name} + PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../" + ) endif() -install(TARGETS ${python_module_name} - DESTINATION "dpnp/backend/extensions/statistics" -) +install(TARGETS ${python_module_name} DESTINATION "dpnp/backend/extensions/statistics") diff --git a/dpnp/backend/extensions/ufunc/CMakeLists.txt b/dpnp/backend/extensions/ufunc/CMakeLists.txt index 62e8249b508f..76eda47ed4df 100644 --- a/dpnp/backend/extensions/ufunc/CMakeLists.txt +++ b/dpnp/backend/extensions/ufunc/CMakeLists.txt @@ -66,58 +66,68 @@ set(_module_src pybind11_add_module(${python_module_name} MODULE ${_module_src}) add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_module_src}) -if (WIN32) - if (${CMAKE_VERSION} VERSION_LESS "3.27") +if(WIN32) + if(${CMAKE_VERSION} VERSION_LESS "3.27") # this is a work-around for target_link_options inserting option after -link option, cause # linker to ignore it. - set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel") + set(CMAKE_CXX_LINK_FLAGS + "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel" + ) endif() endif() -set_target_properties(${python_module_name} PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON) +set_target_properties( + ${python_module_name} + PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON +) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../ +) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common +) target_include_directories(${python_module_name} PUBLIC ${Dpctl_INCLUDE_DIR}) target_include_directories(${python_module_name} PUBLIC ${Dpctl_TENSOR_INCLUDE_DIR}) if(_dpnp_sycl_targets) - # make fat binary - target_compile_options( - ${python_module_name} - PRIVATE - ${_dpnp_sycl_target_compile_options} - ) - target_link_options( - ${python_module_name} - PRIVATE - ${_dpnp_sycl_target_link_options} - ) + # make fat binary + target_compile_options( + ${python_module_name} + PRIVATE ${_dpnp_sycl_target_compile_options} + ) + target_link_options(${python_module_name} PRIVATE ${_dpnp_sycl_target_link_options}) endif() -if (WIN32) - target_compile_options(${python_module_name} PRIVATE - /clang:-fno-approx-func - /clang:-fno-finite-math-only +if(WIN32) + target_compile_options( + ${python_module_name} + PRIVATE /clang:-fno-approx-func /clang:-fno-finite-math-only ) else() - target_compile_options(${python_module_name} PRIVATE - -fno-approx-func - -fno-finite-math-only + target_compile_options( + ${python_module_name} + PRIVATE -fno-approx-func -fno-finite-math-only ) endif() target_link_options(${python_module_name} PUBLIC -fsycl-device-code-split=per_kernel) -if (DPNP_GENERATE_COVERAGE) - target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping) +if(DPNP_GENERATE_COVERAGE) + target_link_options( + ${python_module_name} + PRIVATE -fprofile-instr-generate -fcoverage-mapping + ) endif() -if (DPNP_WITH_REDIST) - set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../") +if(DPNP_WITH_REDIST) + set_target_properties( + ${python_module_name} + PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../" + ) endif() -install(TARGETS ${python_module_name} - DESTINATION "dpnp/backend/extensions/ufunc" -) +install(TARGETS ${python_module_name} DESTINATION "dpnp/backend/extensions/ufunc") diff --git a/dpnp/backend/extensions/vm/CMakeLists.txt b/dpnp/backend/extensions/vm/CMakeLists.txt index 2ea7e29ddd3f..236ca371b226 100644 --- a/dpnp/backend/extensions/vm/CMakeLists.txt +++ b/dpnp/backend/extensions/vm/CMakeLists.txt @@ -73,7 +73,7 @@ if(NOT _use_onemath) ${CMAKE_CURRENT_SOURCE_DIR}/tan.cpp ${CMAKE_CURRENT_SOURCE_DIR}/tanh.cpp ${CMAKE_CURRENT_SOURCE_DIR}/trunc.cpp -) + ) endif() set(_module_src @@ -89,38 +89,52 @@ set(python_module_name _vm_impl) pybind11_add_module(${python_module_name} MODULE ${_module_src}) add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_module_src}) -if (WIN32) - if (${CMAKE_VERSION} VERSION_LESS "3.27") +if(WIN32) + if(${CMAKE_VERSION} VERSION_LESS "3.27") # this is a work-around for target_link_options inserting option after -link option, cause # linker to ignore it. - set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel") + set(CMAKE_CXX_LINK_FLAGS + "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel" + ) endif() endif() -set_target_properties(${python_module_name} PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON) +set_target_properties( + ${python_module_name} + PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON +) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../ +) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common +) target_include_directories(${python_module_name} PUBLIC ${Dpctl_INCLUDE_DIR}) target_include_directories(${python_module_name} PUBLIC ${Dpctl_TENSOR_INCLUDE_DIR}) -if (WIN32) - target_compile_options(${python_module_name} PRIVATE - /clang:-fno-approx-func - /clang:-fno-finite-math-only +if(WIN32) + target_compile_options( + ${python_module_name} + PRIVATE /clang:-fno-approx-func /clang:-fno-finite-math-only ) else() - target_compile_options(${python_module_name} PRIVATE - -fno-approx-func - -fno-finite-math-only + target_compile_options( + ${python_module_name} + PRIVATE -fno-approx-func -fno-finite-math-only ) endif() target_link_options(${python_module_name} PUBLIC -fsycl-device-code-split=per_kernel) -if (DPNP_GENERATE_COVERAGE) - target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping) +if(DPNP_GENERATE_COVERAGE) + target_link_options( + ${python_module_name} + PRIVATE -fprofile-instr-generate -fcoverage-mapping + ) endif() if(_use_onemath) @@ -129,10 +143,11 @@ else() target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::VM) endif() -if (DPNP_WITH_REDIST) - set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../") +if(DPNP_WITH_REDIST) + set_target_properties( + ${python_module_name} + PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../" + ) endif() -install(TARGETS ${python_module_name} - DESTINATION "dpnp/backend/extensions/vm" -) +install(TARGETS ${python_module_name} DESTINATION "dpnp/backend/extensions/vm") diff --git a/dpnp/backend/extensions/window/CMakeLists.txt b/dpnp/backend/extensions/window/CMakeLists.txt index ccc6eb8c0cc9..fc446f523e74 100644 --- a/dpnp/backend/extensions/window/CMakeLists.txt +++ b/dpnp/backend/extensions/window/CMakeLists.txt @@ -27,7 +27,6 @@ # THE POSSIBILITY OF SUCH DAMAGE. # ***************************************************************************** - set(python_module_name _window_impl) set(_module_src ${CMAKE_CURRENT_SOURCE_DIR}/kaiser.cpp @@ -41,54 +40,64 @@ if(_dpnp_sycl_targets) # make fat binary target_compile_options( ${python_module_name} - PRIVATE - ${_dpnp_sycl_target_compile_options} - ) - target_link_options( - ${python_module_name} - PRIVATE - ${_dpnp_sycl_target_link_options} + PRIVATE ${_dpnp_sycl_target_compile_options} ) + target_link_options(${python_module_name} PRIVATE ${_dpnp_sycl_target_link_options}) endif() -if (WIN32) - if (${CMAKE_VERSION} VERSION_LESS "3.27") +if(WIN32) + if(${CMAKE_VERSION} VERSION_LESS "3.27") # this is a work-around for target_link_options inserting option after -link option, cause # linker to ignore it. - set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel") + set(CMAKE_CXX_LINK_FLAGS + "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel" + ) endif() endif() -set_target_properties(${python_module_name} PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON) +set_target_properties( + ${python_module_name} + PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON +) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../) -target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../ +) +target_include_directories( + ${python_module_name} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common +) target_include_directories(${python_module_name} PUBLIC ${Dpctl_INCLUDE_DIR}) target_include_directories(${python_module_name} PUBLIC ${Dpctl_TENSOR_INCLUDE_DIR}) -if (WIN32) - target_compile_options(${python_module_name} PRIVATE - /clang:-fno-approx-func - /clang:-fno-finite-math-only +if(WIN32) + target_compile_options( + ${python_module_name} + PRIVATE /clang:-fno-approx-func /clang:-fno-finite-math-only ) else() - target_compile_options(${python_module_name} PRIVATE - -fno-approx-func - -fno-finite-math-only + target_compile_options( + ${python_module_name} + PRIVATE -fno-approx-func -fno-finite-math-only ) endif() target_link_options(${python_module_name} PUBLIC -fsycl-device-code-split=per_kernel) -if (DPNP_GENERATE_COVERAGE) - target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping) +if(DPNP_GENERATE_COVERAGE) + target_link_options( + ${python_module_name} + PRIVATE -fprofile-instr-generate -fcoverage-mapping + ) endif() -if (DPNP_WITH_REDIST) - set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../") +if(DPNP_WITH_REDIST) + set_target_properties( + ${python_module_name} + PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../" + ) endif() -install(TARGETS ${python_module_name} - DESTINATION "dpnp/backend/extensions/window" -) +install(TARGETS ${python_module_name} DESTINATION "dpnp/backend/extensions/window") diff --git a/dpnp/backend/tests/CMakeLists.txt b/dpnp/backend/tests/CMakeLists.txt index 854b16c6416c..2f5641d1ed92 100644 --- a/dpnp/backend/tests/CMakeLists.txt +++ b/dpnp/backend/tests/CMakeLists.txt @@ -31,13 +31,16 @@ find_package(GTest REQUIRED) find_package(Threads REQUIRED) if(GTEST_FOUND) - message(STATUS "Found GTest: (include: ${GTEST_INCLUDE_DIRS}, library: ${GTEST_LIBRARIES})") + message( + STATUS + "Found GTest: (include: ${GTEST_INCLUDE_DIRS}, library: ${GTEST_LIBRARIES})" + ) else() - message(FATAL_ERROR "Cannot find Google Test Framework!") + message(FATAL_ERROR "Cannot find Google Test Framework!") endif() if(NOT Threads_FOUND) - message(FATAL_ERROR "Cannot find Threads library!") + message(FATAL_ERROR "Cannot find Threads library!") endif() # Emulate autotools like make check target to build tests @@ -49,9 +52,7 @@ include_directories(${GTEST_INCLUDE_DIR}) link_directories(${GTEST_LIB_DIR}) # TODO split -add_executable(dpnpc_tests - test_main.cpp - test_random.cpp) +add_executable(dpnpc_tests test_main.cpp test_random.cpp) target_link_libraries(dpnpc_tests GTest::GTest GTest::Main pthread dpnp_backend_library) # TODO split diff --git a/dpnp/cmake/copy_existing.cmake b/dpnp/cmake/copy_existing.cmake index e90ab29f8c76..4f4cb8265331 100644 --- a/dpnp/cmake/copy_existing.cmake +++ b/dpnp/cmake/copy_existing.cmake @@ -26,6 +26,6 @@ # THE POSSIBILITY OF SUCH DAMAGE. # ***************************************************************************** -if (EXISTS ${SOURCE_FILE}) - configure_file(${SOURCE_FILE} ${DEST} COPYONLY) +if(EXISTS ${SOURCE_FILE}) + configure_file(${SOURCE_FILE} ${DEST} COPYONLY) endif() diff --git a/dpnp/dpnp_algo/CMakeLists.txt b/dpnp/dpnp_algo/CMakeLists.txt index 359d72b7a7ba..c8d9bc3dddd7 100644 --- a/dpnp/dpnp_algo/CMakeLists.txt +++ b/dpnp/dpnp_algo/CMakeLists.txt @@ -28,16 +28,16 @@ # ***************************************************************************** set(dpnp_algo_pyx_deps - ${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_sorting.pxi - ${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_mathematical.pxi - ${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_indexing.pxi - ) + ${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_sorting.pxi + ${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_mathematical.pxi + ${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_indexing.pxi +) build_dpnp_cython_ext_with_backend( dpnp_algo ${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo.pyx dpnp/dpnp_algo - ) +) add_custom_target(_dpnp_algo_deps DEPENDS ${dpnp_algo_pyx_deps}) add_dependencies(dpnp_algo _dpnp_algo_deps) diff --git a/dpnp/dpnp_utils/CMakeLists.txt b/dpnp/dpnp_utils/CMakeLists.txt index ce16b6ece8a1..a9facda0fda9 100644 --- a/dpnp/dpnp_utils/CMakeLists.txt +++ b/dpnp/dpnp_utils/CMakeLists.txt @@ -33,4 +33,4 @@ build_dpnp_cython_ext_with_backend( dpnp_algo_utils ${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_utils.pyx dpnp/dpnp_utils - ) +) diff --git a/dpnp/random/CMakeLists.txt b/dpnp/random/CMakeLists.txt index 5cf26604736e..5a4689d99a27 100644 --- a/dpnp/random/CMakeLists.txt +++ b/dpnp/random/CMakeLists.txt @@ -33,4 +33,4 @@ build_dpnp_cython_ext_with_backend( dpnp_algo_random ${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_random.pyx dpnp/random - ) +) From ef66527885c211b3e3da361a0a65dfd3dfc026d5 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 10 Nov 2025 13:21:39 +0100 Subject: [PATCH 4/4] Add PR to the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cd5de4e47cc..b632cad907af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ Also, that release drops support for Python 3.9, making Python 3.10 the minimum * Added implementation of `dpnp.ndarray.tolist` method [#2652](https://github.com/IntelPython/dpnp/pull/2652) * Added implementation of `dpnp.frexp` [#2635](https://github.com/IntelPython/dpnp/pull/2635) * Added implementation of `dpnp.ndarray.tofile` method [#2635](https://github.com/IntelPython/dpnp/pull/2635) +* Extended `pre-commit` configuration with `pyupgrade`, `actionlint`, and `gersemi` hooks [#2658](https://github.com/IntelPython/dpnp/pull/2658) ### Changed