From a23a15f68b3695cb0a269eb985a0e18fc1e677de Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 24 Jul 2023 16:48:32 +0200 Subject: [PATCH 1/2] Resolved warning and error with cython 3.0.0 --- dpnp/CMakeLists.txt | 1 + dpnp/dparray.pyx | 70 +++++++++++++++++++++++++++++++++++---------- 2 files changed, 56 insertions(+), 15 deletions(-) diff --git a/dpnp/CMakeLists.txt b/dpnp/CMakeLists.txt index 5ee84b28153..df4971cfa38 100644 --- a/dpnp/CMakeLists.txt +++ b/dpnp/CMakeLists.txt @@ -9,6 +9,7 @@ function(build_dpnp_cython_ext _trgt _src _dest) if (DPNP_GENERATE_COVERAGE) target_compile_definitions(${_trgt} PRIVATE CYTHON_TRACE=1 CYTHON_TRACE_NOGIL=1) endif() + target_compile_definitions(${_trgt} PRIVATE NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION) # NumPy target_include_directories(${_trgt} PRIVATE ${NumPy_INCLUDE_DIR}) # Dpctl diff --git a/dpnp/dparray.pyx b/dpnp/dparray.pyx index 5ef9ed1c10b..11dcf0784b7 100644 --- a/dpnp/dparray.pyx +++ b/dpnp/dparray.pyx @@ -40,7 +40,13 @@ from libcpp cimport bool as cpp_bool import numpy +from dpnp.dpnp_algo import ( + dpnp_astype, + dpnp_flatten, +) + # to avoid interference with Python internal functions +from dpnp.dpnp_iface import asnumpy from dpnp.dpnp_iface import get_dpnp_descriptor as iface_get_dpnp_descriptor from dpnp.dpnp_iface import prod as iface_prod from dpnp.dpnp_iface import sum as iface_sum @@ -86,29 +92,63 @@ from dpnp.dpnp_iface_arraycreation import ( zeros, zeros_like, ) -from dpnp.dpnp_iface_bitwise import * -from dpnp.dpnp_iface_counting import * -from dpnp.dpnp_iface_indexing import * -from dpnp.dpnp_iface_libmath import * -from dpnp.dpnp_iface_linearalgebra import * -from dpnp.dpnp_iface_logic import * -from dpnp.dpnp_iface_logic import all, any # TODO do the same as for iface_sum -from dpnp.dpnp_iface_manipulation import * -from dpnp.dpnp_iface_mathematical import * -from dpnp.dpnp_iface_searching import * -from dpnp.dpnp_iface_sorting import * -from dpnp.dpnp_iface_statistics import * +from dpnp.dpnp_iface_indexing import ( + choose, + diagonal, + take, +) +from dpnp.dpnp_iface_linearalgebra import matmul +from dpnp.dpnp_iface_logic import ( # TODO do the same as for iface_sum + all, + any, + equal, + greater, + greater_equal, + less, + less_equal, + not_equal, +) +from dpnp.dpnp_iface_manipulation import ( + copyto, + repeat, + squeeze, + transpose, +) +from dpnp.dpnp_iface_mathematical import ( + add, + around, + conjugate, + cumprod, + cumsum, + divide, + multiply, + negative, + power, + remainder, + subtract, +) +from dpnp.dpnp_iface_searching import argmax, argmin +from dpnp.dpnp_iface_sorting import ( + argsort, + partition, + sort, +) from dpnp.dpnp_iface_statistics import ( # TODO do the same as for iface_sum max, + mean, min, + std, + var, ) -from dpnp.dpnp_iface_trigonometric import * -from dpnp.dpnp_iface_types import * +from dpnp.dpnp_iface_types import float64 cimport numpy cimport dpnp.dpnp_utils as utils -from dpnp.dpnp_algo cimport * +from dpnp.dpnp_algo cimport ( + dpnp_memory_alloc_c, + dpnp_memory_free_c, +) # initially copied from original From bee687802322ddfb10bed4ca9b7b6d3948731aa2 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 24 Jul 2023 17:24:56 +0200 Subject: [PATCH 2/2] Removed cython pinning --- .github/workflows/build-sphinx.yml | 2 +- .github/workflows/generate_coverage.yaml | 2 +- conda-recipe/meta.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-sphinx.yml b/.github/workflows/build-sphinx.yml index f58021db135..abb113c52c8 100644 --- a/.github/workflows/build-sphinx.yml +++ b/.github/workflows/build-sphinx.yml @@ -80,7 +80,7 @@ jobs: - name: Install dpnp dependencies run: | conda install dpctl mkl-devel-dpcpp onedpl-devel tbb-devel dpcpp_linux-64 \ - cmake cython"<3" pytest ninja scikit-build sysroot_linux-64">=2.28" ${{ env.CHANNELS }} + cmake cython pytest ninja scikit-build sysroot_linux-64">=2.28" ${{ env.CHANNELS }} - name: Install cuPy dependencies run: conda install cupy cudatoolkit=10.0 diff --git a/.github/workflows/generate_coverage.yaml b/.github/workflows/generate_coverage.yaml index 5091f93a916..413835d336c 100644 --- a/.github/workflows/generate_coverage.yaml +++ b/.github/workflows/generate_coverage.yaml @@ -41,7 +41,7 @@ jobs: sudo apt-get install lcov - name: Install dpnp dependencies run: | - conda install cython"<3" llvm cmake">=3.21" scikit-build ninja pytest pytest-cov coverage[toml] \ + conda install cython llvm cmake">=3.21" scikit-build ninja pytest pytest-cov coverage[toml] \ dpctl dpcpp_linux-64 sysroot_linux-64">=2.28" mkl-devel-dpcpp tbb-devel onedpl-devel ${{ env.CHANNELS }} - name: Conda info run: | diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index b2ef34dc648..227fe0e7bb8 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -9,7 +9,7 @@ requirements: - python - setuptools - numpy >=1.19,<1.25a0 - - cython <3 + - cython - cmake >=3.21 - ninja - git