Skip to content

Metadata improvements #2462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ exclude =
.git,
benchmarks/*.py,
build,
dpnp/_version.py,
dpnp/to_numba/*.py,
conda.recipe,
dpnp/tests/*.py,
tests_external/*.py,
versioneer.py,

# Print detailed statistic if any issue detected
count = True
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dpnp/_version.py export-subst
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ repos:
rev: 25.1.0
hooks:
- id: black
exclude: "dpnp/_version.py"
- repo: https://github.com/pycqa/isort
rev: 6.0.1
hooks:
- id: isort
name: isort (python)
exclude: "dpnp/_version.py"
- id: isort
name: isort (cython)
types: [cython]
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ This release achieves 100% compliance with Python Array API specification (revis
* Updates the list of required python versions documented in `Quick Start Guide` [#2449](https://github.com/IntelPython/dpnp/pull/2449)
* Updated FFT module to ensure an input array is Hermitian before calling complex-to-real FFT [#2444](https://github.com/IntelPython/dpnp/pull/2444)
* Aligned `black` configuration with the list of supported python versions [#2457](https://github.com/IntelPython/dpnp/pull/2457)
* Use `pyproject.toml` instead of `setup.py` aligning with current packaging best practices [#2462](https://github.com/IntelPython/dpnp/pull/2462)

### Fixed

Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ FetchContent_Declare(
pybind11
URL https://github.com/pybind/pybind11/archive/refs/tags/v2.13.6.tar.gz
URL_HASH SHA256=e08cb87f4773da97fa7b5f035de8763abc656d87d5773e62f6da0587d1f0ec20
FIND_PACKAGE_ARGS NAMES pybind11
)
FetchContent_MakeAvailable(pybind11)

Expand Down
59 changes: 36 additions & 23 deletions conda-recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
REM A workaround for activate-dpcpp.bat issue to be addressed in 2021.4
SET "LIB=%BUILD_PREFIX%\Library\lib;%BUILD_PREFIX%\compiler\lib;%LIB%"
SET "INCLUDE=%BUILD_PREFIX%\include;%INCLUDE%"
set "LIB=%BUILD_PREFIX%\Library\lib;%BUILD_PREFIX%\compiler\lib;%LIB%"
set "INCLUDE=%BUILD_PREFIX%\include;%INCLUDE%"

"%PYTHON%" setup.py clean --all

set "MKLROOT=%PREFIX%/Library"
set "TBB_ROOT_HINT=%PREFIX%/Library"
set "DPL_ROOT_HINT=%PREFIX%/Library"

set "SKBUILD_ARGS=-G Ninja -- -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icx -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
set "SKBUILD_ARGS=%SKBUILD_ARGS% -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"

REM Overriding IPO is useful for building in resources constrained VMs (public CI)
if DEFINED OVERRIDE_INTEL_IPO (
set "SKBUILD_ARGS=%SKBUILD_ARGS% -DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=FALSE"
set "CMAKE_ARGS=%CMAKE_ARGS% -DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=FALSE"
)

FOR %%V IN (17.0.0 17 18.0.0 18 19.0.0 19) DO @(
FOR %%V IN (17.0.0 17 18.0.0 18 19.0.0 19 20.0.0 20 21.0.0 21) DO @(
REM set DIR_HINT if directory exists
IF EXIST "%BUILD_PREFIX%\Library\lib\clang\%%V\" (
SET "SYCL_INCLUDE_DIR_HINT=%BUILD_PREFIX%\Library\lib\clang\%%V"
set "SYCL_INCLUDE_DIR_HINT=%BUILD_PREFIX%\Library\lib\clang\%%V"
)
)

Expand All @@ -37,21 +34,37 @@ if EXIST "%PLATFORM_DIR%" (
if errorlevel 1 exit 1
)

if NOT "%WHEELS_OUTPUT_FOLDER%"=="" (
rem Install and assemble wheel package from the build bits
"%PYTHON%" setup.py install bdist_wheel %SKBUILD_ARGS%
if errorlevel 1 exit 1
copy dist\dpnp*.whl %WHEELS_OUTPUT_FOLDER%
if errorlevel 1 exit 1
) ELSE (
rem Only install
"%PYTHON%" setup.py install %SKBUILD_ARGS%
if errorlevel 1 exit 1
set "CC=icx"
set "CXX=icx"

set "CMAKE_GENERATOR=Ninja"
:: Make CMake verbose
set "VERBOSE=1"

%PYTHON% -m build -w -n -x
if %ERRORLEVEL% neq 0 exit 1

:: `pip install dist\numpy*.whl` does not work on windows,
:: so use a loop; there's only one wheel in dist/ anyway
for /f %%f in ('dir /b /S .\dist') do (
%PYTHON% -m wheel tags --remove --build %GIT_DESCRIBE_NUMBER% %%f
if %ERRORLEVEL% neq 0 exit 1
)

rem copy back
if EXIST "%PLATFORM_DIR%" (
rem copy back
copy /Y "%FN%" "%PLATFORM_DIR%\%FN%"
if errorlevel 1 exit 1
:: wheel file was renamed
for /f %%f in ('dir /b /S .\dist') do (
%PYTHON% -m pip install %%f ^
--no-build-isolation ^
--no-deps ^
--only-binary :all: ^
--no-index ^
--prefix %PREFIX% ^
-vv
if %ERRORLEVEL% neq 0 exit 1
)

:: Copy wheel package
if NOT "%WHEELS_OUTPUT_FOLDER%"=="" (
copy dist\dpnp*.whl %WHEELS_OUTPUT_FOLDER%
if %ERRORLEVEL% neq 0 exit 1
)
49 changes: 34 additions & 15 deletions conda-recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,38 @@ export ICPXCFG
ICXCFG="$(pwd)/icpx_for_conda.cfg"
export ICXCFG

export CMAKE_GENERATOR="Ninja"
export TBB_ROOT_HINT=$PREFIX
export DPL_ROOT_HINT=$PREFIX
export MKL_ROOT_HINT=$PREFIX
SKBUILD_ARGS=(-- "-DCMAKE_C_COMPILER:PATH=icx" "-DCMAKE_CXX_COMPILER:PATH=icpx" "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON")
SKBUILD_ARGS=("${SKBUILD_ARGS[@]}" "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON")
SKBUILD_ARGS=("${SKBUILD_ARGS[@]}" "-DDPNP_WITH_REDIST:BOOL=ON")

# Build wheel package
WHEELS_BUILD_ARGS=("-p" "manylinux_2_28_x86_64")
if [ -n "${WHEELS_OUTPUT_FOLDER}" ]; then
$PYTHON setup.py install bdist_wheel "${WHEELS_BUILD_ARGS[@]}" "${SKBUILD_ARGS[@]}"
cp dist/dpnp*.whl "${WHEELS_OUTPUT_FOLDER}"
else
$PYTHON setup.py install "${SKBUILD_ARGS[@]}"
read -r GLIBC_MAJOR GLIBC_MINOR <<<"$(conda list '^sysroot_linux-64$' \
| tail -n 1 | awk '{print $2}' | grep -oP '\d+' | head -n 2 | tr '\n' ' ')"

if [ -e "_skbuild" ]; then
${PYTHON} setup.py clean --all
fi

export CC=icx
export CXX=icpx

export CMAKE_GENERATOR=Ninja
# Make CMake verbose
export VERBOSE=1

CMAKE_ARGS="${CMAKE_ARGS} -DDPNP_WITH_REDIST:BOOL=ON"

# -wnx flags mean: --wheel --no-isolation --skip-dependency-check
${PYTHON} -m build -w -n -x

${PYTHON} -m wheel tags --remove --build "$GIT_DESCRIBE_NUMBER" \
--platform-tag "manylinux_${GLIBC_MAJOR}_${GLIBC_MINOR}_x86_64" \
dist/dpnp*.whl

${PYTHON} -m pip install dist/dpnp*.whl \
--no-build-isolation \
--no-deps \
--only-binary :all: \
--no-index \
--prefix "${PREFIX}" \
-vv

# Copy wheel package
if [[ -d "${WHEELS_OUTPUT_FOLDER}" ]]; then
cp dist/dpnp*.whl "${WHEELS_OUTPUT_FOLDER[@]}"
fi
28 changes: 20 additions & 8 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
{% set required_compiler_and_mkl_version = "2025.0" %}
{% set required_dpctl_version = "0.20.0*" %}

{% set pyproject = load_file_data('pyproject.toml') %}
{% set py_build_deps = pyproject.get('build-system', {}).get('requires', []) %}

package:
name: dpnp
version: {{ GIT_DESCRIBE_TAG }}
Expand All @@ -11,18 +14,27 @@ source:
requirements:
host:
- python
- setuptools
- numpy >=1.23
- cython
- cmake >=3.21
- ninja
- git
- pip >=25.0
- pybind11 >=2.13.6
{% for dep in py_build_deps %}
{% if dep.startswith('dpctl') %}
- dpctl >={{ required_dpctl_version }}
{% elif dep.startswith('ninja') %}
- {{ dep.split(';')[0] }} # [not win]
{% elif dep.startswith('cmake') %}
- {{ dep }}
{% elif dep.startswith('build>=') %}
- {{ 'python-' ~ dep }}
{% else %}
- {{ dep|replace('_','-') }}
{% endif %}
{% endfor %}
# versioneer dependency
- tomli # [py<311]
# Do not use pyproject.toml for setting dependencies on OneAPI packages
- mkl-devel-dpcpp >={{ required_compiler_and_mkl_version }},<{{ max_compiler_and_mkl_version }}
- onedpl-devel
- tbb-devel
- wheel
- scikit-build
build:
- {{ compiler('cxx') }}
- {{ compiler('dpcpp') }} >={{ required_compiler_and_mkl_version }},<{{ max_compiler_and_mkl_version }}
Expand Down
8 changes: 4 additions & 4 deletions doc/quick_start_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@ On Linux:

.. code-block:: bash

conda create -n build-env dpctl cython dpcpp_linux-64 mkl-devel-dpcpp tbb-devel \
onedpl-devel cmake scikit-build ninja pytest intel-gpu-ocl-icd-system \
conda create -n build-env dpctl cython dpcpp_linux-64 mkl-devel-dpcpp tbb-devel \
onedpl-devel cmake scikit-build ninja versioneer pytest intel-gpu-ocl-icd-system \
-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels
conda activate build-env

On Windows:

.. code-block:: bash

conda create -n build-env dpctl cython dpcpp_win-64 mkl-devel-dpcpp tbb-devel \
onedpl-devel cmake scikit-build ninja pytest intel-gpu-ocl-icd-system \
conda create -n build-env dpctl cython dpcpp_win-64 mkl-devel-dpcpp tbb-devel \
onedpl-devel cmake scikit-build ninja versioneer pytest intel-gpu-ocl-icd-system \
-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels
conda activate build-env

Expand Down
Loading
Loading