Repository navigation
Reimplement dpnp.random.RandomState on the device RNG
#10694
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Conda package | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| permissions: | |
| contents: read | |
| # Cancel superseded PR runs only; other runs get a unique group and always complete | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| env: | |
| # Pinned: Miniforge3 26.9.4-0 fails 'conda init' on Windows runners | |
| miniforge-version: '26.7.2-1' | |
| package-name: dpnp | |
| # Follow oneAPI installation instruction for conda, since intel channel is not longer available | |
| # channels-list: '-c dppy/label/dev -c intel -c conda-forge --override-channels' | |
| channels-list: '-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels' | |
| 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-ver-test-all-dtypes: '3.14' | |
| test-env-name: 'test' | |
| rerun-tests-on-failure: 'true' | |
| rerun-tests-max-attempts: 2 | |
| rerun-tests-timeout: 45 | |
| rerun-tensor-tests-timeout: 15 | |
| rerun-tensor-tests-max-attempts: 3 | |
| # Per-test limit to kill a test stuck at 99%: https://github.com/IntelPython/dpctl/issues/1954 | |
| tensor-test-timeout: 120 | |
| jobs: | |
| build: | |
| name: Build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ['3.13'] | |
| os: [ubuntu-latest, windows-2022] | |
| include: | |
| - python: '3.14' | |
| os: ubuntu-latest | |
| python_spec: '3.14.* *_cp314' | |
| - python: '3.14' | |
| os: windows-2022 | |
| python_spec: '3.14.* *_cp314' | |
| - python: '3.14' | |
| os: ubuntu-latest | |
| python_spec: '3.14.* *_cp314t' | |
| - python: '3.14' | |
| os: windows-2022 | |
| python_spec: '3.14.* *_cp314t' | |
| - python: '3.15' | |
| os: ubuntu-latest | |
| python_spec: '3.15.* *_cp315' | |
| - python: '3.15' | |
| os: windows-2022 | |
| python_spec: '3.15.* *_cp315' | |
| # TODO: add free-threaded builds ('3.15.* *_cp315t') once NumPy and | |
| # dpctl cp315t builds are available | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 90 | |
| defaults: | |
| run: | |
| shell: ${{ matrix.os == 'windows-2022' && 'cmd /C CALL {0}' || 'bash -el {0}' }} | |
| env: | |
| python-label: ${{ endsWith(matrix.python_spec, 't') && format('{0}t', matrix.python) || matrix.python }} | |
| python-conda-spec: ${{ matrix.python_spec || matrix.python }} | |
| steps: | |
| - name: Checkout DPNP repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| # Blobless: all commits and tags for git describe, no gh-pages blobs | |
| filter: blob:none | |
| # rattler-build is a standalone binary with no conda/Python dependency, | |
| # so building conda packages with it doesn't need a full conda | |
| # distribution on the runner - only rattler-build itself needs to be on | |
| # PATH | |
| - name: Setup rattler-build | |
| uses: prefix-dev/rattler-build-action@1ca5f45832f419a46d1326ccc5861d7e14d67c44 # v0.2.39 | |
| with: | |
| setup-only: true | |
| - name: Check rattler-build version | |
| run: rattler-build --version | |
| - name: Store build output paths | |
| shell: bash -el {0} | |
| run: | | |
| echo "CONDA_BLD=$GITHUB_WORKSPACE/output/${{ runner.os == 'Linux' && 'linux-64' || 'win-64' }}/" >> "$GITHUB_ENV" | |
| echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE${{ runner.os == 'Linux' && '/' || '\\' }}" >> "$GITHUB_ENV" | |
| - name: Compute version from git describe | |
| shell: bash -el {0} | |
| run: | | |
| DESCRIBE=$(git describe --tags --long) | |
| echo "GIT_DESCRIBE_TAG=$(echo "$DESCRIBE" | sed -E 's/-[0-9]+-g[0-9a-f]+$//')" >> "$GITHUB_ENV" | |
| echo "GIT_DESCRIBE_NUMBER=$(echo "$DESCRIBE" | sed -E 's/^.*-([0-9]+)-g[0-9a-f]+$/\1/')" >> "$GITHUB_ENV" | |
| - name: Compute rattler-build arguments | |
| shell: bash -el {0} | |
| run: | | |
| read -ra RATTLER_CHANNELS <<< "$(echo "${{ env.channels-list }}" | sed 's/--override-channels//')" | |
| echo "RATTLER_BUILD_ARGS=--no-include-recipe --test skip --channel-priority disabled --target-platform ${{ runner.os == 'Linux' && 'linux-64' || 'win-64' }} --variant-config conda-recipe/conda_build_config.yaml --variant \"python=${{ env.python-conda-spec }}\" --variant numpy=2 ${RATTLER_CHANNELS[*]}" >> "$GITHUB_ENV" | |
| - name: Build conda package | |
| id: build_conda_pkg | |
| continue-on-error: true | |
| uses: prefix-dev/rattler-build-action@1ca5f45832f419a46d1326ccc5861d7e14d67c44 # v0.2.39 | |
| with: | |
| recipe-path: conda-recipe/rattler_recipe.yaml | |
| build-args: ${{ env.RATTLER_BUILD_ARGS }} | |
| upload-artifact: false | |
| env: | |
| MAX_BUILD_CMPL_MKL_VERSION: '2027.0a0' | |
| - name: ReBuild conda package | |
| if: steps.build_conda_pkg.outcome == 'failure' | |
| uses: prefix-dev/rattler-build-action@1ca5f45832f419a46d1326ccc5861d7e14d67c44 # v0.2.39 | |
| with: | |
| recipe-path: conda-recipe/rattler_recipe.yaml | |
| build-args: ${{ env.RATTLER_BUILD_ARGS }} | |
| upload-artifact: false | |
| env: | |
| MAX_BUILD_CMPL_MKL_VERSION: '2027.0a0' | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: ${{ env.package-name }} ${{ runner.os }} Python ${{ env.python-label }} | |
| path: ${{ env.CONDA_BLD }}${{ env.package-name }}-*.conda | |
| - name: Upload wheels artifact | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: ${{ env.package-name }} ${{ runner.os }} Wheels Python ${{ env.python-label }} | |
| path: ${{ env.WHEELS_OUTPUT_FOLDER }}${{ env.package-name }}-*.whl | |
| test_linux: | |
| name: Test | |
| needs: build | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 120 | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ['3.13'] | |
| os: [ubuntu-latest] | |
| include: | |
| - python: '3.14' | |
| os: ubuntu-latest | |
| python_spec: '3.14.* *_cp314' | |
| - python: '3.14' | |
| os: ubuntu-latest | |
| python_spec: '3.14.* *_cp314t' | |
| - python: '3.15' | |
| os: ubuntu-latest | |
| python_spec: '3.15.* *_cp315' | |
| # TODO: add free-threaded builds ('3.15.* *_cp315t') once NumPy and | |
| # dpctl cp315t builds are available | |
| env: | |
| dpnp-repo-path: '${{ github.workspace }}/source/' | |
| create-conda-channel-env: 'source/environments/create_conda_channel.yml' | |
| channel-path: '${{ github.workspace }}/channel/' | |
| pkg-path-in-channel: '${{ github.workspace }}/channel/linux-64/' | |
| ver-json-path: '${{ github.workspace }}/version.json' | |
| python-label: ${{ endsWith(matrix.python_spec, 't') && format('{0}t', matrix.python) || matrix.python }} | |
| python-install-spec: "python ${{ matrix.python_spec || format('{0}.*', matrix.python) }}" | |
| steps: | |
| - name: Set Swap Space | |
| uses: pierotofy/set-swap-space@49819abfb41bd9b44fb781159c033dba90353a7c # v1.0 | |
| with: | |
| swap-size-gb: 8 | |
| - name: Checkout DPNP repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: ${{ env.fetch-depth }} | |
| path: ${{ env.dpnp-repo-path }} | |
| - name: Download artifact | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| name: ${{ env.package-name }} ${{ runner.os }} Python ${{ env.python-label }} | |
| path: ${{ env.pkg-path-in-channel }} | |
| - name: Setup miniconda | |
| uses: ./source/.github/actions/setup-miniconda | |
| with: | |
| miniforge-version: ${{ env.miniforge-version }} | |
| environment-file: ${{ env.create-conda-channel-env }} | |
| activate-environment: ${{ env.test-env-name }} | |
| - name: Create conda channel | |
| run: | | |
| python -m conda_index ${{ env.channel-path }} | |
| - name: Test conda channel | |
| run: | | |
| conda search ${{ env.package-name }} -c ${{ env.channel-path }} --override-channels --info --json > ${{ env.ver-json-path }} | |
| cat ${{ env.ver-json-path }} | |
| - name: Get package version | |
| run: | | |
| PACKAGE_VERSION=$(python -c "${{ env.ver-script-part1 }} ${{ env.ver-script-part2 }}") | |
| export PACKAGE_VERSION | |
| echo "PACKAGE_VERSION=${PACKAGE_VERSION}" | |
| echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_ENV" | |
| - name: Install dpnp | |
| id: install_dpnp | |
| continue-on-error: true | |
| run: | | |
| mamba install ${{ env.package-name }}=${{ env.PACKAGE_VERSION }} pytest pytest-timeout pytest-xdist "${{ env.python-install-spec }}" ${{ env.TEST_CHANNELS }} | |
| env: | |
| TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.channels-list }}' | |
| - name: ReInstall dpnp | |
| if: steps.install_dpnp.outcome == 'failure' | |
| run: | | |
| mamba install ${{ env.package-name }}=${{ env.PACKAGE_VERSION }} pytest pytest-timeout pytest-xdist "${{ env.python-install-spec }}" ${{ env.TEST_CHANNELS }} | |
| env: | |
| TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.channels-list }}' | |
| - name: List installed packages | |
| run: mamba list | |
| - name: Smoke test | |
| run: | | |
| python -c "import dpctl; dpctl.lsplatform()" | |
| python -c "import dpnp; print(dpnp.__version__)" | |
| - name: Run tests | |
| if: env.rerun-tests-on-failure != 'true' | |
| run: | | |
| export SKIP_TENSOR_TESTS=1 | |
| if [[ "${{ env.python-label }}" == "${{ env.python-ver-test-all-dtypes }}" ]]; then | |
| export DPNP_TEST_ALL_INT_TYPES=1 | |
| python -m pytest -ra --pyargs ${{ env.package-name }}.tests | |
| else | |
| python -m pytest -n auto -ra --pyargs ${{ env.package-name }}.tests | |
| fi | |
| - name: Run tests | |
| if: env.rerun-tests-on-failure == 'true' | |
| id: run_tests_linux | |
| uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0 | |
| with: | |
| timeout_minutes: ${{ env.rerun-tests-timeout }} | |
| max_attempts: ${{ env.rerun-tests-max-attempts }} | |
| retry_on: any | |
| command: | | |
| . $CONDA/etc/profile.d/conda.sh | |
| . $CONDA/etc/profile.d/mamba.sh | |
| mamba activate ${{ env.test-env-name }} | |
| export SKIP_TENSOR_TESTS=1 | |
| if [[ "${{ env.python-label }}" == "${{ env.python-ver-test-all-dtypes }}" ]]; then | |
| export DPNP_TEST_ALL_INT_TYPES=1 | |
| python -m pytest -ra --pyargs ${{ env.package-name }}.tests | |
| else | |
| python -m pytest -n auto -ra --pyargs ${{ env.package-name }}.tests | |
| fi | |
| - name: Run tensor tests | |
| if: env.rerun-tests-on-failure != 'true' | |
| run: | | |
| python -m pytest -n auto -ra --timeout=${{ env.tensor-test-timeout }} --timeout-method=thread --pyargs dpnp.tests.tensor | |
| - name: Run tensor tests | |
| if: env.rerun-tests-on-failure == 'true' | |
| id: run_tests_tensor_linux | |
| uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0 | |
| with: | |
| timeout_minutes: ${{ env.rerun-tensor-tests-timeout }} | |
| max_attempts: ${{ env.rerun-tensor-tests-max-attempts }} | |
| retry_on: any | |
| command: | | |
| . $CONDA/etc/profile.d/conda.sh | |
| . $CONDA/etc/profile.d/mamba.sh | |
| mamba activate ${{ env.test-env-name }} | |
| python -m pytest -n auto -ra --timeout=${{ env.tensor-test-timeout }} --timeout-method=thread --pyargs dpnp.tests.tensor | |
| test_examples_linux: | |
| name: Test examples | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ['3.14'] | |
| python_spec: ['3.14.* *_cp314', '3.14.* *_cp314t'] | |
| env: | |
| dpnp-repo-path: '${{ github.workspace }}/source/' | |
| examples-conda-pkg-env: 'source/environments/examples.yml' | |
| channel-path: '${{ github.workspace }}/channel/' | |
| pkg-path-in-channel: '${{ github.workspace }}/channel/linux-64/' | |
| ver-json-path: '${{ github.workspace }}/version.json' | |
| examples-env-name: 'examples_test' | |
| python-label: ${{ endsWith(matrix.python_spec, 't') && format('{0}t', matrix.python) || matrix.python }} | |
| python-install-spec: "python ${{ matrix.python_spec || format('{0}.*', matrix.python) }}" | |
| steps: | |
| - name: Checkout DPNP repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: ${{ env.fetch-depth }} | |
| path: ${{ env.dpnp-repo-path }} | |
| - name: Download artifact | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| name: ${{ env.package-name }} ${{ runner.os }} Python ${{ env.python-label }} | |
| path: ${{ env.pkg-path-in-channel }} | |
| - name: Setup miniconda | |
| uses: ./source/.github/actions/setup-miniconda | |
| with: | |
| miniforge-version: ${{ env.miniforge-version }} | |
| environment-file: ${{ env.examples-conda-pkg-env }} | |
| activate-environment: ${{ env.examples-env-name }} | |
| - name: Create conda channel | |
| run: | | |
| python -m conda_index ${{ env.channel-path }} | |
| - name: Test conda channel | |
| run: | | |
| conda search ${{ env.package-name }} -c ${{ env.channel-path }} --override-channels --info --json > ${{ env.ver-json-path }} | |
| cat ${{ env.ver-json-path }} | |
| - name: Get package version | |
| run: | | |
| PACKAGE_VERSION=$(python -c "${{ env.ver-script-part1 }} ${{ env.ver-script-part2 }}") | |
| echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> "$GITHUB_ENV" | |
| - name: Install dpnp | |
| id: install_dpnp | |
| continue-on-error: true | |
| run: | | |
| mamba install ${{ env.package-name }}=${{ env.PACKAGE_VERSION }} "${{ env.python-install-spec }}" ${{ env.TEST_CHANNELS }} | |
| env: | |
| TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.channels-list }}' | |
| - name: ReInstall dpnp | |
| if: steps.install_dpnp.outcome == 'failure' | |
| run: | | |
| mamba install ${{ env.package-name }}=${{ env.PACKAGE_VERSION }} "${{ env.python-install-spec }}" ${{ env.TEST_CHANNELS }} | |
| env: | |
| TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.channels-list }}' | |
| - name: List installed packages | |
| run: mamba list | |
| - name: Smoke test | |
| run: | | |
| python -c "import dpctl; dpctl.lsplatform()" | |
| python -c "import dpnp; print(dpnp.__version__)" | |
| - name: Build and run pybind11 examples | |
| run: | | |
| cd ${{ env.dpnp-repo-path }}/examples/pybind11 | |
| for d in */; do | |
| pushd "$d" > /dev/null | |
| CC=icx CXX=icpx python setup.py build_ext --inplace -G Ninja || exit 1 | |
| if [ -d tests ]; then | |
| python -m pytest tests || exit 1 | |
| fi | |
| popd > /dev/null | |
| done | |
| test_windows: | |
| name: Test | |
| needs: build | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 120 | |
| defaults: | |
| run: | |
| shell: cmd /C CALL {0} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ['3.13'] | |
| os: [windows-2022] | |
| include: | |
| - python: '3.14' | |
| os: windows-2022 | |
| python_spec: '3.14.* *_cp314' | |
| - python: '3.14' | |
| os: windows-2022 | |
| python_spec: '3.14.* *_cp314t' | |
| - python: '3.15' | |
| os: windows-2022 | |
| python_spec: '3.15.* *_cp315' | |
| # TODO: add free-threaded builds ('3.15.* *_cp315t') once NumPy and | |
| # dpctl cp315t builds are available | |
| env: | |
| dpnp-repo-path: '${{ github.workspace }}\source' | |
| create-conda-channel-env: 'source\environments\create_conda_channel.yml' | |
| channel-path: '${{ github.workspace }}\channel\' | |
| pkg-path-in-channel: '${{ github.workspace }}\channel\win-64\' | |
| ver-json-path: '${{ github.workspace }}\version.json' | |
| python-label: ${{ endsWith(matrix.python_spec, 't') && format('{0}t', matrix.python) || matrix.python }} | |
| python-install-spec: "python ${{ matrix.python_spec || format('{0}.*', matrix.python) }}" | |
| steps: | |
| - name: Checkout DPNP repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: ${{ env.fetch-depth }} | |
| path: ${{ env.dpnp-repo-path }} | |
| - name: Download artifact | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| name: ${{ env.package-name }} ${{ runner.os }} Python ${{ env.python-label }} | |
| path: ${{ env.pkg-path-in-channel }} | |
| - name: Store a path to package archive | |
| run: | | |
| @echo on | |
| set SEARCH_SCRIPT="DIR ${{ env.pkg-path-in-channel }} /s/b | FINDSTR /r "dpnp-.*\.conda"" | |
| FOR /F "tokens=* USEBACKQ" %%F IN (`%SEARCH_SCRIPT%`) DO ( | |
| SET FULL_PACKAGE_PATH=%%F | |
| ) | |
| echo FULL_PACKAGE_PATH: %FULL_PACKAGE_PATH% | |
| (echo FULL_PACKAGE_PATH=%FULL_PACKAGE_PATH%) >> %GITHUB_ENV% | |
| - name: Setup miniconda | |
| uses: ./source/.github/actions/setup-miniconda | |
| with: | |
| miniforge-version: ${{ env.miniforge-version }} | |
| environment-file: ${{ env.create-conda-channel-env }} | |
| activate-environment: ${{ env.test-env-name }} | |
| - name: Store conda paths as envs | |
| run: | | |
| @echo on | |
| (echo CONDA_LIB_PATH=%CONDA_PREFIX%\Library\lib\) >> %GITHUB_ENV% | |
| (echo CONDA_LIB_BIN_PATH=%CONDA_PREFIX%\Library\bin\) >> %GITHUB_ENV% | |
| - name: Create conda channel | |
| run: | | |
| @echo on | |
| python -m conda_index ${{ env.channel-path }} | |
| - name: Test conda channel | |
| run: | | |
| @echo on | |
| conda search ${{ env.package-name }} -c ${{ env.channel-path }} --override-channels --info --json > ${{ env.ver-json-path }} | |
| - name: Dump version.json | |
| run: more ${{ env.ver-json-path }} | |
| - name: Get package version | |
| run: | | |
| @echo on | |
| set "SCRIPT=${{ env.ver-script-part1 }} ${{ env.ver-script-part2 }}" | |
| FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO ( | |
| set PACKAGE_VERSION=%%F | |
| ) | |
| echo PACKAGE_VERSION: %PACKAGE_VERSION% | |
| (echo PACKAGE_VERSION=%PACKAGE_VERSION%) >> %GITHUB_ENV% | |
| - name: Install dpnp | |
| run: | | |
| @echo on | |
| mamba install ${{ env.package-name }}=${{ env.PACKAGE_VERSION }} pytest pytest-timeout pytest-xdist "${{ env.python-install-spec }}" ${{ env.TEST_CHANNELS }} | |
| env: | |
| TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.channels-list }}' | |
| MAMBA_NO_LOW_SPEED_LIMIT: 1 | |
| - name: Install OCL CPU RT from Intel channel | |
| run: mamba install ${{ env.package-name }}=${{ env.PACKAGE_VERSION }} intel-opencl-rt=*=intel_* ${{ env.channels-list }} | |
| - name: List installed packages | |
| run: mamba list | |
| - name: Activate OCL CPU RT | |
| shell: pwsh | |
| run: | | |
| $script_path="$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1" | |
| if (Test-Path $script_path) { | |
| &$script_path | |
| } else { | |
| Write-Warning "File $script_path was NOT found!" | |
| } | |
| # Check the variable assisting OpenCL CPU driver to find TBB DLLs which are not located where it expects them by default | |
| $cl_cfg="$env:CONDA_PREFIX\Library\bin\cl.cfg" | |
| Get-Content -Tail 5 -Path $cl_cfg | |
| - name: Smoke test | |
| run: | | |
| python -c "import dpctl; dpctl.lsplatform()" | |
| python -c "import dpnp; print(dpnp.__version__)" | |
| - name: Run tests | |
| if: env.rerun-tests-on-failure != 'true' | |
| shell: pwsh | |
| run: | | |
| $env:SKIP_TENSOR_TESTS=1 | |
| if ("${{ env.python-label }}" -eq "${{ env.python-ver-test-all-dtypes }}") { | |
| $env:DPNP_TEST_ALL_INT_TYPES=1 | |
| python -m pytest -ra --pyargs ${{ env.package-name }}.tests | |
| } else { | |
| python -m pytest -n auto -ra --pyargs ${{ env.package-name }}.tests | |
| } | |
| - name: Run tests | |
| if: env.rerun-tests-on-failure == 'true' | |
| id: run_tests_win | |
| uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0 | |
| with: | |
| timeout_minutes: ${{ env.rerun-tests-timeout }} | |
| max_attempts: ${{ env.rerun-tests-max-attempts }} | |
| retry_on: any | |
| shell: pwsh | |
| command: | | |
| $env:SKIP_TENSOR_TESTS=1 | |
| if ( "${{ env.python-label }}" -eq "${{ env.python-ver-test-all-dtypes }}" ) { | |
| $env:DPNP_TEST_ALL_INT_TYPES=1 | |
| python -m pytest -ra --pyargs ${{ env.package-name }}.tests | |
| } else { | |
| python -m pytest -n auto -ra --pyargs ${{ env.package-name }}.tests | |
| } | |
| - name: Run tensor tests | |
| if: env.rerun-tests-on-failure != 'true' | |
| shell: pwsh | |
| run: | | |
| python -m pytest -n auto -ra --timeout=${{ env.tensor-test-timeout }} --timeout-method=thread --pyargs dpnp.tests.tensor | |
| - name: Run tensor tests | |
| if: env.rerun-tests-on-failure == 'true' | |
| id: run_tests_tensor_win | |
| uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0 | |
| with: | |
| timeout_minutes: ${{ env.rerun-tensor-tests-timeout }} | |
| max_attempts: ${{ env.rerun-tensor-tests-max-attempts }} | |
| retry_on: any | |
| shell: pwsh | |
| command: | | |
| python -m pytest -n auto -ra --timeout=${{ env.tensor-test-timeout }} --timeout-method=thread --pyargs dpnp.tests.tensor | |
| upload: | |
| name: Upload | |
| needs: [test_linux, test_windows, test_examples_linux] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ['3.13'] | |
| os: [ubuntu-latest, windows-2022] | |
| include: | |
| - python: '3.14' | |
| os: ubuntu-latest | |
| python_spec: '3.14.* *_cp314' | |
| - python: '3.14' | |
| os: windows-2022 | |
| python_spec: '3.14.* *_cp314' | |
| - python: '3.14' | |
| os: ubuntu-latest | |
| python_spec: '3.14.* *_cp314t' | |
| - python: '3.14' | |
| os: windows-2022 | |
| python_spec: '3.14.* *_cp314t' | |
| - python: '3.15' | |
| os: ubuntu-latest | |
| python_spec: '3.15.* *_cp315' | |
| - python: '3.15' | |
| os: windows-2022 | |
| python_spec: '3.15.* *_cp315' | |
| # TODO: add free-threaded builds ('3.15.* *_cp315t') once NumPy and | |
| # dpctl cp315t builds are available | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 10 | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| env: | |
| upload-conda-pkg-env: 'environments/upload_cleanup_conda_pkg.yml' | |
| upload-env-name: 'upload' | |
| python-label: ${{ endsWith(matrix.python_spec, 't') && format('{0}t', matrix.python) || matrix.python }} | |
| # Only master pushes upload: the workflow has no release branch or tag trigger | |
| if: github.repository == 'IntelPython/dpnp' && github.ref == 'refs/heads/master' | |
| steps: | |
| - name: Checkout DPNP repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: ${{ env.fetch-depth }} | |
| - name: Download artifact | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| name: ${{ env.package-name }} ${{ runner.os }} Python ${{ env.python-label }} | |
| - name: Download wheels artifact | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| name: ${{ env.package-name }} ${{ runner.os }} Wheels Python ${{ env.python-label }} | |
| - name: Setup miniconda | |
| uses: ./.github/actions/setup-miniconda | |
| with: | |
| miniforge-version: ${{ env.miniforge-version }} | |
| environment-file: ${{ env.upload-conda-pkg-env }} | |
| activate-environment: ${{ env.upload-env-name }} | |
| - name: Package version | |
| run: | | |
| echo "PACKAGE_VERSION=$(basename ${{ env.package-name }}-*.conda | sed 's/^${{ env.package-name }}-\([^-]*\).*/\1/')" >> "$GITHUB_ENV" | |
| - name: Upload | |
| run: | | |
| anaconda --token "${ANACONDA_TOKEN}" upload --user dppy --label dev ${{ env.package-name }}-*.conda | |
| env: | |
| ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
| - name: Upload wheels | |
| run: | | |
| anaconda --token "${ANACONDA_TOKEN}" upload --user dppy --label dev ${{ env.package-name }}-*.whl --version "${PACKAGE_VERSION}" | |
| env: | |
| ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
| array-api-conformity: | |
| name: Array API conformity | |
| needs: build | |
| permissions: | |
| # Needed to add a comment to a pull request's issue | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| continue-on-error: true | |
| env: | |
| array-api-tests-path: '${{ github.workspace }}/array-api-tests/' | |
| json-report-file: '${{ github.workspace }}/.report.json' | |
| 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.14' | |
| conda-env-name: 'array-api-conformity' | |
| channel-path: '${{ github.workspace }}/channel/' | |
| pkg-path-in-channel: '${{ github.workspace }}/channel/linux-64/' | |
| ver-json-path: '${{ github.workspace }}/version.json' | |
| steps: | |
| - name: Checkout DPNP repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: ${{ env.fetch-depth }} | |
| path: ${{ env.dpnp-repo-path }} | |
| - name: Download artifact | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| name: ${{ env.package-name }} ${{ runner.os }} Python ${{ env.python-ver }} | |
| path: ${{ env.pkg-path-in-channel }} | |
| - name: Setup miniconda | |
| uses: ./source/.github/actions/setup-miniconda | |
| with: | |
| miniforge-version: ${{ env.miniforge-version }} | |
| environment-file: ${{ env.create-conda-channel-env }} | |
| activate-environment: ${{ env.conda-env-name }} | |
| - name: Create conda channel | |
| run: | | |
| python -m conda_index ${{ env.channel-path }} | |
| - name: Test conda channel | |
| run: | | |
| conda search ${{ env.package-name }} -c ${{ env.channel-path }} --override-channels --info --json > ${{ env.ver-json-path }} | |
| cat ${{ env.ver-json-path }} | |
| - name: Get package version | |
| run: | | |
| PACKAGE_VERSION=$(python -c "${{ env.ver-script-part1 }} ${{ env.ver-script-part2 }}") | |
| export PACKAGE_VERSION | |
| echo "PACKAGE_VERSION=${PACKAGE_VERSION}" | |
| echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_ENV" | |
| - name: Install dpnp | |
| id: install_dpnp | |
| continue-on-error: true | |
| run: | | |
| mamba install ${{ env.package-name }}=${{ env.PACKAGE_VERSION }} pytest python=${{ env.python-ver }} ${{ env.TEST_CHANNELS }} | |
| env: | |
| TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.channels-list }}' | |
| - name: ReInstall dpnp | |
| if: steps.install_dpnp.outcome == 'failure' | |
| run: | | |
| mamba install ${{ env.package-name }}=${{ env.PACKAGE_VERSION }} pytest python=${{ env.python-ver }} ${{ env.TEST_CHANNELS }} | |
| env: | |
| TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.channels-list }}' | |
| - name: List installed packages | |
| run: mamba list | |
| - name: Smoke test | |
| run: | | |
| python -c "import dpctl; dpctl.lsplatform()" | |
| python -c "import dpnp; print(dpnp.__version__)" | |
| - name: Clone array API tests repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| repository: 'data-apis/array-api-tests' | |
| path: ${{ env.array-api-tests-path }} | |
| fetch-depth: ${{ env.fetch-depth }} | |
| submodules: 'recursive' | |
| - name: Install array API test dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| working-directory: ${{ env.array-api-tests-path }} | |
| - name: Run array API conformance tests | |
| run: | | |
| python -m pytest --json-report --json-report-file=${{ env.json-report-file }} --disable-deadline --skips-file ${{ env.array-api-skips-file }} array_api_tests || true | |
| env: | |
| ARRAY_API_TESTS_MODULE: 'dpnp' | |
| ARRAY_API_TESTS_VERSION: '2025.12' | |
| SYCL_CACHE_PERSISTENT: 1 | |
| working-directory: ${{ env.array-api-tests-path }} | |
| - name: Set GitHub environment variables | |
| run: | | |
| FILE=${{ env.json-report-file }} | |
| if test -f "$FILE"; then | |
| PASSED_TESTS=$(jq '.summary | .passed // 0' $FILE) | |
| FAILED_TESTS=$(jq '.summary | .failed // 0' $FILE) | |
| SKIPPED_TESTS=$(jq '.summary | .skipped // 0' $FILE) | |
| MESSAGE="Array API standard conformance tests for dpnp=$PACKAGE_VERSION ran successfully. | |
| Passed: $PASSED_TESTS | |
| Failed: $FAILED_TESTS | |
| Skipped: $SKIPPED_TESTS" | |
| { | |
| echo "MESSAGE<<EOF" | |
| echo "$MESSAGE" | |
| echo "EOF" | |
| } >> "$GITHUB_ENV" | |
| else | |
| echo "Array API standard conformance tests failed to run for dpnp=$PACKAGE_VERSION." | |
| exit 1 | |
| fi | |
| - name: Output API summary | |
| run: echo "::notice ${{ env.MESSAGE }}" | |
| - name: Post result to PR | |
| if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork }} | |
| uses: mshick/add-pr-comment@ec328af66588ab8f77cdeb2c264f14aba45bbf59 # v3.12.0 | |
| with: | |
| message-id: array_api_results | |
| message: | | |
| ${{ env.MESSAGE }} | |
| cleanup_packages: | |
| name: Clean up anaconda packages | |
| needs: [upload] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| env: | |
| cleanup-conda-pkg-env: 'environments/upload_cleanup_conda_pkg.yml' | |
| cleanup-env-name: 'cleanup' | |
| steps: | |
| - name: Checkout DPNP repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: ${{ env.fetch-depth }} | |
| - name: Setup miniconda | |
| uses: ./.github/actions/setup-miniconda | |
| with: | |
| miniforge-version: ${{ env.miniforge-version }} | |
| environment-file: ${{ env.cleanup-conda-pkg-env }} | |
| activate-environment: ${{ env.cleanup-env-name }} | |
| # A subdirectory keeps the setup-miniconda action in place for its post step | |
| - name: Checkout repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| repository: IntelPython/devops-tools | |
| fetch-depth: ${{ env.fetch-depth }} | |
| path: devops-tools | |
| - name: Cleanup old packages | |
| working-directory: devops-tools | |
| run: | | |
| python scripts/cleanup-old-packages.py \ | |
| --verbose --force --token "${ANACONDA_TOKEN}" \ | |
| --package dppy/${{ env.package-name }} --label dev | |
| env: | |
| ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} |