Skip to content

Raise TypeError in dpnp.ndarray.__array__ #6183

Raise TypeError in dpnp.ndarray.__array__

Raise TypeError in dpnp.ndarray.__array__ #6183

Workflow file for this run

name: Conda package
on:
push:
branches:
- master
pull_request:
permissions: read-all
env:
PACKAGE_NAME: dpnp
# Follow oneAPI installation instruction for conda, since intel channel is not longer available
# CHANNELS: '-c dppy/label/dev -c intel -c conda-forge --override-channels'
CHANNELS: '-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels'
CONDA_BUILD_INDEX_ENV_PY_VER: '3.12' # conda does not support python 3.13
CONDA_BUILD_VERSION: '24.11.2'
CONDA_INDEX_VERSION: '0.5.0'
RERUN_TESTS_ON_FAILURE: 'true'
RUN_TESTS_MAX_ATTEMPTS: 2
TEST_ENV_NAME: 'test'
VER_JSON_NAME: 'version.json'
VER_SCRIPT1: "import json; f = open('version.json', 'r'); j = json.load(f); f.close(); "
VER_SCRIPT2: "d = j['dpnp'][0]; print('='.join((d[s] for s in ('version', 'build'))))"
jobs:
build:
name: Build
strategy:
fail-fast: false
matrix:
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
os: [ubuntu-22.04, windows-2019]
permissions:
# Needed to cancel any previous runs that are not completed for a given workflow
actions: write
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout DPNP repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Setup miniconda
id: setup_miniconda
continue-on-error: true
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
python-version: ${{ env.CONDA_BUILD_INDEX_ENV_PY_VER}}
activate-environment: 'build'
- name: ReSetup miniconda
if: steps.setup_miniconda.outcome == 'failure'
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
python-version: ${{ env.CONDA_BUILD_INDEX_ENV_PY_VER}}
activate-environment: 'build'
- name: Store conda paths as envs
shell: bash -el {0}
run: |
echo "CONDA_BLD=$CONDA_PREFIX/conda-bld/${{ runner.os == 'Linux' && 'linux' || 'win' }}-64/" | tr "\\\\" '/' >> $GITHUB_ENV
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE${{ runner.os == 'Linux' && '/' || '\\' }}" >> $GITHUB_ENV
- name: Install conda-build
id: install_conda_build
continue-on-error: true
run: mamba install conda-build=${{ env.CONDA_BUILD_VERSION}}
- name: ReInstall conda-build
if: steps.install_conda_build.outcome == 'failure'
run: mamba install conda-build=${{ env.CONDA_BUILD_VERSION}}
- name: Build conda package
run: conda build --no-test --python ${{ matrix.python }} --numpy 2.0 ${{ env.CHANNELS }} conda-recipe
env:
MAX_BUILD_CMPL_MKL_VERSION: '2025.1a0'
- name: Upload artifact
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.tar.bz2
- name: Upload wheels artifact
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
path: ${{ env.WHEELS_OUTPUT_FOLDER }}${{ env.PACKAGE_NAME }}-*.whl
test_linux:
name: Test
needs: build
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}
strategy:
fail-fast: false
matrix:
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
os: [ubuntu-latest]
env:
channel-path: '${{ github.workspace }}/channel/'
pkg-path-in-channel: '${{ github.workspace }}/channel/linux-64/'
extracted-pkg-path: '${{ github.workspace }}/pkg/'
ver-json-path: '${{ github.workspace }}/version.json'
steps:
- name: Download artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.pkg-path-in-channel }}
- name: Extract package archive
run: |
mkdir -p ${{ env.extracted-pkg-path }}
tar -xvf ${{ env.pkg-path-in-channel }}/${{ env.PACKAGE_NAME }}-*.tar.bz2 -C ${{ env.extracted-pkg-path }}
- name: Setup miniconda
id: setup_miniconda
continue-on-error: true
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
python-version: ${{ env.CONDA_BUILD_INDEX_ENV_PY_VER}}
activate-environment: ${{ env.TEST_ENV_NAME }}
- name: ReSetup miniconda
if: steps.setup_miniconda.outcome == 'failure'
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
python-version: ${{ env.CONDA_BUILD_INDEX_ENV_PY_VER}}
activate-environment: ${{ env.TEST_ENV_NAME }}
- name: Install conda-index
run: mamba install conda-index=${{ env.CONDA_INDEX_VERSION }}
- 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: |
export PACKAGE_VERSION=$(python -c "${{ env.VER_SCRIPT1 }} ${{ env.VER_SCRIPT2 }}")
echo PACKAGE_VERSION=${PACKAGE_VERSION}
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
# conda-index does not support python 3.13
- name: Remove conda-index
run: mamba remove conda-index
- name: Install dpnp
id: install_dpnp
continue-on-error: true
run: |
mamba install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
env:
TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}'
- name: ReInstall dpnp
if: steps.install_dpnp.outcome == 'failure'
run: |
mamba install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
env:
TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}'
- 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: |
python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests
- name: Run tests
if: env.RERUN_TESTS_ON_FAILURE == 'true'
id: run_tests_linux
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
with:
timeout_minutes: 12
max_attempts: ${{ env.RUN_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 -ra --pyargs ${{ env.PACKAGE_NAME }}.tests
test_windows:
name: Test
needs: build
runs-on: ${{ matrix.os }}
defaults:
run:
shell: cmd /C CALL {0}
strategy:
fail-fast: false
matrix:
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
os: [windows-2019]
env:
channel-path: '${{ github.workspace }}\channel\'
pkg-path-in-channel: '${{ github.workspace }}\channel\win-64\'
extracted-pkg-path: '${{ github.workspace }}\pkg'
ver-json-path: '${{ github.workspace }}\version.json'
workdir: '${{ github.workspace }}'
steps:
- name: Download artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.pkg-path-in-channel }}
- name: Extract package archive
run: |
@echo on
mkdir -p ${{ env.extracted-pkg-path }}
set SEARCH_SCRIPT="DIR ${{ env.pkg-path-in-channel }} /s/b | FINDSTR /r "dpnp-.*\.tar\.bz2""
FOR /F "tokens=* USEBACKQ" %%F IN (`%SEARCH_SCRIPT%`) DO (
SET FULL_PACKAGE_PATH=%%F
)
echo FULL_PACKAGE_PATH: %FULL_PACKAGE_PATH%
python -c "import shutil; shutil.unpack_archive(r\"%FULL_PACKAGE_PATH%\", extract_dir=r\"${{ env.extracted-pkg-path }}\")"
dir ${{ env.extracted-pkg-path }}
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
python-version: ${{ env.CONDA_BUILD_INDEX_ENV_PY_VER}}
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: Install conda-index
run: mamba install conda-index=${{ env.CONDA_INDEX_VERSION }}
- 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_SCRIPT1 }} ${{ env.VER_SCRIPT2 }}"
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%
# conda-index does not support python 3.13
- name: Remove conda-index
run: mamba remove conda-index
- name: Install dpnp
run: |
@echo on
mamba install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
env:
TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}'
MAMBA_NO_LOW_SPEED_LIMIT: 1
- 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\lib\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'
run: |
pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests
- name: Run tests
if: env.RERUN_TESTS_ON_FAILURE == 'true'
id: run_tests_win
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
with:
timeout_minutes: 15
max_attempts: ${{ env.RUN_TESTS_MAX_ATTEMPTS }}
retry_on: any
command: |
python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests
upload:
name: Upload
needs: [test_linux, test_windows]
strategy:
matrix:
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
os: [ubuntu-22.04, windows-2019]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }}
continue-on-error: true
if: |
(github.repository == 'IntelPython/dpnp') &&
(github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/'))
steps:
- name: Download artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
- name: Download wheels artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
python-version: ${{ matrix.python }}
activate-environment: 'upload'
- name: Install anaconda-client
run: mamba install anaconda-client
- name: Package version
shell: bash -el {0}
run: |
echo "PACKAGE_VERSION=$(basename ${{ env.PACKAGE_NAME }}-*.tar.bz2 | sed 's/^${{ env.PACKAGE_NAME }}-\([^-]*\).*/\1/')" >> $GITHUB_ENV
- name: Upload
run: |
anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
- name: Upload wheels
run: |
anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.whl --version ${{ env.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
strategy:
matrix:
python: ['3.12']
os: [ubuntu-22.04]
runs-on: ${{ matrix.os }}
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 }}/dpnp/'
array-api-skips-file: '${{ github.workspace }}/dpnp/.github/workflows/array-api-skips.txt'
channel-path: '${{ github.workspace }}/channel/'
pkg-path-in-channel: '${{ github.workspace }}/channel/linux-64/'
extracted-pkg-path: '${{ github.workspace }}/pkg/'
ver-json-path: '${{ github.workspace }}/version.json'
steps:
- name: Download artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.pkg-path-in-channel }}
- name: Extract package archive
run: |
mkdir -p ${{ env.extracted-pkg-path }}
tar -xvf ${{ env.pkg-path-in-channel }}/${{ env.PACKAGE_NAME }}-*.tar.bz2 -C ${{ env.extracted-pkg-path }}
- name: Setup miniconda
id: setup_miniconda
continue-on-error: true
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
python-version: ${{ matrix.python }}
activate-environment: 'array-api-conformity'
- name: ReSetup miniconda
if: steps.setup_miniconda.outcome == 'failure'
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
python-version: ${{ matrix.python }}
activate-environment: 'array-api-conformity'
- name: Install conda-index
id: install_conda_index
continue-on-error: true
run: mamba install conda-index=${{ env.CONDA_INDEX_VERSION }}
- name: ReInstall conda-index
if: steps.install_conda_index.outcome == 'failure'
run: mamba install conda-index=${{ env.CONDA_INDEX_VERSION }}
- 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: |
export PACKAGE_VERSION=$(python -c "${{ env.VER_SCRIPT1 }} ${{ env.VER_SCRIPT2 }}")
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=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
env:
TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}'
- name: ReInstall dpnp
if: steps.install_dpnp.outcome == 'failure'
run: |
mamba install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
env:
TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}'
- 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: 'data-apis/array-api-tests'
path: ${{ env.array-api-tests-path }}
fetch-depth: 0
submodules: 'recursive'
- name: Install array API test dependencies
run: |
pip install -r requirements.txt
working-directory: ${{ env.array-api-tests-path }}
- name: Install jq
run: |
sudo apt-get install jq
- name: List installed packages
run: mamba list
- name: Smoke test
run: |
python -c "import dpctl; dpctl.lsplatform()"
python -c "import dpnp; print(dpnp.__version__)"
# need to fetch array-api-skips.txt
- name: Checkout DPNP repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: ${{ env.dpnp-repo-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'
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" >> $GITHUB_ENV
echo "$MESSAGE" >> $GITHUB_ENV
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@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
with:
message: |
${{ env.MESSAGE }}
refresh-message-position: true
cleanup_packages:
name: Clean up anaconda packages
needs: [upload]
runs-on: 'ubuntu-latest'
defaults:
run:
shell: bash -el {0}
steps:
- uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
run-post: 'false'
python-version: '3.13'
activate-environment: 'cleanup'
- name: Install anaconda-client
run: mamba install anaconda-client
- name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: IntelPython/devops-tools
fetch-depth: 0
- name: Cleanup old packages
run: |
python scripts/cleanup-old-packages.py \
--verbose --force --token ${{ secrets.ANACONDA_TOKEN }} \
--package dppy/${{ env.PACKAGE_NAME }} --label dev