diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 971961f35469..9af07264e258 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @antonwolfy @AlexanderKalistratov @vlad-perevezentsev @vtavana @ndgrigorian +* @antonwolfy @vlad-perevezentsev @ndgrigorian diff --git a/.github/workflows/build-sphinx.yml b/.github/workflows/build-sphinx.yml index 26acd1646a52..a9ca25f426fe 100644 --- a/.github/workflows/build-sphinx.yml +++ b/.github/workflows/build-sphinx.yml @@ -26,6 +26,7 @@ jobs: name: Build and Deploy Docs runs-on: ubuntu-22.04 + timeout-minutes: 60 permissions: # Needed to cancel any previous runs that are not completed for a given workflow @@ -101,7 +102,7 @@ jobs: sudo apt-get install -y nvidia-cuda-toolkit clinfo - name: Checkout repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: 0 @@ -118,7 +119,7 @@ jobs: - name: Setup miniconda id: setup_miniconda continue-on-error: true - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -128,7 +129,7 @@ jobs: - name: ReSetup miniconda if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -244,9 +245,10 @@ jobs: pull-requests: write runs-on: ubuntu-latest + timeout-minutes: 10 steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: 0 diff --git a/.github/workflows/check-mkl-interfaces.yaml b/.github/workflows/check-onemath.yaml similarity index 73% rename from .github/workflows/check-mkl-interfaces.yaml rename to .github/workflows/check-onemath.yaml index 56e95b35366e..1f820c475d7c 100644 --- a/.github/workflows/check-mkl-interfaces.yaml +++ b/.github/workflows/check-onemath.yaml @@ -1,4 +1,4 @@ -name: Test oneMKL interfaces +name: Test oneAPI Math Library (oneMath) on: push: @@ -15,7 +15,8 @@ env: build-with-oneapi-env: 'environments/build_with_oneapi.yml' dpctl-pkg-env: 'environments/dpctl_pkg.yml' oneapi-pkgs-env: 'environments/oneapi_pkgs.yml' - test-env-name: 'test_onemkl_interfaces' + test-pkg-env: 'environments/test.yml' + test-env-name: 'test_onemath' rerun-tests-on-failure: 'true' rerun-tests-max-attempts: 2 rerun-tests-timeout: 20 @@ -29,6 +30,7 @@ jobs: actions: write runs-on: 'ubuntu-latest' + timeout-minutes: 5 steps: - name: Cancel Previous Runs @@ -37,7 +39,7 @@ jobs: access_token: ${{ github.token }} - name: Checkout DPNP repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: 0 @@ -48,7 +50,10 @@ jobs: - name: Merge conda env files run: | - conda-merge ${{ env.dpctl-pkg-env }} ${{ env.oneapi-pkgs-env }} ${{ env.build-with-oneapi-env }} > ${{ env.environment-file }} + conda-merge ${{ env.dpctl-pkg-env }} \ + ${{ env.oneapi-pkgs-env }} \ + ${{ env.build-with-oneapi-env }} \ + ${{ env.test-pkg-env }} > ${{ env.environment-file }} cat ${{ env.environment-file }} - name: Upload artifact @@ -58,32 +63,31 @@ jobs: path: ${{ env.environment-file }} test_by_tag: - name: Run tests with oneMKL tag + name: Run tests with OneMath tag needs: build_env_file strategy: fail-fast: false matrix: - # python 3.13 is blocked since BLAS requires "mkl<2025.0" (see https://github.com/conda-forge/blas-feedstock/pull/128 - # which depends on resolving MKL issue https://github.com/conda-forge/intel_repack-feedstock/issues/83) - python: ['3.12'] - os: [ubuntu-22.04] # windows-2019 - no DFT support for Windows in oneMKL + python: ['3.13'] + os: [ubuntu-22.04] # windows-2022 - no DFT support for Windows in oneMKL runs-on: ${{ matrix.os }} + timeout-minutes: 60 defaults: run: - shell: ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }} + shell: ${{ matrix.os == 'windows-2022' && 'cmd /C CALL {0}' || 'bash -el {0}' }} steps: - name: Checkout DPNP repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: 0 - name: Download artifact - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: ${{ env.environment-file-name }} path: ${{ env.environment-file-loc }} @@ -91,7 +95,7 @@ jobs: - name: Setup miniconda id: setup_miniconda continue-on-error: true - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -101,7 +105,7 @@ jobs: - name: ReSetup miniconda if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -116,7 +120,7 @@ jobs: - name: Build and install DPNP package run: | - python scripts/build_locally.py --onemkl-interfaces --verbose + python scripts/build_locally.py --onemath --verbose - name: Smoke test run: | @@ -148,41 +152,40 @@ jobs: SYCL_CACHE_PERSISTENT: 1 test_by_branch: - name: Run tests with oneMKL develop branch + name: Run tests with oneMath develop branch needs: build_env_file strategy: fail-fast: false matrix: - # python 3.13 is blocked since BLAS requires "mkl<2025.0" (see https://github.com/conda-forge/blas-feedstock/pull/128 - # which depends on resolving MKL issue https://github.com/conda-forge/intel_repack-feedstock/issues/83) - python: ['3.12'] - os: [ubuntu-22.04] # windows-2019 - no DFT support for Windows in oneMKL + python: ['3.13'] + os: [ubuntu-22.04] # windows-2022 - no DFT support for Windows in oneMKL runs-on: ${{ matrix.os }} + timeout-minutes: 60 defaults: run: - shell: ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }} + shell: ${{ matrix.os == 'windows-2022' && 'cmd /C CALL {0}' || 'bash -el {0}' }} env: onemkl-source-dir: '${{ github.workspace }}/onemkl/' steps: - name: Checkout DPNP repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: 0 - name: Download artifact - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: ${{ env.environment-file-name }} path: ${{ env.environment-file-loc }} - name: Checkout oneMKL repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: repository: 'oneapi-src/oneMKL' ref: 'develop' @@ -196,7 +199,7 @@ jobs: - name: Setup miniconda id: setup_miniconda continue-on-error: true - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -206,7 +209,7 @@ jobs: - name: ReSetup miniconda if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -221,7 +224,7 @@ jobs: - name: Build and install DPNP package run: | - python scripts/build_locally.py --onemkl-interfaces --onemkl-interfaces-dir=${{ env.onemkl-source-dir }} --verbose + python scripts/build_locally.py --onemath --onemath-dir=${{ env.onemkl-source-dir }} --verbose - name: Smoke test run: | diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index 958e7795973a..7c33bbe0a209 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -16,13 +16,11 @@ env: ver-script-part1: "import json; f = open('version.json', 'r'); j = json.load(f); f.close(); " ver-script-part2: "d = j['dpnp'][0]; print('='.join((d[s] for s in ('version', 'build'))))" fetch-depth: 1 - # python 3.13 is blocked since BLAS requires "mkl<2025.0" (see https://github.com/conda-forge/blas-feedstock/pull/128 - # which depends on resolving MKL issue https://github.com/conda-forge/intel_repack-feedstock/issues/83) - python-ver-test-all-dtypes: '3.12' + python-ver-test-all-dtypes: '3.13' test-env-name: 'test' rerun-tests-on-failure: 'true' rerun-tests-max-attempts: 2 - rerun-tests-timeout: 35 + rerun-tests-timeout: 40 jobs: build: @@ -31,20 +29,19 @@ jobs: strategy: fail-fast: false matrix: - # python 3.13 is blocked since BLAS requires "mkl<2025.0" (see https://github.com/conda-forge/blas-feedstock/pull/128 - # which depends on resolving MKL issue https://github.com/conda-forge/intel_repack-feedstock/issues/83) - python: ['3.9', '3.10', '3.11', '3.12'] - os: [ubuntu-22.04, windows-2019] + python: ['3.9', '3.10', '3.11', '3.12', '3.13'] + os: [ubuntu-22.04, windows-2022] permissions: # Needed to cancel any previous runs that are not completed for a given workflow actions: write runs-on: ${{ matrix.os }} + timeout-minutes: 60 defaults: run: - shell: ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }} + shell: ${{ matrix.os == 'windows-2022' && 'cmd /C CALL {0}' || 'bash -el {0}' }} env: build-conda-pkg-env: 'environments/build_conda_pkg.yml' @@ -57,14 +54,14 @@ jobs: access_token: ${{ github.token }} - name: Checkout DPNP repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: 0 - name: Setup miniconda id: setup_miniconda continue-on-error: true - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -74,7 +71,7 @@ jobs: - name: ReSetup miniconda if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -96,13 +93,13 @@ jobs: continue-on-error: true run: conda build --no-test --python ${{ matrix.python }} --numpy 2.0 ${{ env.channels-list }} conda-recipe env: - MAX_BUILD_CMPL_MKL_VERSION: '2025.2a0' + MAX_BUILD_CMPL_MKL_VERSION: '2025.3a0' - name: ReBuild conda package if: steps.build_conda_pkg.outcome == 'failure' run: conda build --no-test --python ${{ matrix.python }} --numpy 2.0 ${{ env.channels-list }} conda-recipe env: - MAX_BUILD_CMPL_MKL_VERSION: '2025.2a0' + MAX_BUILD_CMPL_MKL_VERSION: '2025.3a0' - name: Upload artifact uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 @@ -122,6 +119,7 @@ jobs: needs: build runs-on: ${{ matrix.os }} + timeout-minutes: 100 defaults: run: @@ -130,8 +128,7 @@ jobs: strategy: fail-fast: false matrix: - # python 3.13 is blocked due to MKL issue - python: ['3.9', '3.10', '3.11', '3.12'] + python: ['3.9', '3.10', '3.11', '3.12', '3.13'] os: [ubuntu-latest] env: @@ -143,13 +140,13 @@ jobs: steps: - name: Checkout DPNP repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: ${{ env.fetch-depth }} path: ${{ env.dpnp-repo-path }} - name: Download artifact - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: ${{ env.package-name }} ${{ runner.os }} Python ${{ matrix.python }} path: ${{ env.pkg-path-in-channel }} @@ -157,7 +154,7 @@ jobs: - name: Setup miniconda id: setup_miniconda continue-on-error: true - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -167,7 +164,7 @@ jobs: - name: ReSetup miniconda if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -191,10 +188,6 @@ jobs: echo PACKAGE_VERSION=${PACKAGE_VERSION} echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV - # conda-index does not support python 3.13, but we need to test DPNP package with python 3.13 - - name: Remove conda-index - run: mamba remove conda-index - - name: Install dpnp id: install_dpnp continue-on-error: true @@ -254,6 +247,7 @@ jobs: needs: build runs-on: ${{ matrix.os }} + timeout-minutes: 120 defaults: run: @@ -262,9 +256,8 @@ jobs: strategy: fail-fast: false matrix: - # python 3.13 is blocked due to MKL issue - python: ['3.9', '3.10', '3.11', '3.12'] - os: [windows-2019] + python: ['3.9', '3.10', '3.11', '3.12', '3.13'] + os: [windows-2022] env: dpnp-repo-path: '${{ github.workspace }}\source' @@ -275,13 +268,13 @@ jobs: steps: - name: Checkout DPNP repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: ${{ env.fetch-depth }} path: ${{ env.dpnp-repo-path }} - name: Download artifact - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: ${{ env.package-name }} ${{ runner.os }} Python ${{ matrix.python }} path: ${{ env.pkg-path-in-channel }} @@ -300,7 +293,7 @@ jobs: - name: Setup miniconda id: setup_miniconda continue-on-error: true - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -310,7 +303,7 @@ jobs: - name: ReSetup miniconda if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -324,10 +317,6 @@ jobs: (echo CONDA_LIB_PATH=%CONDA_PREFIX%\Library\lib\) >> %GITHUB_ENV% (echo CONDA_LIB_BIN_PATH=%CONDA_PREFIX%\Library\bin\) >> %GITHUB_ENV% - - name: Install conda-index - run: | - mamba install conda-index=${{ env.CONDA_INDEX_VERSION }} - - name: Create conda channel run: | @echo on @@ -351,10 +340,6 @@ jobs: echo PACKAGE_VERSION: %PACKAGE_VERSION% (echo PACKAGE_VERSION=%PACKAGE_VERSION%) >> %GITHUB_ENV% - # conda-index does not support python 3.13, but we need to test DPNP package with python 3.13 - - name: Remove conda-index - run: mamba remove conda-index - - name: Install dpnp run: | @echo on @@ -420,15 +405,15 @@ jobs: strategy: fail-fast: false matrix: - # python 3.13 is blocked due to MKL issue - python: ['3.9', '3.10', '3.11', '3.12'] - os: [ubuntu-22.04, windows-2019] + python: ['3.9', '3.10', '3.11', '3.12', '3.13'] + os: [ubuntu-22.04, windows-2022] runs-on: ${{ matrix.os }} + timeout-minutes: 10 defaults: run: - shell: ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }} + shell: ${{ matrix.os == 'windows-2022' && 'cmd /C CALL {0}' || 'bash -el {0}' }} env: upload-conda-pkg-env: 'environments/upload_cleanup_conda_pkg.yml' @@ -440,24 +425,24 @@ jobs: steps: - name: Checkout DPNP repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: ${{ env.fetch-depth }} - name: Download artifact - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: ${{ env.package-name }} ${{ runner.os }} Python ${{ matrix.python }} - name: Download wheels artifact - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: ${{ env.package-name }} ${{ runner.os }} Wheels Python ${{ matrix.python }} - name: Setup miniconda id: setup_miniconda continue-on-error: true - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -467,7 +452,7 @@ jobs: - name: ReSetup miniconda if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -506,6 +491,7 @@ jobs: os: [ubuntu-22.04] runs-on: ${{ matrix.os }} + timeout-minutes: 15 defaults: run: @@ -519,7 +505,7 @@ jobs: dpnp-repo-path: '${{ github.workspace }}/source/' array-api-skips-file: '${{ github.workspace }}/source/.github/workflows/array-api-skips.txt' create-conda-channel-env: 'source/environments/create_conda_channel.yml' - python-ver: '3.12' # it has to be aligned with python in create_conda_channel.yml + python-ver: '3.13' # it has to be aligned with python in create_conda_channel.yml conda-env-name: 'array-api-conformity' channel-path: '${{ github.workspace }}/channel/' pkg-path-in-channel: '${{ github.workspace }}/channel/linux-64/' @@ -527,13 +513,13 @@ jobs: steps: - name: Checkout DPNP repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: ${{ env.fetch-depth }} path: ${{ env.dpnp-repo-path }} - name: Download artifact - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: ${{ env.package-name }} ${{ runner.os }} Python ${{ env.python-ver }} path: ${{ env.pkg-path-in-channel }} @@ -541,7 +527,7 @@ jobs: - name: Setup miniconda id: setup_miniconda continue-on-error: true - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -551,7 +537,7 @@ jobs: - name: ReSetup miniconda if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -599,7 +585,7 @@ jobs: python -c "import dpnp; print(dpnp.__version__)" - name: Clone array API tests repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: repository: 'data-apis/array-api-tests' path: ${{ env.array-api-tests-path }} @@ -668,6 +654,7 @@ jobs: needs: [upload] runs-on: 'ubuntu-latest' + timeout-minutes: 10 defaults: run: @@ -679,14 +666,14 @@ jobs: steps: - name: Checkout DPNP repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: ${{ env.fetch-depth }} - name: Setup miniconda id: setup_miniconda continue-on-error: true - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -696,7 +683,7 @@ jobs: - name: ReSetup miniconda if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -705,7 +692,7 @@ jobs: activate-environment: ${{ env.cleanup-env-name }} - name: Checkout repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: repository: IntelPython/devops-tools fetch-depth: ${{ env.fetch-depth }} diff --git a/.github/workflows/cron-run-tests.yaml b/.github/workflows/cron-run-tests.yaml index f563534f53c0..786b711d6d56 100644 --- a/.github/workflows/cron-run-tests.yaml +++ b/.github/workflows/cron-run-tests.yaml @@ -1,13 +1,11 @@ name: Run tests suite on: - # For Branch-Protection check. Only the default branch is supported. See - # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection - branch_protection_rule: + # To be able to be triggered manually + workflow_dispatch: # To guarantee Maintained check is occasionally updated. See # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained schedule: - cron: '28 2 * * *' - workflow_dispatch: permissions: read-all @@ -26,10 +24,11 @@ jobs: if: github.event.repository.fork == false runs-on: ${{ matrix.runner }} + timeout-minutes: 60 defaults: run: - shell: ${{ matrix.runner == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }} + shell: ${{ matrix.runner == 'windows-2022' && 'cmd /C CALL {0}' || 'bash -el {0}' }} permissions: # Needed to cancel any previous runs that are not completed for a given workflow @@ -38,10 +37,20 @@ jobs: strategy: fail-fast: false matrix: - # python 3.13 is blocked since BLAS requires "mkl<2025.0" (see https://github.com/conda-forge/blas-feedstock/pull/128 - # which depends on resolving MKL issue https://github.com/conda-forge/intel_repack-feedstock/issues/83) - python: ['3.9', '3.10', '3.11', '3.12'] - runner: [ubuntu-22.04, ubuntu-24.04, windows-2019] + python: ['3.9', '3.10', '3.11', '3.12', '3.13'] + runner: [ubuntu-22.04, ubuntu-24.04, windows-2022] + include: + - python: 3.9 + # do not install scipy due to import issue + test-packages: "pytest" + - python: 3.10 + test-packages: "pytest scipy" + - python: 3.11 + test-packages: "pytest scipy" + - python: 3.12 + test-packages: "pytest scipy" + - python: 3.13 + test-packages: "pytest scipy" steps: - name: Cancel Previous Runs @@ -63,7 +72,7 @@ jobs: - name: Setup miniconda id: setup_miniconda continue-on-error: true - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -74,7 +83,7 @@ jobs: - name: ReSetup miniconda if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -87,18 +96,18 @@ jobs: id: install_dpnp continue-on-error: true run: | - mamba install ${{ env.package-name }}=${{ steps.find_latest_tag.outputs.tag }} pytest ${{ env.channels-list }} + mamba install ${{ env.package-name }}=${{ steps.find_latest_tag.outputs.tag }} ${{ matrix.test-packages }} ${{ env.channels-list }} - name: ReInstall dpnp if: steps.install_dpnp.outcome == 'failure' run: | - mamba install ${{ env.package-name }}=${{ steps.find_latest_tag.outputs.tag }} pytest ${{ env.channels-list }} + mamba install ${{ env.package-name }}=${{ steps.find_latest_tag.outputs.tag }} ${{ matrix.test-packages }} ${{ env.channels-list }} - name: List installed packages run: mamba list - name: Activate OCL CPU RT - if: matrix.runner == 'windows-2019' + if: matrix.runner == 'windows-2022' shell: pwsh run: | $script_path="$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1" @@ -125,7 +134,7 @@ jobs: SYCL_CACHE_PERSISTENT: 1 - name: ReRun tests on Linux - if: steps.run_tests.outcome == 'failure' && matrix.runner != 'windows-2019' + if: steps.run_tests.outcome == 'failure' && matrix.runner != 'windows-2022' id: run_tests_linux uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 with: @@ -142,7 +151,7 @@ jobs: SYCL_CACHE_PERSISTENT: 1 - name: ReRun tests on Windows - if: steps.run_tests.outcome == 'failure' && matrix.runner == 'windows-2019' + if: steps.run_tests.outcome == 'failure' && matrix.runner == 'windows-2022' id: run_tests_win uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 with: diff --git a/.github/workflows/generate_coverage.yaml b/.github/workflows/generate_coverage.yaml index 2866b41e66ca..10ea34c21806 100644 --- a/.github/workflows/generate_coverage.yaml +++ b/.github/workflows/generate_coverage.yaml @@ -9,7 +9,9 @@ permissions: read-all jobs: generate-coverage: name: Generate coverage and push to Coveralls.io + runs-on: ubuntu-latest + timeout-minutes: 120 permissions: # Needed to cancel any previous runs that are not completed for a given workflow @@ -23,6 +25,7 @@ jobs: environment-file: 'environments/environment.yml' build-with-oneapi-env: 'environments/build_with_oneapi.yml' coverage-env: 'environments/coverage.yml' + test-pkg-env: 'environments/test.yml' oneapi-pkgs-env: '' # Enable env when it's required to use only conda packages without OneAPI installation # oneapi-pkgs-env: '${{ github.workspace }}/environments/oneapi_pkgs.yml' @@ -60,7 +63,7 @@ jobs: sudo gem install coveralls-lcov - name: Checkout repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: 0 @@ -71,13 +74,16 @@ jobs: - name: Merge conda env files run: | - conda-merge ${{ env.build-with-oneapi-env }} ${{ env.coverage-env }} ${{ env.oneapi-pkgs-env }} > ${{ env.environment-file }} + conda-merge ${{ env.build-with-oneapi-env }} \ + ${{ env.coverage-env }} \ + ${{ env.oneapi-pkgs-env }} \ + ${{ env.test-pkg-env }} > ${{ env.environment-file }} cat ${{ env.environment-file }} - name: Setup miniconda id: setup_miniconda continue-on-error: true - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -87,7 +93,7 @@ jobs: - name: ReSetup miniconda if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 + uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0 with: miniforge-version: latest use-mamba: 'true' @@ -154,6 +160,7 @@ jobs: needs: generate-coverage runs-on: ubuntu-latest + timeout-minutes: 10 container: python:3-slim diff --git a/.github/workflows/openssf-scorecard.yml b/.github/workflows/openssf-scorecard.yml index 9f2441b84e3a..906a7cd957c7 100644 --- a/.github/workflows/openssf-scorecard.yml +++ b/.github/workflows/openssf-scorecard.yml @@ -7,13 +7,16 @@ on: # For Branch-Protection check. Only the default branch is supported. See # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection branch_protection_rule: + # To be able to be triggered manually + workflow_dispatch: # To guarantee Maintained check is occasionally updated. See # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained schedule: - cron: '28 2 * * 1' - cron: '28 2 * * 4' push: - branches: [ "master" ] + branches: + - master # Declare default permissions as read only. permissions: read-all @@ -22,6 +25,7 @@ jobs: analysis: name: Scorecard analysis runs-on: ubuntu-latest + timeout-minutes: 10 permissions: # Needed to upload the results to code-scanning dashboard. security-events: write @@ -33,12 +37,12 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1 + uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2 with: results_file: results.sarif results_format: sarif @@ -68,6 +72,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18 + uses: github/codeql-action/upload-sarif@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5 with: sarif_file: results.sarif diff --git a/.github/workflows/pre-commit-autoupdate.yml b/.github/workflows/pre-commit-autoupdate.yml new file mode 100644 index 000000000000..aef5e16daad1 --- /dev/null +++ b/.github/workflows/pre-commit-autoupdate.yml @@ -0,0 +1,50 @@ +name: Autoupdate pre-commit + +on: + # To be able to be triggered manually + workflow_dispatch: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '28 2 * * 6' # Saturday at 02:28 UTC + +permissions: read-all + +jobs: + autoupdate: + name: Autoupdate + + runs-on: ubuntu-latest + timeout-minutes: 10 + + permissions: + # Needed to create a PR with autoupdate changes + contents: write + pull-requests: write + + steps: + - name: Checkout DPNP repo + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - name: Set up python + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 + with: + python-version: '3.13' + + - name: Install pre-commit + run: pip install pre-commit + + - name: Run pre-commit autoupdate + run: pre-commit autoupdate + + - name: Create a PR with autoupdate changes + uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e #v7.0.8 + with: + commit-message: 'chore: update pre-commit hooks' + add-paths: .pre-commit-config.yaml + branch: 'bot/pre-commit-autoupdate' + delete-branch: true + title: Weekly pre-commit autoupdate + body: | + This PR updates the `.pre-commit-config.yaml` using `pre-commit autoupdate`. + labels: autoupdate diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 7b1b9146a44a..d1d2dbbae21a 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,4 +1,4 @@ -name: pre-commit +name: Run pre-commit on: pull_request: @@ -9,7 +9,11 @@ permissions: read-all jobs: pre-commit: + name: Check + runs-on: ubuntu-22.04 + timeout-minutes: 10 + steps: - name: Set up clang-format run: | @@ -26,10 +30,13 @@ jobs: pylint - name: Checkout DPNP repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + # use commit hash to make "no-commit-to-branch" check passing + ref: ${{ github.sha }} - name: Set up python - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 with: python-version: '3.13' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c1b902dc886f..a47715f4eb9b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,20 +2,29 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/PyCQA/bandit - rev: '1.8.3' + rev: '1.8.6' hooks: - id: bandit pass_filenames: false args: ["-r", "dpnp", "-lll"] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: + # Git + - id: check-added-large-files + - id: no-commit-to-branch + name: "ensure no direct commit to master/maintenance branches" + args: [--branch, "master", --pattern, "maintenance/.*"] + - id: check-case-conflict + - id: check-illegal-windows-names + # Contents - id: check-ast - id: check-builtin-literals - id: check-case-conflict - id: check-executables-have-shebangs - id: check-merge-conflict - id: check-shebang-scripts-are-executable + - id: check-symlinks - id: check-toml - id: debug-statements - id: destroyed-symlinks @@ -51,7 +60,7 @@ repos: additional_dependencies: - tomli - repo: https://github.com/psf/black - rev: 25.1.0 + rev: 25.9.0 hooks: - id: black exclude: "dpnp/_version.py" @@ -68,7 +77,7 @@ repos: name: isort (pyi) types: [pyi] - repo: https://github.com/pycqa/flake8 - rev: 7.2.0 + rev: 7.3.0 hooks: - id: flake8 args: ["--config=.flake8"] @@ -81,7 +90,7 @@ repos: - id: clang-format args: ["-i"] - repo: https://github.com/gitleaks/gitleaks - rev: v8.26.0 + rev: v8.28.0 hooks: - id: gitleaks - repo: https://github.com/jumanjihouse/pre-commit-hooks @@ -104,9 +113,9 @@ repos: "--disable=redefined-builtin", "--disable=unused-wildcard-import" ] - files: '^dpnp/(dpnp_iface.*|fft|linalg)' + files: '^dpnp/(dpnp_iface.*|fft|linalg|scipy|dpnp_array)' - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.14.0 + rev: v2.15.0 hooks: - id: pretty-format-toml args: [--autofix] diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e990a601331..e69c47fd5ed1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,104 @@ # Changelog All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.18.0] - 05/DD/2025 +## [0.19.0] - 2025-10-06 + +This release introduces a set of new `dpnp.ndarray` methods and SciPy-compatible functions to improve CuPy compatibility. +It also enhances the performance of existing functions and improves documentation completeness. +Additionally, it extends support for building `dpnp` from the source for NVIDIA GPUs, with optional architecture selection. +This release is compatible with NumPy 2.3.3. + +### Added + +* Added `--target-cuda[=ARCH]` option to replace the deprecated `--target=cuda`, allowing users to build for CUDA devices with optional architecture selection using [CodePlay oneAPI plug-in](https://developer.codeplay.com/products/oneapi/nvidia/home/) [#2478](https://github.com/IntelPython/dpnp/pull/2478) +* Added several new `pre-commit` rules, including protection against direct commits to master/maintenance branches [#2500](https://github.com/IntelPython/dpnp/pull/2500) +* Added implementation of `dpnp.ndarray.view` method [#2520](https://github.com/IntelPython/dpnp/pull/2520) +* Added a new backend routine `syrk` from oneMKL to perform symmetric rank-k update which is used for a specialized matrix multiplication where the result is a symmetric matrix [2509](https://github.com/IntelPython/dpnp/pull/2509) +* Added `timeout-minutes` property to GitHub jobs [#2526](https://github.com/IntelPython/dpnp/pull/2526) +* Added implementation of `dpnp.ndarray.data` and `dpnp.ndarray.data.ptr` attributes [#2521](https://github.com/IntelPython/dpnp/pull/2521) +* Added `dpnp.ndarray.__contains__` method [#2534](https://github.com/IntelPython/dpnp/pull/2534) +* Added implementation of `dpnp.linalg.lu_factor` (SciPy-compatible) [#2557](https://github.com/IntelPython/dpnp/pull/2557), [#2565](https://github.com/IntelPython/dpnp/pull/2565) +* Added implementation of `dpnp.piecewise` [#2550](https://github.com/IntelPython/dpnp/pull/2550) +* Added implementation of `dpnp.linalg.lu_solve` for 2D inputs (SciPy-compatible) [#2575](https://github.com/IntelPython/dpnp/pull/2575) +* Added implementation of `dpnp.special.erfc` [#2588](https://github.com/IntelPython/dpnp/pull/2588) +* Added `dpnp.scipy` submodule to aggregate new SciPy-compatible functions from `linalg` and `special` namespaces [#2603](https://github.com/IntelPython/dpnp/pull/2603) + +### Changed + +* Adjusted the `pre-commit` configuration to run autoupdate weekly [#2479](https://github.com/IntelPython/dpnp/pull/2479) +* Improved validation of `--target-hip` build option to only accept a gfx-prefixed value [#2481](https://github.com/IntelPython/dpnp/pull/2481) +* Simplifies backend implementation of `dpnp.kaiser` by getting rid of unnecessary template [#2472](https://github.com/IntelPython/dpnp/pull/2472) +* `--onemkl-interfaces` and `--onemkl-interfaces-dir` options for building script are deprecated, instead `--onemath` and `--onemath-dir` are introduced to be aligned with [oneMath specification](https://oneapi-spec.uxlfoundation.org/specifications/oneapi/latest/elements/onemath/source/) [#2487](https://github.com/IntelPython/dpnp/pull/2487) +* Clarified description of `xp` keyword in docstring of `dpnp.interp` [#2506](https://github.com/IntelPython/dpnp/pull/2506) +* Updated existing GitHub workflows to add testing with Python 3.13 [#2510](https://github.com/IntelPython/dpnp/pull/2510) +* Aligned the license expression with `PEP-639` [#2511](https://github.com/IntelPython/dpnp/pull/2511) +* Bumped oneMKL version up to `v0.8` [#2514](https://github.com/IntelPython/dpnp/pull/2514) +* Removed the use of class template argument deduction for alias template to conform to the C++17 standard [#2517](https://github.com/IntelPython/dpnp/pull/2517) +* Changed the order of individual FFTs over `axes` for `dpnp.fft.irfftn` to be in forward order [#2524](https://github.com/IntelPython/dpnp/pull/2524) +* Replaced the use of `numpy.testing.suppress_warnings` with appropriate calls from the warnings module [#2529](https://github.com/IntelPython/dpnp/pull/2529) +* Improved documentations of `dpnp.ndarray` class and added a page with description of supported constants [#2422](https://github.com/IntelPython/dpnp/pull/2422) +* Updated `dpnp.size` to accept tuple of ints for `axes` argument [#2536](https://github.com/IntelPython/dpnp/pull/2536) +* Replaced `ci` section in `.pre-commit-config.yaml` with a new GitHub workflow with scheduled run to autoupdate the `pre-commit` configuration [#2542](https://github.com/IntelPython/dpnp/pull/2542) +* FFT module is updated to perform in-place FFT in intermediate steps of ND FFT [#2543](https://github.com/IntelPython/dpnp/pull/2543) +* Reused dpctl tensor include to enable experimental SYCL namespace for complex types [#2546](https://github.com/IntelPython/dpnp/pull/2546) +* Changed Windows-specific logic in dpnp initialization [#2553](https://github.com/IntelPython/dpnp/pull/2553) +* Added missing includes to files in ufunc and VM pybind11 extensions [#2571](https://github.com/IntelPython/dpnp/pull/2571) +* Refactored backend implementation of `dpnp.linalg.solve` to use oneMKL LAPACK `gesv` directly [#2558](https://github.com/IntelPython/dpnp/pull/2558) +* Improved performance of `dpnp.isclose` function by implementing a dedicated kernel for scalar `rtol` and `atol` arguments [#2540](https://github.com/IntelPython/dpnp/pull/2540) +* Extended `dpnp.pad` to support `pad_width` keyword as a dictionary [#2535](https://github.com/IntelPython/dpnp/pull/2535) +* Redesigned `dpnp.erf` function through pybind11 extension of OneMKL call or dedicated kernel in `ufunc` namespace [#2551](https://github.com/IntelPython/dpnp/pull/2551) +* Improved performance of batched implementation of `dpnp.linalg.det` and `dpnp.linalg.slogdet` [#2572](https://github.com/IntelPython/dpnp/pull/2572) +* Improved documentations of `dpnp.tril_indices` and `dpnp.triu_indices` to clarify the returned order of indices [#2586](https://github.com/IntelPython/dpnp/pull/2586) +* `dpnp` uses pybind11 3.0.1 [#2594](https://github.com/IntelPython/dpnp/pull/2594) + +### Deprecated + +* `--onemkl-interfaces` and `--onemkl-interfaces-dir` options for building script are deprecated, instead `--onemath` and `--onemath-dir` are introduced to be aligned with [oneMath specification](https://oneapi-spec.uxlfoundation.org/specifications/oneapi/latest/elements/onemath/source/) [#2487](https://github.com/IntelPython/dpnp/pull/2487) + +### Removed + +* Cleaned up backend code to remove obsolete and unused parts of functionality [#2485](https://github.com/IntelPython/dpnp/pull/2485) + +### Fixed + +* Updated `pre-commit` GitHub workflow to pass `no-commit-to-branch` check [#2501](https://github.com/IntelPython/dpnp/pull/2501) +* Updated the math formulas in summary of `dpnp.matvec` and `dpnp.vecmat` to correct a typo [#2503](https://github.com/IntelPython/dpnp/pull/2503) +* Avoided negating unsigned integers in ceil division used in `dpnp.resize` implementation [#2508](https://github.com/IntelPython/dpnp/pull/2508) +* Fixed `dpnp.unique` with 1d input array and `axis=0`, `equal_nan=True` keywords passed where the produced result doesn't collapse the NaNs [#2530](https://github.com/IntelPython/dpnp/pull/2530), [#2587](https://github.com/IntelPython/dpnp/pull/2587) +* Resolved issue when `dpnp.ndarray` constructor is called with `dpnp.ndarray.data` as `buffer` keyword [#2533](https://github.com/IntelPython/dpnp/pull/2533) +* Fixed `dpnp.linalg.cond` to always return a real dtype [#2547](https://github.com/IntelPython/dpnp/pull/2547) +* Resolved the issue in `dpnp.random` functions to allow any value of `size` where each element is castable to `Py_ssize_t` type [#2578](https://github.com/IntelPython/dpnp/pull/2578) +* Resolved `conda build --test` issue in python 3.9 environment [#2583](https://github.com/IntelPython/dpnp/pull/2583) +* Fixed tests for the rounding functions to depend on minimum required numpy version [#2589](https://github.com/IntelPython/dpnp/pull/2589) +* Fixed tests for the ufuncs to depend on minimum required numpy version [#2590](https://github.com/IntelPython/dpnp/pull/2590) +* Added missing permission definition in `Autoupdate pre-commit` GitHub workflow [#2591](https://github.com/IntelPython/dpnp/pull/2591) +* Resolved issue with the cyclic import in `linalg` submodule [#2608](https://github.com/IntelPython/dpnp/pull/2608) + +### Security + +## [0.18.1] - 2025-06-24 + +This release achieves `dpnp` compatibility with Python 3.13 and enables distributing `dpnp` packages with the latest Python version. +Moreover, the release provides compatibility with NumPy 2.3.0 and includes several bug fixes. + +### Added + +* Enabled support of Python 3.13 [#2490](https://github.com/IntelPython/dpnp/pull/2490) + +### Changed + +* Updated the tests scope to exclude several `matmul` tests in case of numpy 2.3.0 due to known NumPy issue [#2495](https://github.com/IntelPython/dpnp/pull/2495) + +### Fixed + +* Fixed a bug for calculating the norm (`dpnp.linalg.norm`) of empty arrays when `keepdims=True` is passed [#2477](https://github.com/IntelPython/dpnp/pull/2477) +* Updated the tests for hyperbolic and trigonometric elementwise functions to set correct tolerance for `float16` dtype [#2483](https://github.com/IntelPython/dpnp/pull/2483) + + +## [0.18.0] - 2025-06-04 This release achieves 100% compliance with Python Array API specification (revision [2024.12](https://data-apis.org/array-api/2024.12/)). The release provides enhanced compatibility with NumPy 2.2.5. Window and mathematical routines are complemented by a set of new functions. @@ -18,6 +112,8 @@ Moreover, it adds support to build `dpnp` from the source for AMD GPUs. * Added implementation of `dpnp.bartlett` [#2366](https://github.com/IntelPython/dpnp/pull/2366) * Added implementation of `dpnp.convolve` [#2205](https://github.com/IntelPython/dpnp/pull/2205) * Added implementation of `dpnp.kaiser` [#2387](https://github.com/IntelPython/dpnp/pull/2387) +* Added implementation of `dpnp.bitwise_count` [#2308](https://github.com/IntelPython/dpnp/pull/2308) +* Added implementation of `dpnp.common_type` [#2391](https://github.com/IntelPython/dpnp/pull/2391) * Added implementation of `dpnp.interp` [#2417](https://github.com/IntelPython/dpnp/pull/2417) * Added support to build `dpnp` for specified AMD GPU architecture using [CodePlay oneAPI plug-in](https://developer.codeplay.com/products/oneapi/amd/home/) [#2302](https://github.com/IntelPython/dpnp/pull/2302) @@ -35,7 +131,7 @@ Moreover, it adds support to build `dpnp` from the source for AMD GPUs. * Updated `dpnp.outer` to return the same dtype as NumPy when multiplying an array with a scalar [#2295](https://github.com/IntelPython/dpnp/pull/2295) * Changed `"max dimensions"` to `None` in array API capabilities [#2432](https://github.com/IntelPython/dpnp/pull/2432) * Updated kernel header `i0.hpp` to expose `cyl_bessel_i0` function depending on build target [#2440](https://github.com/IntelPython/dpnp/pull/2440) -* Added MKL functions `arg`, `copysign`, `i0`, and `inv` from VM namespace to be used by implementation of the appropriate element-wise functions [#2445](https://github.com/IntelPython/dpnp/pull/2445) +* Added MKL functions `arg`, `copysign`, `i0`, and `inv` from VM namespace to be used by implementation of the appropriate elementwise functions [#2445](https://github.com/IntelPython/dpnp/pull/2445) * Clarified details about conda install instructions in `Quick start quide` and `README` [#2446](https://github.com/IntelPython/dpnp/pull/2446) * Bumped oneMKL version up to `0.7` [#2448](https://github.com/IntelPython/dpnp/pull/2448) * The parameter `axis` in `dpnp.take_along_axis` function has now a default value of `-1` [#2442](https://github.com/IntelPython/dpnp/pull/2442) @@ -43,7 +139,7 @@ Moreover, it adds support to build `dpnp` from the source for AMD GPUs. * 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) -* Added a clarification to `dpnp.linalg.cond` docstring about its behavior with singular matrices [#2500] (https://github.com/IntelPython/dpnp/pull/2500) +* Added a clarification to `dpnp.linalg.cond` docstring about its behavior with singular matrices [#2460](https://github.com/IntelPython/dpnp/pull/2460) ### Fixed @@ -52,9 +148,10 @@ Moreover, it adds support to build `dpnp` from the source for AMD GPUs. * Added handling of empty string passed to a test env variable defining data type scope as a `False` value [#2415](https://github.com/IntelPython/dpnp/pull/2415) * Resolved build issues on non-Intel targets in `dpnp.i0` and `dpnp.kaiser` [#2439](https://github.com/IntelPython/dpnp/pull/2439) * Ensure consistency in the `dpnp.linalg.LinAlgError` exception raised on singular input matrices for both non-batched and batched cases in `dpnp.linalg.inv` [#2458] (https://github.com/IntelPython/dpnp/pull/2458) +* Updated test f/w to correct a check of array interface while converting to `numpy.ndarray` for comparison [#2467] (https://github.com/IntelPython/dpnp/pull/2467) -## [0.17.0] - 02/26/2025 +## [0.17.0] - 2025-02-26 This release achieves 100% compliance with Python Array API specification (revision [2023.12](https://data-apis.org/array-api/2023.12/)). The release provides enhanced compatibility with NumPy 2.2.3. Array manipulation, mathematical, logic, and statistics routines are complemented by a set of new functions. @@ -155,21 +252,21 @@ Furthermore, a number of issues relating to running on NVIDIA GPUs have been res * Added a workaround to prevent a memory corruption in `dpnp.correlate` [#2333](https://github.com/IntelPython/dpnp/pull/2333) -## [0.16.3] - 12/20/2024 +## [0.16.3] - 2024-12-20 ### Fixed * Bumped min version of DPC++ compiler required to support experimental SYCL properties [#2231](https://github.com/IntelPython/dpnp/pull/2231) -## [0.16.2] - 12/20/2024 +## [0.16.2] - 2024-12-20 ### Fixed * Enabled `dpnp` in virtual environment on Windows platform [#2242](https://github.com/IntelPython/dpnp/pull/2242) -## [0.16.1] - 12/06/2024 +## [0.16.1] - 2024-12-06 This is a bug-fix release. @@ -189,7 +286,7 @@ This is a bug-fix release. * Resolved a compilation error when building with DPC++ 2025.1 compiler [#2211](https://github.com/IntelPython/dpnp/pull/2211) -## [0.16.0] - 10/14/2024 +## [0.16.0] - 2024-10-14 This release reaches an important milestone by making offloading fully asynchronous. Calls to `dpnp` submit tasks for execution to DPC++ runtime and return without waiting for execution of these tasks to finish. The sequential semantics a user comes to expect from execution of Python script is preserved though. In addition, this release completes implementation of `dpnp.fft` module and adds several new array manipulation, indexing and elementwise routines. Moreover, it adds support to build `dpnp` for Nvidia GPUs. @@ -306,7 +403,7 @@ In addition, this release completes implementation of `dpnp.fft` module and adds * Resolved compilation warning and error while building in debug mode [#2066](https://github.com/IntelPython/dpnp/pull/2066) * Fixed an issue with asynchronous execution in `dpnp.fft` module [#2067](https://github.com/IntelPython/dpnp/pull/2067) -## [0.15.0] - 05/25/2024 +## [0.15.0] - 2024-05-25 This release completes implementation of `dpnp.linalg` module and array creation routine, adds cumulative reductions and histogram functions. @@ -375,7 +472,7 @@ and added implementation of `dpnp.mask_indices` function [#1814](https://github. * Resolved an unexpected `ValueError` exception raised from `dpnp.linalg.pinv` due to a shape issue in `dpnp.matmul` [#1843](https://github.com/IntelPython/dpnp/pull/1843) -## [0.14.0] - 02/16/2024 +## [0.14.0] - 2024-02-16 This release will require DPC++ `2024.1.0`, which no longer supports Intel Gen9 integrated GPUs found in Intel CPUs of 10th generation and older. @@ -453,7 +550,7 @@ This release will require DPC++ `2024.1.0`, which no longer supports Intel Gen9 * Improved performance of `dpnp.atleast_2d` and `dpnp.atleast_3d` functions and fixed to return a correct shape of resulting array [#1560](https://github.com/IntelPython/dpnp/pull/1560) -## [0.13.0] - 09/29/2023 +## [0.13.0] - 2023-09-29 ### Added @@ -515,7 +612,7 @@ This release will require DPC++ `2024.1.0`, which no longer supports Intel Gen9 * Resolved issues with running statistics functions on a device without fp64 support [#1494](https://github.com/IntelPython/dpnp/pull/1494) -## [0.12.1] - 07/18/2023 +## [0.12.1] - 2023-07-18 ### Added @@ -548,7 +645,7 @@ This release will require DPC++ `2024.1.0`, which no longer supports Intel Gen9 * Resolved a compilation warning with `std::getenv()` call on Windows [#1452](https://github.com/IntelPython/dpnp/pull/1452) * Corrected a link to OneAPI Toolkit in Installation Guide [#1445](https://github.com/IntelPython/dpnp/pull/1445) -## [0.12.0] - 06/15/2023 +## [0.12.0] - 2023-06-15 ### Added diff --git a/CMakeLists.txt b/CMakeLists.txt index c9d526cf47f9..cec18151f7f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.21...3.27 FATAL_ERROR) project(dpnp - VERSION 0.18 + VERSION 0.19 LANGUAGES CXX DESCRIPTION "NumPy-like API accelerated by SYCL." ) @@ -53,8 +53,8 @@ include(GNUInstallDirs) include(FetchContent) FetchContent_Declare( pybind11 - URL https://github.com/pybind/pybind11/archive/refs/tags/v2.13.6.tar.gz - URL_HASH SHA256=e08cb87f4773da97fa7b5f035de8763abc656d87d5773e62f6da0587d1f0ec20 + URL https://github.com/pybind/pybind11/archive/refs/tags/v3.0.1.tar.gz + URL_HASH SHA256=741633da746b7c738bb71f1854f957b9da660bcd2dce68d71949037f0969d0ca FIND_PACKAGE_ARGS NAMES pybind11 ) FetchContent_MakeAvailable(pybind11) @@ -68,48 +68,68 @@ find_package(Dpctl REQUIRED) message(STATUS "Dpctl_INCLUDE_DIR=" ${Dpctl_INCLUDE_DIR}) message(STATUS "Dpctl_TENSOR_INCLUDE_DIR=" ${Dpctl_TENSOR_INCLUDE_DIR}) -option(DPNP_TARGET_CUDA - "Build DPNP to target CUDA devices" +option(DPNP_USE_ONEMATH + "Build DPNP with oneMath" OFF ) -option(DPNP_USE_ONEMKL_INTERFACES - "Build DPNP with oneMKL Interfaces" - OFF +set(DPNP_TARGET_CUDA + "" + CACHE STRING + "Build DPNP to target CUDA device. \ +Set to a truthy value (e.g., ON, TRUE) to use default architecture (sm_50), \ +or to a specific architecture like sm_80." ) set(HIP_TARGETS "" CACHE STRING "HIP architecture for target") set(_dpnp_sycl_targets) -set(_use_onemkl_interfaces OFF) -set(_use_onemkl_interfaces_cuda OFF) -set(_use_onemkl_interfaces_hip OFF) +set(_use_onemath OFF) +set(_use_onemath_cuda OFF) +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) - set(_dpnp_sycl_targets "nvptx64-nvidia-cuda,spir64-unknown-unknown") - set(_use_onemkl_interfaces_cuda ON) + 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 + "Invalid value for DPNP_TARGET_CUDA: \"${DPNP_TARGET_CUDA}\". " + "Expected 'ON', 'TRUE', 'YES', 'Y', '1', or a CUDA architecture like 'sm_80'." + ) + endif() + set(_dpnp_sycl_targets "nvidia_gpu_${_dpnp_cuda_arch},spir64-unknown-unknown") + set(_use_onemath_cuda ON) endif() - if (NOT "x${HIP_TARGETS}" STREQUAL "x") - set(_use_onemkl_interfaces_hip ON) - - if ("x${_dpnp_sycl_targets}" STREQUAL "x") - set(_dpnp_sycl_targets "amd_gpu_${HIP_TARGETS},spir64-unknown-unknown") + 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() - set(_dpnp_sycl_targets "amd_gpu_${HIP_TARGETS},${_dpnp_sycl_targets}") + message(FATAL_ERROR + "Invalid value for HIP_TARGETS: \"${HIP_TARGETS}\". " + "Expected an architecture name starting with 'gfx', e.g. 'gfx1030'." + ) endif() endif() else() set(_dpnp_sycl_targets ${DPNP_SYCL_TARGETS}) - if ("${DPNP_SYCL_TARGETS}" MATCHES "nvptx64-nvidia-cuda") - set(_use_onemkl_interfaces_cuda ON) + if("${DPNP_SYCL_TARGETS}" MATCHES "(nvidia_gpu_sm_|nvptx64-nvidia-cuda)") + set(_use_onemath_cuda ON) endif() if ("${DPNP_SYCL_TARGETS}" MATCHES "amd_gpu_") - set(_use_onemkl_interfaces_hip ON) + set(_use_onemath_hip ON) if ("x${HIP_TARGETS}" STREQUAL "x") message(FATAL_ERROR "HIP_TARGETS must be specified when using HIP backend") @@ -130,58 +150,58 @@ if (_dpnp_sycl_targets) list(APPEND _dpnp_sycl_target_link_options -fsycl-targets=${_dpnp_sycl_targets}) endif() -if(DPNP_USE_ONEMKL_INTERFACES) - set(_use_onemkl_interfaces ON) +if(DPNP_USE_ONEMATH) + set(_use_onemath ON) else() - if(DEFINED ENV{DPNP_USE_ONEMKL_INTERFACES}) - set(_use_onemkl_interfaces ON) + if(DEFINED ENV{DPNP_USE_ONEMATH}) + set(_use_onemath ON) endif() endif() -if(_use_onemkl_interfaces) +if(_use_onemath) set(BUILD_FUNCTIONAL_TESTS False) set(BUILD_EXAMPLES False) set(ENABLE_MKLGPU_BACKEND True) set(ENABLE_MKLCPU_BACKEND True) - if(_use_onemkl_interfaces_cuda) + if(_use_onemath_cuda) set(ENABLE_CUBLAS_BACKEND True) set(ENABLE_CUSOLVER_BACKEND True) set(ENABLE_CUFFT_BACKEND True) # set(ENABLE_CURAND_BACKEND True) endif() - if(_use_onemkl_interfaces_hip) + if(_use_onemath_hip) set(ENABLE_ROCBLAS_BACKEND True) set(ENABLE_ROCSOLVER_BACKEND True) set(ENABLE_ROCFFT_BACKEND True) # set(ENABLE_ROCRAND_BACKEND True) endif() - if(DPNP_ONEMKL_INTERFACES_DIR) - FetchContent_Declare(onemath_library SOURCE_DIR "${DPNP_ONEMKL_INTERFACES_DIR}") + if(DPNP_ONEMATH_DIR) + FetchContent_Declare(onemath_library SOURCE_DIR "${DPNP_ONEMATH_DIR}") else() FetchContent_Declare( onemath_library GIT_REPOSITORY https://github.com/uxlfoundation/oneMath.git - GIT_TAG 20ba6fd7ae4af6ed693246cfd22c343e6522edbe # v0.7 + GIT_TAG 5c7e1e7a710556e51f70ecc8dd26dfd04e3abf41 # v0.8 ) endif() FetchContent_MakeAvailable(onemath_library) if(TARGET onemath) - set(MKL_INTERFACES_LIB "onemath" CACHE INTERNAL "OneMath lib target") + set(ONEMATH_LIB "onemath" CACHE INTERNAL "OneMath lib target") elseif(TARGET onemkl) - set(MKL_INTERFACES_LIB "onemkl" CACHE INTERNAL "OneMKL lib target") + set(ONEMATH_LIB "onemkl" CACHE INTERNAL "OneMKL lib target") else() message(FATAL_ERROR "Neither 'oneMath' nor 'oneMKL' found!") endif() - message(STATUS "MKL interfaces lib target used: ${MKL_INTERFACES_LIB}") + message(STATUS "OneMath lib target used: ${ONEMATH_LIB}") set(CMAKE_INSTALL_RPATH "${CMAKE_BINARY_DIR}/lib") else() - if(_use_onemkl_interfaces_cuda OR _use_onemkl_interfaces_hip) + if(_use_onemath_cuda OR _use_onemath_hip) message(FATAL_ERROR - "CUDA or HIP targets are enabled, but oneMKL Interfaces are not. " - "Please set DPNP_USE_ONEMKL_INTERFACES=ON to enable them." + "CUDA or HIP targets are enabled, but oneMath is not. " + "Please set DPNP_USE_ONEMATH=ON to enable them." ) endif() endif() diff --git a/conda-recipe/conda_build_config.yaml b/conda-recipe/conda_build_config.yaml index 0f1e1f9078f8..c5df1a7f2e29 100644 --- a/conda-recipe/conda_build_config.yaml +++ b/conda-recipe/conda_build_config.yaml @@ -1,2 +1,18 @@ numpy: - - 1.23 + - '1.26' +c_compiler: # [linux] + - gcc # [linux] +cxx_compiler: # [linux] + - gxx # [linux] +cxx_compiler_version: # [linux] + - '14' # [linux] +c_stdlib: # [linux] + - sysroot # [linux] +c_stdlib_version: # [linux] + - '2.28' # [linux] +c_stdlib: # [win] + - vs # [win] +cxx_compiler: # [win] + - vs2022 # [win] +c_compiler: # [win] + - vs2022 # [win] diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 22af5f008979..af96e710de41 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -1,6 +1,6 @@ {% set max_compiler_and_mkl_version = environ.get("MAX_BUILD_CMPL_MKL_VERSION", "2026.0a0") %} {% set required_compiler_and_mkl_version = "2025.0" %} -{% set required_dpctl_version = "0.20.0*" %} +{% set required_dpctl_version = "0.21.0" %} {% set pyproject = load_file_data('pyproject.toml') %} {% set py_build_deps = pyproject.get('build-system', {}).get('requires', []) %} @@ -37,8 +37,8 @@ requirements: - tbb-devel build: - {{ compiler('cxx') }} + - {{ stdlib('c') }} - {{ compiler('dpcpp') }} >={{ required_compiler_and_mkl_version }},<{{ max_compiler_and_mkl_version }} - - sysroot_linux-64 >=2.28 # [linux] run: - python - {{ pin_compatible('dpctl', min_pin='x.x.x', max_pin=None) }} @@ -63,6 +63,7 @@ test: requires: - pytest - setuptools + - scipy # [py>39] about: home: https://github.com/IntelPython/dpnp @@ -82,7 +83,5 @@ about: extra: recipe-maintainers: - antonwolfy - - AlexanderKalistratov - - vtavana - vlad-perevezentsev - ndgrigorian diff --git a/doc/quick_start_guide.rst b/doc/quick_start_guide.rst index 0e6f9dca74e2..8aa86fd8e88f 100644 --- a/doc/quick_start_guide.rst +++ b/doc/quick_start_guide.rst @@ -24,7 +24,7 @@ Follow device driver installation instructions to complete the step. Python Interpreter ================== -You will need Python 3.9, 3.10, 3.11 or 3.12 installed on your system. If you +You will need Python 3.9, 3.10, 3.11, 3.12 or 3.13 installed on your system. If you do not have one yet the easiest way to do that is to install `Intel Distribution for Python*`_. It installs all essential Python numerical and machine learning packages optimized for the Intel hardware, including @@ -144,13 +144,40 @@ installation layout of compatible version. The following plugins from CodePlay a Building ``dpnp`` also requires `building Data Parallel Control Library for custom SYCL targets. `_ -``dpnp`` can be built for CUDA devices as follows: +Builds for CUDA and AMD devices internally use SYCL alias targets that are passed to the compiler. +A full list of available SYCL alias targets is available in the +`DPC++ Compiler User Manual `_. + +CUDA build +~~~~~~~~~~ + +To build for CUDA devices, use the ``--target-cuda`` argument. + +To target a specific architecture (e.g., ``sm_80``): + +.. code-block:: bash + + python scripts/build_locally.py --target-cuda=sm_80 + +To use the default architecture (``sm_50``), run: .. code-block:: bash - python scripts/build_locally.py --target=cuda + python scripts/build_locally.py --target-cuda + +Note that kernels are built for the default architecture (``sm_50``), allowing them to work on a +wider range of architectures, but limiting the usage of more recent CUDA features. + +For reference, compute architecture strings like ``sm_80`` correspond to specific +CUDA Compute Capabilities (e.g., Compute Capability 8.0 corresponds to ``sm_80``). +A complete mapping between NVIDIA GPU models and their respective +Compute Capabilities can be found in the official +`CUDA GPU Compute Capability `_ documentation. + +AMD build +~~~~~~~~~ -And for AMD devices: +To build for AMD devices, use the ``--target-hip=`` argument: .. code-block:: bash @@ -173,13 +200,17 @@ For example: .. code-block:: bash python scripts/build_locally.py --target-hip=gfx90a +Multi-target build +~~~~~~~~~~~~~~~~~~ -It is, however, possible to build for Intel devices, CUDA devices, and an AMD device -architecture all at once: +The default ``dpnp`` build from the source enables support of Intel devices only. +Extending the build with a custom SYCL target additionally enables support of CUDA or AMD +device in ``dpnp``. Besides, the support can be also extended to enable both CUDA and AMD +devices at the same time: .. code-block:: bash - python scripts/build_locally.py --target=cuda --target-hip=gfx90a + python scripts/build_locally.py --target-cuda --target-hip=gfx90a Testing diff --git a/doc/reference/constants.rst b/doc/reference/constants.rst new file mode 100644 index 000000000000..256a2bdb12dd --- /dev/null +++ b/doc/reference/constants.rst @@ -0,0 +1,162 @@ +Constants +========= + +DPNP includes several constants: + +.. currentmodule:: dpnp + +.. autodata:: DLDeviceType + +.. data:: e + + Euler's constant, base of natural logarithms, Napier's constant. + + ``e = 2.71828182845904523536028747135266249775724709369995...`` + + .. rubric:: See Also + + :func:`exp` : Exponential function + + :func:`log` : Natural logarithm + + .. rubric:: References + + https://en.wikipedia.org/wiki/E_%28mathematical_constant%29 + + +.. data:: euler_gamma + + ``γ = 0.5772156649015328606065120900824024310421...`` + + .. rubric:: References + + https://en.wikipedia.org/wiki/Euler%27s_constant + + +.. data:: inf + + IEEE 754 floating point representation of (positive) infinity. + + .. rubric:: Returns + + y : float + A floating point representation of positive infinity. + + .. rubric:: See Also + + :func:`isinf` : Shows which elements are positive or negative infinity + + :func:`isposinf` : Shows which elements are positive infinity + + :func:`isneginf` : Shows which elements are negative infinity + + :func:`isnan` : Shows which elements are Not a Number + + :func:`isfinite` : Shows which elements are finite (not one of Not a Number, + positive infinity and negative infinity) + + .. rubric:: Notes + + DPNP uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + Also that positive infinity is not equivalent to negative infinity. But + infinity is equivalent to positive infinity. + + .. rubric:: Examples + + .. code-block:: python + + >>> import dpnp as np + >>> np.inf + inf + >>> np.array([1]) / 0.0 + array([inf]) + + +.. data:: nan + + IEEE 754 floating point representation of Not a Number (NaN). + + .. rubric:: Returns + + y : A floating point representation of Not a Number. + + .. rubric:: See Also + + :func:`isnan` : Shows which elements are Not a Number + + :func:`isfinite` : Shows which elements are finite (not one of Not a Number, + positive infinity and negative infinity) + + .. rubric:: Notes + + DPNP uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + + .. rubric:: Examples + + .. code-block:: python + + >>> import dpnp as np + >>> np.nan + nan + >>> np.log(np.array(-1)) + array(nan) + >>> np.log(np.array([-1, 1, 2])) + array([ nan, 0. , 0.69314718]) + + +.. data:: newaxis + + A convenient alias for *None*, useful for indexing arrays. + + .. rubric:: Examples + + .. code-block:: python + + >>> import dpnp as np + >>> np.newaxis is None + True + >>> x = np.arange(3) + >>> x + array([0, 1, 2]) + >>> x[:, np.newaxis] + array([[0], + [1], + [2]]) + >>> x[:, np.newaxis, np.newaxis] + array([[[0]], + [[1]], + [[2]]]) + >>> x[:, np.newaxis] * x + array([[0, 0, 0], + [0, 1, 2], + [0, 2, 4]]) + + Outer product, same as ``outer(x, y)``: + + >>> y = np.arange(3, 6) + >>> x[:, np.newaxis] * y + array([[ 0, 0, 0], + [ 3, 4, 5], + [ 6, 8, 10]]) + + ``x[np.newaxis, :]`` is equivalent to ``x[np.newaxis]`` and ``x[None]``: + + >>> x[np.newaxis, :].shape + (1, 3) + >>> x[np.newaxis].shape + (1, 3) + >>> x[None].shape + (1, 3) + >>> x[:, np.newaxis].shape + (3, 1) + + +.. data:: pi + + ``pi = 3.1415926535897932384626433...`` + + .. rubric:: References + + https://en.wikipedia.org/wiki/Pi diff --git a/doc/reference/linalg.rst b/doc/reference/linalg.rst index 79b85ea81f1c..142c6052db87 100644 --- a/doc/reference/linalg.rst +++ b/doc/reference/linalg.rst @@ -43,6 +43,7 @@ Decompositions dpnp.linalg.cholesky dpnp.linalg.outer dpnp.linalg.qr + dpnp.linalg.lu_factor dpnp.linalg.svd dpnp.linalg.svdvals @@ -85,6 +86,7 @@ Solving linear equations dpnp.linalg.solve dpnp.linalg.tensorsolve dpnp.linalg.lstsq + dpnp.linalg.lu_solve dpnp.linalg.inv dpnp.linalg.pinv dpnp.linalg.tensorinv diff --git a/doc/reference/ndarray.rst b/doc/reference/ndarray.rst index 4f9aef8a9160..9a03c680a012 100644 --- a/doc/reference/ndarray.rst +++ b/doc/reference/ndarray.rst @@ -66,7 +66,11 @@ of the array: dpnp.ndarray.size dpnp.ndarray.itemsize dpnp.ndarray.nbytes - dpnp.ndarray.base + dpnp.ndarray.device + dpnp.ndarray.sycl_context + dpnp.ndarray.sycl_device + dpnp.ndarray.sycl_queue + dpnp.ndarray.usm_type Data type @@ -98,6 +102,17 @@ Other attributes dpnp.ndarray.flat +Special attributes +------------------ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + dpnp.ndarray.__sycl_usm_array_interface__ + dpnp.ndarray.__usm_ndarray__ + + Array methods ------------- @@ -145,6 +160,7 @@ Array conversion dpnp.ndarray.getfield dpnp.ndarray.setflags dpnp.ndarray.fill + dpnp.ndarray.get_array Shape manipulation @@ -195,6 +211,26 @@ the operation should proceed. Calculation ----------- +Many of these methods take an argument named *axis*. In such cases, + +- If *axis* is *None* (the default), the array is treated as a 1-D array and + the operation is performed over the entire array. This behavior is also the + default if *self* is a 0-dimensional array. + +- If *axis* is an integer, then the operation is done over the given axis (for + each 1-D subarray that can be created along the given axis). + +The parameter *dtype* specifies the data type over which a reduction operation +(like summing) should take place. The default reduce data type is the same as +the data type of *self*. To avoid overflow, it can be useful to perform the +reduction using a larger data type. + +For several methods, an optional *out* argument can also be provided and the +result will be placed into the output array given. The *out* argument must be +an :class:`dpnp.ndarray` and have the same number of elements as the result +array. It can have a different data type in which case casting will be +performed. + .. autosummary:: :toctree: generated/ :nosignatures: @@ -226,12 +262,11 @@ Arithmetic and comparison operations on :class:`dpnp.ndarrays ` are defined as element-wise operations, and generally yield :class:`dpnp.ndarray` objects as results. -Each of the arithmetic operations (``+``, ``-``, ``*``, ``/``, ``//``, -``%``, ``divmod()``, ``**`` or ``pow()``, ``<<``, ``>>``, ``&``, -``^``, ``|``, ``~``) and the comparisons (``==``, ``<``, ``>``, -``<=``, ``>=``, ``!=``) is equivalent to the corresponding -universal function (or :term:`ufunc` for short) in DPNP. For -more information, see the section on :ref:`Universal Functions +Each of the arithmetic operations (``+``, ``-``, ``*``, ``/``, ``//``, ``%``, +``divmod()``, ``**`` or ``pow()``, ``<<``, ``>>``, ``&``, ``^``, ``|``, ``~``) +and the comparisons (``==``, ``<``, ``>``, ``<=``, ``>=``, ``!=``) is +equivalent to the corresponding universal function (or :term:`ufunc` for short) +in DPNP. For more information, see the section on :ref:`Universal Functions `. @@ -252,6 +287,7 @@ Truth value of an array (:class:`bool() `): .. autosummary:: :toctree: generated/ + :nosignatures: dpnp.ndarray.__bool__ @@ -343,6 +379,7 @@ Matrix Multiplication: .. autosummary:: :toctree: generated/ + :nosignatures: dpnp.ndarray.__matmul__ dpnp.ndarray.__rmatmul__ @@ -371,7 +408,10 @@ Basic customization: dpnp.ndarray.__new__ dpnp.ndarray.__array__ + dpnp.ndarray.__array_namespace__ dpnp.ndarray.__array_wrap__ + dpnp.ndarray.__dlpack__ + dpnp.ndarray.__dlpack_device__ Container customization: (see :ref:`Indexing `) @@ -380,12 +420,13 @@ Container customization: (see :ref:`Indexing `) :nosignatures: dpnp.ndarray.__len__ + dpnp.ndarray.__iter__ dpnp.ndarray.__getitem__ dpnp.ndarray.__setitem__ dpnp.ndarray.__contains__ -Conversion; the operations :class:`int() `, -:class:`float() ` and :class:`complex() `. +Conversion; the operations :class:`int() `, :class:`float() `, +:class:`complex() ` and :func:`operator.index() `. They work only on arrays that have one element in them and return the appropriate scalar. @@ -393,6 +434,7 @@ and return the appropriate scalar. :toctree: generated/ :nosignatures: + dpnp.ndarray.__index__ dpnp.ndarray.__int__ dpnp.ndarray.__float__ dpnp.ndarray.__complex__ diff --git a/doc/reference/routines.rst b/doc/reference/routines.rst index 1dd4a205b0cf..1cfca82a15de 100644 --- a/doc/reference/routines.rst +++ b/doc/reference/routines.rst @@ -1,6 +1,5 @@ --------- -Routines --------- +Routines (NumPy) +================ The following pages describe NumPy-compatible routines. These functions cover a subset of @@ -11,6 +10,7 @@ These functions cover a subset of .. toctree:: :maxdepth: 2 + constants array-creation array-manipulation bitwise diff --git a/doc/reference/scipy.rst b/doc/reference/scipy.rst new file mode 100644 index 000000000000..e95b199710a0 --- /dev/null +++ b/doc/reference/scipy.rst @@ -0,0 +1,12 @@ +Routines (SciPy) (:mod:`dpnp.scipy`) +==================================== + +The following pages describe SciPy-compatible routines. +These functions cover a subset of +`SciPy routines `_. + +.. toctree:: + :maxdepth: 2 + + scipy_linalg + scipy_special diff --git a/doc/reference/scipy_linalg.rst b/doc/reference/scipy_linalg.rst new file mode 100644 index 000000000000..0ab8d5a248ff --- /dev/null +++ b/doc/reference/scipy_linalg.rst @@ -0,0 +1,17 @@ +.. currentmodule:: dpnp.scipy.linalg + +Linear algebra (:mod:`dpnp.scipy.linalg`) +========================================= + +.. Hint:: `SciPy API Reference: Linear algebra (scipy.linalg) `_ + +Decompositions +-------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + lu + lu_factor + lu_solve diff --git a/doc/reference/scipy_special.rst b/doc/reference/scipy_special.rst new file mode 100644 index 000000000000..0df23dbd6ce2 --- /dev/null +++ b/doc/reference/scipy_special.rst @@ -0,0 +1,20 @@ +.. currentmodule:: dpnp.scipy.special + +Special functions (:mod:`dpnp.scipy.special`) +======================================= + +.. Hint:: `SciPy API Reference: Special functions (scipy.special) `_ + +Error function and Fresnel integrals +------------------------------------ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + erf + erfc + erfcx + erfi + erfinv + erfcinv diff --git a/doc/reference/special.rst b/doc/reference/special.rst deleted file mode 100644 index 1261625e5e26..000000000000 --- a/doc/reference/special.rst +++ /dev/null @@ -1,17 +0,0 @@ -Special Functions -================= - -.. https://docs.scipy.org/doc/scipy/reference/special.html - -Error Function --------------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - dpnp.erf - dpnp.erfc - dpnp.erfcx - dpnp.erfinv - dpnp.erfcinv diff --git a/dpnp/__init__.py b/dpnp/__init__.py index 170b73b76cc0..3d8145b5362c 100644 --- a/dpnp/__init__.py +++ b/dpnp/__init__.py @@ -40,17 +40,13 @@ # where to search for DLLs towards both DPNP backend and DPCTL Sycl interface, # otherwise DPNP import will be failing. This is because the libraries # are not installed under any of default paths where Python is searching. -from platform import system - -if system() == "Windows": # pragma: no cover - if hasattr(os, "add_dll_directory"): - os.add_dll_directory(mypath) - os.add_dll_directory(dpctlpath) +if sys.platform == "win32": # pragma: no cover + os.add_dll_directory(mypath) + os.add_dll_directory(dpctlpath) os.environ["PATH"] = os.pathsep.join( [os.getenv("PATH", ""), mypath, dpctlpath] ) - # For virtual environments on Windows, add folder with DPC++ libraries # to the DLL search path if sys.base_exec_prefix != sys.exec_prefix and os.path.isfile( @@ -74,10 +70,15 @@ from .dpnp_iface_utils import * from .dpnp_iface_utils import __all__ as _ifaceutils__all__ from ._version import get_versions +from . import linalg as linalg +from . import scipy as scipy __all__ = _iface__all__ __all__ += _ifaceutils__all__ +# add submodules +__all__ += ["linalg", "scipy"] + __version__ = get_versions()["version"] del get_versions diff --git a/dpnp/backend/CMakeLists.txt b/dpnp/backend/CMakeLists.txt index 4a6b44d50f0d..17b986a38b92 100644 --- a/dpnp/backend/CMakeLists.txt +++ b/dpnp/backend/CMakeLists.txt @@ -26,7 +26,6 @@ set(DPNP_SRC kernels/dpnp_krnl_arraycreation.cpp kernels/dpnp_krnl_common.cpp - kernels/dpnp_krnl_elemwise.cpp kernels/dpnp_krnl_mathematical.cpp kernels/dpnp_krnl_random.cpp kernels/dpnp_krnl_sorting.cpp diff --git a/dpnp/backend/extensions/blas/CMakeLists.txt b/dpnp/backend/extensions/blas/CMakeLists.txt index 3cca41032a5a..f5e0ecc737de 100644 --- a/dpnp/backend/extensions/blas/CMakeLists.txt +++ b/dpnp/backend/extensions/blas/CMakeLists.txt @@ -30,6 +30,7 @@ set(_module_src ${CMAKE_CURRENT_SOURCE_DIR}/gemm.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gemm_batch.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gemv.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/syrk.cpp ) pybind11_add_module(${python_module_name} MODULE ${_module_src}) @@ -59,8 +60,8 @@ endif() 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}/../../) +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}) @@ -83,11 +84,11 @@ if (DPNP_GENERATE_COVERAGE) target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping) endif() -if(_use_onemkl_interfaces) - target_link_libraries(${python_module_name} PRIVATE ${MKL_INTERFACES_LIB}) - target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMKL_INTERFACES) - if(_use_onemkl_interfaces_cuda) - target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMKL_CUBLAS) +if(_ues_onemath) + target_link_libraries(${python_module_name} PRIVATE ${ONEMATH_LIB}) + target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMATH) + if(_ues_onemath_cuda) + target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMATH_CUBLAS) endif() else() target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::BLAS) diff --git a/dpnp/backend/extensions/blas/blas_py.cpp b/dpnp/backend/extensions/blas/blas_py.cpp index 0321ff6fc6bd..36fc29bae482 100644 --- a/dpnp/backend/extensions/blas/blas_py.cpp +++ b/dpnp/backend/extensions/blas/blas_py.cpp @@ -30,17 +30,23 @@ #include #include +// utils extension header +#include "ext/common.hpp" + #include "dot.hpp" #include "dot_common.hpp" #include "dotc.hpp" #include "dotu.hpp" #include "gemm.hpp" #include "gemv.hpp" +#include "syrk.hpp" namespace blas_ns = dpnp::extensions::blas; namespace py = pybind11; namespace dot_ns = blas_ns::dot; + using dot_ns::dot_impl_fn_ptr_t; +using ext::common::init_dispatch_vector; // populate dispatch vectors and tables void init_dispatch_vectors_tables(void) @@ -48,6 +54,7 @@ void init_dispatch_vectors_tables(void) blas_ns::init_gemm_batch_dispatch_table(); blas_ns::init_gemm_dispatch_table(); blas_ns::init_gemv_dispatch_vector(); + blas_ns::init_syrk_dispatch_vector(); } static dot_impl_fn_ptr_t dot_dispatch_vector[dpctl_td_ns::num_types]; @@ -62,7 +69,7 @@ PYBIND11_MODULE(_blas_impl, m) using event_vecT = std::vector; { - dot_ns::init_dot_dispatch_vector( + init_dispatch_vector( dot_dispatch_vector); auto dot_pyapi = [&](sycl::queue &exec_q, const arrayT &src1, @@ -73,14 +80,14 @@ PYBIND11_MODULE(_blas_impl, m) }; m.def("_dot", dot_pyapi, - "Call `dot` from OneMKL BLAS library to compute " + "Call `dot` from oneMKL BLAS library to compute " "the dot product of two real-valued vectors.", py::arg("sycl_queue"), py::arg("vectorA"), py::arg("vectorB"), py::arg("result"), py::arg("depends") = py::list()); } { - dot_ns::init_dot_dispatch_vector( + init_dispatch_vector( dotc_dispatch_vector); auto dotc_pyapi = [&](sycl::queue &exec_q, const arrayT &src1, @@ -91,7 +98,7 @@ PYBIND11_MODULE(_blas_impl, m) }; m.def("_dotc", dotc_pyapi, - "Call `dotc` from OneMKL BLAS library to compute " + "Call `dotc` from oneMKL BLAS library to compute " "the dot product of two complex vectors, " "conjugating the first vector.", py::arg("sycl_queue"), py::arg("vectorA"), py::arg("vectorB"), @@ -99,7 +106,7 @@ PYBIND11_MODULE(_blas_impl, m) } { - dot_ns::init_dot_dispatch_vector( + init_dispatch_vector( dotu_dispatch_vector); auto dotu_pyapi = [&](sycl::queue &exec_q, const arrayT &src1, @@ -110,7 +117,7 @@ PYBIND11_MODULE(_blas_impl, m) }; m.def("_dotu", dotu_pyapi, - "Call `dotu` from OneMKL BLAS library to compute " + "Call `dotu` from oneMKL BLAS library to compute " "the dot product of two complex vectors.", py::arg("sycl_queue"), py::arg("vectorA"), py::arg("vectorB"), py::arg("result"), py::arg("depends") = py::list()); @@ -118,7 +125,7 @@ PYBIND11_MODULE(_blas_impl, m) { m.def("_gemm", &blas_ns::gemm, - "Call `gemm` from OneMKL BLAS library to compute " + "Call `gemm` from oneMKL BLAS library to compute " "the matrix-matrix product with 2-D matrices.", py::arg("sycl_queue"), py::arg("matrixA"), py::arg("matrixB"), py::arg("resultC"), py::arg("depends") = py::list()); @@ -126,7 +133,7 @@ PYBIND11_MODULE(_blas_impl, m) { m.def("_gemm_batch", &blas_ns::gemm_batch, - "Call `gemm_batch` from OneMKL BLAS library to compute " + "Call `gemm_batch` from oneMKL BLAS library to compute " "the matrix-matrix product for a batch of 2-D matrices.", py::arg("sycl_queue"), py::arg("matrixA"), py::arg("matrixB"), py::arg("resultC"), py::arg("depends") = py::list()); @@ -134,23 +141,31 @@ PYBIND11_MODULE(_blas_impl, m) { m.def("_gemv", &blas_ns::gemv, - "Call `gemv` from OneMKL BLAS library to compute " + "Call `gemv` from oneMKL BLAS library to compute " "the matrix-vector product with a general matrix.", py::arg("sycl_queue"), py::arg("matrixA"), py::arg("vectorX"), py::arg("vectorY"), py::arg("transpose"), py::arg("depends") = py::list()); } + { + m.def("_syrk", &blas_ns::syrk, + "Call `syrk` from oneMKL BLAS library to compute " + "the matrix-vector product with a general matrix.", + py::arg("sycl_queue"), py::arg("matrixA"), py::arg("resultC"), + py::arg("depends") = py::list()); + } + { m.def( - "_using_onemkl_interfaces", + "_using_onemath", []() { -#ifdef USE_ONEMKL_INTERFACES +#ifdef USE_ONEMATH return true; #else return false; #endif }, - "Check if the OneMKL interfaces are being used."); + "Check if OneMath is being used."); } } diff --git a/dpnp/backend/extensions/blas/dot_common.hpp b/dpnp/backend/extensions/blas/dot_common.hpp index fb9a1f078c53..faa31cb6b388 100644 --- a/dpnp/backend/extensions/blas/dot_common.hpp +++ b/dpnp/backend/extensions/blas/dot_common.hpp @@ -128,7 +128,8 @@ std::pair dot_impl_fn_ptr_t dot_fn = dot_dispatch_vector[type_id]; if (dot_fn == nullptr) { throw py::value_error( - "Types of input vectors and result array are mismatched."); + "No dot implementation is available for the specified data type " + "of the input and output arrays."); } char *x_typeless_ptr = vectorX.get_data(); @@ -164,13 +165,4 @@ std::pair return std::make_pair(args_ev, dot_ev); } - -template