diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index e401cf78c837..83045bcd8f8d 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -1,20 +1,100 @@ name: Conda package -on: push +on: + push: + branches: + - master + pull_request: env: - PACKAGE_NAME: dpctl + PACKAGE_NAME: dpnp + MODULE_NAME: dpnp + CHANNELS: '-c dppy/label/dev -c intel -c defaults --override-channels' + 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: - runs-on: ubuntu-20.04 + build_linux: + runs-on: ubuntu-latest + + defaults: + run: + shell: bash -l {0} + + strategy: + matrix: + python: ['3.8', '3.9'] + + env: + conda-pkgs: '/home/runner/conda_pkgs_dir/' + conda-bld: '/usr/share/miniconda3/envs/build/conda-bld/linux-64/' + + steps: + - name: Checkout DPNP repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Checkout oneDPL + uses: actions/checkout@v3 + with: + repository: oneapi-src/oneDPL + path: oneDPL + ref: oneDPL-2021.7.0-release + + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: ${{ matrix.python }} + miniconda-version: 'latest' + activate-environment: 'build' + use-only-tar-bz2: true + + - name: Install conda-build + run: conda install conda-build + + - name: Cache conda packages + uses: actions/cache@v3 + env: + CACHE_NUMBER: 1 # Increase to reset cache + with: + path: ${{ env.conda-pkgs }} + key: + ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }} + restore-keys: | + ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}- + ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}- + + - name: Build conda package + run: conda build --no-test --python ${{ matrix.python }} ${{ env.CHANNELS }} conda-recipe + env: + DPLROOT: '${{ github.workspace }}/oneDPL' + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} + path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2 + + build_windows: + runs-on: windows-latest + + defaults: + run: + shell: cmd /C CALL {0} strategy: matrix: - python: [3.8, 3.9] + python: ['3.8', '3.9'] + + env: + conda-pkgs: 'C:\Users\runneradmin\conda_pkgs_dir\' + conda-bld: 'C:\Miniconda3\envs\build\conda-bld\win-64\' steps: - - name: Checkout repo + - name: Checkout DPNP repo uses: actions/checkout@v3 with: fetch-depth: 0 @@ -24,44 +104,384 @@ jobs: with: repository: oneapi-src/oneDPL path: oneDPL - ref: oneDPL-2021.6.1-release + ref: oneDPL-2021.7.0-release + + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: ${{ matrix.python }} + miniconda-version: 'latest' + activate-environment: 'build' + use-only-tar-bz2: true + + - name: Cache conda packages + uses: actions/cache@v3 + env: + CACHE_NUMBER: 1 # Increase to reset cache + with: + path: ${{ env.conda-pkgs }} + key: + ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }} + restore-keys: | + ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}- + ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}- - - name: Add conda to system path - run: echo $CONDA/bin >> $GITHUB_PATH - name: Install conda-build run: conda install conda-build + - name: Build conda package - run: ./scripts/build_conda_package.sh ${{ matrix.python }} $GITHUB_WORKSPACE/oneDPL + run: conda build --no-test --python ${{ matrix.python }} ${{ env.CHANNELS }} conda-recipe + env: + DPLROOT: '%GITHUB_WORKSPACE%\oneDPL' - name: Upload artifact uses: actions/upload-artifact@v2 with: - name: dpnp ${{ runner.os }} ${{ matrix.python }} - path: /usr/share/miniconda/conda-bld/linux-64/dpnp-*.tar.bz2 + name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} + path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2 + + test_linux: + needs: build_linux - upload: - needs: build - if: ${{ github.ref == 'refs/heads/master' }} runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + strategy: matrix: - python: [3.8, 3.9] + python: ['3.8', '3.9'] + dpctl: ['0.13.0'] + experimental: [false] + + continue-on-error: ${{ matrix.experimental }} + + env: + conda-pkgs: '/home/runner/conda_pkgs_dir/' + channel-path: '${{ github.workspace }}/channel/' + pkg-path-in-channel: '${{ github.workspace }}/channel/linux-64/' + extracted-pkg-path: '${{ github.workspace }}/pkg/' + tests-path: '${{ github.workspace }}/pkg/info/test/' + ver-json-path: '${{ github.workspace }}/version.json' steps: - name: Download artifact uses: actions/download-artifact@v2 with: - name: dpnp ${{ runner.os }} ${{ matrix.python }} + 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 + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: ${{ matrix.python }} + miniconda-version: 'latest' + activate-environment: 'test' + + # Needed to be able to run conda index + - name: Install conda-build + run: conda install conda-build + + - name: Create conda channel + run: 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: Collect dependencies + run: | + export PACKAGE_VERSION=$(python -c "${{ env.VER_SCRIPT1 }} ${{ env.VER_SCRIPT2 }}") + echo PACKAGE_VERSION=${PACKAGE_VERSION} + + conda install ${{ env.PACKAGE_NAME }}=${PACKAGE_VERSION} python=${{ matrix.python }} ${{ env.TEST_CHANNELS }} --only-deps --dry-run > lockfile + cat lockfile + env: + TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}' + + - name: Cache conda packages + uses: actions/cache@v3 + env: + CACHE_NUMBER: 1 # Increase to reset cache + with: + path: ${{ env.conda-pkgs }} + key: + ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }} + restore-keys: | + ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}- + ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}- + + - name: Install dpnp + run: | + export PACKAGE_VERSION=$(python -c "${{ env.VER_SCRIPT1 }} ${{ env.VER_SCRIPT2 }}") + echo PACKAGE_VERSION=${PACKAGE_VERSION} + + conda install ${{ env.PACKAGE_NAME }}=${PACKAGE_VERSION} dpctl=${{ matrix.dpctl }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }} + env: + TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}' + + - name: List installed packages + run: conda list + + - name: Smoke test + run: python -c "import dpnp, dpctl; dpctl.lsplatform()" + + # TODO: run the whole scope once the issues on CPU are resolved + - name: Run tests + run: python -m pytest -q -ra --disable-warnings -vv tests/test_arraycreation.py tests/test_dparray.py tests/test_mathematical.py + env: + SYCL_ENABLE_HOST_DEVICE: '1' + working-directory: ${{ env.tests-path }} + + test_windows: + needs: build_windows + + runs-on: windows-latest + + defaults: + run: + shell: cmd /C CALL {0} + + strategy: + matrix: + python: ['3.8', '3.9'] + dpctl: ['0.13.0'] + experimental: [false] + + continue-on-error: ${{ matrix.experimental }} + + env: + conda-pkgs: 'C:\Users\runneradmin\conda_pkgs_dir\' + channel-path: '${{ github.workspace }}\channel\' + pkg-path-in-channel: '${{ github.workspace }}\channel\win-64\' + extracted-pkg-path: '${{ github.workspace }}\pkg' + tests-path: '${{ github.workspace }}\pkg\info\test\' + ver-json-path: '${{ github.workspace }}\version.json' + active-env-name: 'test' + miniconda-lib-path: 'C:\Miniconda3\envs\test\Library\lib\' + miniconda-bin-path: 'C:\Miniconda3\envs\test\Library\bin\' + + steps: + - name: Download artifact + uses: actions/download-artifact@v2 + 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@v2 + with: + auto-update-conda: true + python-version: ${{ matrix.python }} + miniconda-version: 'latest' + activate-environment: ${{ env.active-env-name }} + + # Needed to be able to run conda index + - name: Install conda-build + run: conda install conda-build + + - name: Create conda channel + run: 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: Collect dependencies + 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% + + conda install ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% dpctl=${{ matrix.dpctl }} python=${{ matrix.python }} ${{ env.TEST_CHANNELS }} --only-deps --dry-run > lockfile + env: + TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}' + + - name: Dump lockfile + run: more lockfile + + - name: Cache conda packages + uses: actions/cache@v3 + env: + CACHE_NUMBER: 1 # Increase to reset cache + with: + path: ${{ env.conda-pkgs }} + key: + ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }} + restore-keys: | + ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}- + ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}- + + - name: Install opencl_rt + run: conda install opencl_rt -c intel --override-channels + + - name: Install dpnp + 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% + + conda install ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% dpctl=${{ matrix.dpctl }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }} + env: + TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}' + + - name: List installed packages + run: conda list + + - name: Add library + shell: pwsh + run: | + # Make sure the below libraries exist + Get-Item -Path ${{ env.miniconda-bin-path }}\OpenCL.dll + Get-Item -Path ${{ env.miniconda-lib-path }}\intelocl64.dll + + echo "OCL_ICD_FILENAMES=${{ env.miniconda-lib-path }}\intelocl64.dll" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + try {$list = Get-Item -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors | Select-Object -ExpandProperty Property } catch {$list=@()} + + if ($list.count -eq 0) { + if (-not (Test-Path -Path HKLM:\SOFTWARE\Khronos)) { + New-Item -Path HKLM:\SOFTWARE\Khronos + } + + if (-not (Test-Path -Path HKLM:\SOFTWARE\Khronos\OpenCL)) { + New-Item -Path HKLM:\SOFTWARE\Khronos\OpenCL + } + + if (-not (Test-Path -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors)) { + New-Item -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors + } + + New-ItemProperty -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors -Name ${{ env.miniconda-lib-path }}\intelocl64.dll -Value 0 + try {$list = Get-Item -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors | Select-Object -ExpandProperty Property } catch {$list=@()} + Write-Output $(Get-Item -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors) + + # Now copy OpenCL.dll into system folder + $system_ocl_icd_loader="C:\Windows\System32\OpenCL.dll" + $python_ocl_icd_loader="${{ env.miniconda-bin-path }}\OpenCL.dll" + Copy-Item -Path $python_ocl_icd_loader -Destination $system_ocl_icd_loader + + if (Test-Path -Path $system_ocl_icd_loader) { + Write-Output "$system_ocl_icd_loader has been copied" + $acl = Get-Acl $system_ocl_icd_loader + Write-Output $acl + } else { + Write-Output "OCL-ICD-Loader was not copied" + } + + # Variable assisting OpenCL CPU driver to find TBB DLLs which are not located where it expects them by default + echo "TBB_DLL_PATH=${{ env.miniconda-bin-path }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } + + - name: Smoke test + run: python -c "import dpnp, dpctl; dpctl.lsplatform()" + + # TODO: run the whole scope once the issues on CPU are resolved + - name: Run tests + run: python -m pytest -q -ra --disable-warnings -vv tests\test_arraycreation.py tests\test_dparray.py tests\test_mathematical.py + working-directory: ${{ env.tests-path }} + + upload_linux: + needs: test_linux + + if: ${{github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/')}} + + runs-on: ubuntu-latest + + defaults: + run: + shell: bash -l {0} + + strategy: + matrix: + python: ['3.8', '3.9'] + + steps: + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} + + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: ${{ matrix.python }} + miniconda-version: 'latest' + activate-environment: 'upload' - name: Install anaconda-client run: conda install anaconda-client - - name: Add conda to system path - run: echo $CONDA/bin >> $GITHUB_PATH - name: Upload env: ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} - run: | - conda install anaconda-client - anaconda --token $ANACONDA_TOKEN upload --user dppy --label dev dpnp-*.tar.bz2 + run: anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2 + + upload_windows: + needs: test_windows + + if: ${{github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/')}} + + runs-on: windows-latest + + defaults: + run: + shell: cmd /C CALL {0} + + strategy: + matrix: + python: ['3.8', '3.9'] + steps: + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} + + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: ${{ matrix.python }} + miniconda-version: 'latest' + activate-environment: 'upload' + + - name: Install anaconda-client + run: conda install anaconda-client + + - name: Upload + env: + ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} + run: anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2 diff --git a/.gitignore b/.gitignore index 2ac17b1752b8..ea56758f290b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,15 @@ +# CMake build and local install directory build build_cython + +# Byte-compiled / optimized / DLL files __pycache__/ + +# Code project files +.vscode + *dpnp_backend* dpnp/**/*.cpython*.so dpnp/**/*.pyd -*~ \ No newline at end of file +*~ +core diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat index 1695b2e74c90..8ec6c1fb1587 100644 --- a/conda-recipe/bld.bat +++ b/conda-recipe/bld.bat @@ -1,6 +1,14 @@ REM A workaround for activate-dpcpp.bat issue to be addressed in 2021.4 +set "LIB=%BUILD_PREFIX%\Library\lib;%BUILD_PREFIX%\compiler\lib;%LIB%" SET "INCLUDE=%BUILD_PREFIX%\include;%INCLUDE%" +REM Since the 60.0.0 release, setuptools includes a local, vendored copy +REM of distutils (from late copies of CPython) that is enabled by default. +REM It breaks build for Windows, so use distutils from "stdlib" as before. +REM @TODO: remove the setting, once transition to build backend on Windows +REM to cmake is complete. +SET "SETUPTOOLS_USE_DISTUTILS=stdlib" + IF DEFINED DPLROOT ( ECHO "Sourcing DPLROOT" SET "INCLUDE=%DPLROOT%\include;%INCLUDE%" diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index bc705e2715d2..dccf855c184c 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -8,22 +8,22 @@ requirements: host: - python - setuptools - - numpy 1.19 + - numpy >=1.19,<1.22a0 - cython - - cmake 3.19 + - cmake >=3.19 - dpctl >=0.13 - mkl-devel-dpcpp {{ environ.get('MKL_VER', '>=2021.1.1') }} - tbb-devel - wheel build: - - {{ compiler('dpcpp') }} - - dpcpp-cpp-rt {{ environ.get('DPCPP_VER', '>=2021.1.1') }} + - {{ compiler('cxx') }} + - {{ compiler('dpcpp') }} >=2022.1 # [not osx] run: - python - dpctl >=0.13 - {{ pin_compatible('dpcpp-cpp-rt', min_pin='x.x', max_pin='x') }} - {{ pin_compatible('mkl-dpcpp', min_pin='x.x', max_pin='x') }} - - numpy >=1.15 + - {{ pin_compatible('numpy', min_pin='x.x', max_pin='x') }} build: number: {{ GIT_DESCRIBE_NUMBER }} diff --git a/dpnp/backend/kernels/dpnp_krnl_indexing.cpp b/dpnp/backend/kernels/dpnp_krnl_indexing.cpp index d37e319b7e3b..5cde013b69f8 100644 --- a/dpnp/backend/kernels/dpnp_krnl_indexing.cpp +++ b/dpnp/backend/kernels/dpnp_krnl_indexing.cpp @@ -901,10 +901,8 @@ DPCTLSyclEventRef dpnp_take_c(DPCTLSyclQueueRef q_ref, DPCTLSyclEventRef event_ref = nullptr; sycl::queue q = *(reinterpret_cast(q_ref)); - DPNPC_ptr_adapter<_DataType> input1_ptr(q_ref, array1_in, array1_size); - DPNPC_ptr_adapter<_IndecesType> input2_ptr(q_ref, indices1, size); - _DataType* array_1 = input1_ptr.get_ptr(); - _IndecesType* indices = input2_ptr.get_ptr(); + _DataType* array_1 = reinterpret_cast<_DataType*>(array1_in); + _IndecesType* indices = reinterpret_cast<_IndecesType*>(indices1); _DataType* result = reinterpret_cast<_DataType*>(result1); sycl::range<1> gws(size); @@ -920,7 +918,6 @@ DPCTLSyclEventRef dpnp_take_c(DPCTLSyclQueueRef q_ref, sycl::event event = q.submit(kernel_func); event_ref = reinterpret_cast(&event); - return DPCTLEvent_Copy(event_ref); } @@ -937,6 +934,7 @@ void dpnp_take_c(void* array1_in, const size_t array1_size, void* indices1, void size, dep_event_vec_ref); DPCTLEvent_WaitAndThrow(event_ref); + DPCTLEvent_Delete(event_ref); } template @@ -1073,21 +1071,36 @@ void func_map_init_indexing_func(func_map_t& fmap) fmap[DPNPFuncName::DPNP_FN_PUT_ALONG_AXIS_EXT][eft_DBL][eft_DBL] = {eft_DBL, (void*)dpnp_put_along_axis_ext_c}; - fmap[DPNPFuncName::DPNP_FN_TAKE][eft_BLN][eft_BLN] = {eft_BLN, (void*)dpnp_take_default_c}; - fmap[DPNPFuncName::DPNP_FN_TAKE][eft_INT][eft_INT] = {eft_INT, (void*)dpnp_take_default_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE][eft_BLN][eft_INT] = {eft_BLN, (void*)dpnp_take_default_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE][eft_INT][eft_INT] = {eft_INT, (void*)dpnp_take_default_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE][eft_LNG][eft_INT] = {eft_LNG, (void*)dpnp_take_default_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE][eft_FLT][eft_INT] = {eft_FLT, (void*)dpnp_take_default_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE][eft_DBL][eft_INT] = {eft_DBL, (void*)dpnp_take_default_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE][eft_C128][eft_INT] = {eft_C128, + (void*)dpnp_take_default_c, int32_t>}; + fmap[DPNPFuncName::DPNP_FN_TAKE][eft_BLN][eft_LNG] = {eft_BLN, (void*)dpnp_take_default_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE][eft_INT][eft_LNG] = {eft_INT, (void*)dpnp_take_default_c}; fmap[DPNPFuncName::DPNP_FN_TAKE][eft_LNG][eft_LNG] = {eft_LNG, (void*)dpnp_take_default_c}; - fmap[DPNPFuncName::DPNP_FN_TAKE][eft_FLT][eft_FLT] = {eft_FLT, (void*)dpnp_take_default_c}; - fmap[DPNPFuncName::DPNP_FN_TAKE][eft_DBL][eft_DBL] = {eft_DBL, (void*)dpnp_take_default_c}; - fmap[DPNPFuncName::DPNP_FN_TAKE][eft_C128][eft_C128] = {eft_C128, - (void*)dpnp_take_default_c, int64_t>}; - - fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_BLN][eft_BLN] = {eft_BLN, (void*)dpnp_take_ext_c}; - fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_INT][eft_INT] = {eft_INT, (void*)dpnp_take_ext_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE][eft_FLT][eft_LNG] = {eft_FLT, (void*)dpnp_take_default_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE][eft_DBL][eft_LNG] = {eft_DBL, (void*)dpnp_take_default_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE][eft_C128][eft_LNG] = {eft_C128, + (void*)dpnp_take_default_c, int64_t>}; + + // TODO: add a handling of other indexes types once DPCtl implementation of data copy is ready + fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_BLN][eft_INT] = {eft_BLN, (void*)dpnp_take_ext_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_INT][eft_INT] = {eft_INT, (void*)dpnp_take_ext_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_LNG][eft_INT] = {eft_LNG, (void*)dpnp_take_ext_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_FLT][eft_INT] = {eft_FLT, (void*)dpnp_take_ext_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_DBL][eft_INT] = {eft_DBL, (void*)dpnp_take_ext_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_C128][eft_INT] = {eft_C128, + (void*)dpnp_take_ext_c, int32_t>}; + fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_BLN][eft_LNG] = {eft_BLN, (void*)dpnp_take_ext_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_INT][eft_LNG] = {eft_INT, (void*)dpnp_take_ext_c}; fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_LNG][eft_LNG] = {eft_LNG, (void*)dpnp_take_ext_c}; - fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_FLT][eft_FLT] = {eft_FLT, (void*)dpnp_take_ext_c}; - fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_DBL][eft_DBL] = {eft_DBL, (void*)dpnp_take_ext_c}; - fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_C128][eft_C128] = {eft_C128, - (void*)dpnp_take_ext_c, int64_t>}; + fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_FLT][eft_LNG] = {eft_FLT, (void*)dpnp_take_ext_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_DBL][eft_LNG] = {eft_DBL, (void*)dpnp_take_ext_c}; + fmap[DPNPFuncName::DPNP_FN_TAKE_EXT][eft_C128][eft_LNG] = {eft_C128, + (void*)dpnp_take_ext_c, int64_t>}; return; } diff --git a/scripts/build_conda_package.sh b/scripts/build_conda_package.sh deleted file mode 100755 index c9ad065b1509..000000000000 --- a/scripts/build_conda_package.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -PYTHON_VERSION=$1 -DPLROOT=$2 - -export DPLROOT - -CHANNELS="-c dppy/label/dev -c intel -c defaults --override-channels" -VERSIONS="--python $PYTHON_VERSION" -TEST="--no-test" - -conda build \ - $TEST \ - $VERSIONS \ - $CHANNELS \ - conda-recipe diff --git a/tests/skipped_tests.tbl b/tests/skipped_tests.tbl index bbf3c1c3b535..b781e3772021 100644 --- a/tests/skipped_tests.tbl +++ b/tests/skipped_tests.tbl @@ -129,6 +129,7 @@ tests/test_linalg.py::test_svd[(2,2)-complex128] tests/test_linalg.py::test_svd[(3,4)-complex128] tests/test_linalg.py::test_svd[(5,3)-complex128] tests/test_linalg.py::test_svd[(16,16)-complex128] +tests/test_mathematical.py::TestGradient::test_gradient_y1_dx[3.5-array1] tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: (dpnp.asarray([(i, i) for i in x], [("a", int), ("b", int)]).view(dpnp.recarray))] tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.asarray([(i, i) for i in x], [("a", object), ("b", dpnp.int32)])]] tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.asarray(x).astype(dpnp.int8)] diff --git a/tests/skipped_tests_gpu.tbl b/tests/skipped_tests_gpu.tbl index 6a4bd6e6bb87..d41fe24c3c70 100644 --- a/tests/skipped_tests_gpu.tbl +++ b/tests/skipped_tests_gpu.tbl @@ -138,19 +138,6 @@ tests/test_indexing.py::test_nonzero[[[0, 1, 2], [3, 0, 5], [6, 7, 0]]] tests/test_indexing.py::test_nonzero[[[0, 1, 0, 3, 0], [5, 0, 7, 0, 9]]] tests/test_indexing.py::test_nonzero[[[[1, 2], [0, 4]], [[0, 2], [0, 1]], [[0, 0], [3, 1]]]] tests/test_indexing.py::test_nonzero[[[[[1, 2, 3], [3, 4, 5]], [[1, 2, 3], [2, 1, 0]]], [[[1, 3, 5], [3, 1, 0]], [[0, 1, 2], [1, 3, 4]]]]] -tests/test_indexing.py::test_take[[[0, 1, 2], [3, 4, 5], [6, 7, 8]]-[[0, 0], [0, 0]]] -tests/test_indexing.py::test_take[[[0, 1, 2], [3, 4, 5], [6, 7, 8]]-[[1, 2], [1, 2]]] -tests/test_indexing.py::test_take[[[0, 1, 2], [3, 4, 5], [6, 7, 8]]-[[1, 2], [3, 4]]] -tests/test_indexing.py::test_take[[[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]-[[1, 2], [1, 2]]] -tests/test_indexing.py::test_take[[[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]-[[1, 2], [3, 4]]] -tests/test_indexing.py::test_take[[[[1, 2], [3, 4]], [[1, 2], [2, 1]], [[1, 3], [3, 1]]]-[[1, 2], [1, 2]]] -tests/test_indexing.py::test_take[[[[1, 2], [3, 4]], [[1, 2], [2, 1]], [[1, 3], [3, 1]]]-[[1, 2], [3, 4]]] -tests/test_indexing.py::test_take[[[[[1, 2], [3, 4]], [[1, 2], [2, 1]]], [[[1, 3], [3, 1]], [[0, 1], [1, 3]]]]-[[1, 2], [1, 2]]] -tests/test_indexing.py::test_take[[[[[1, 2], [3, 4]], [[1, 2], [2, 1]]], [[[1, 3], [3, 1]], [[0, 1], [1, 3]]]]-[[1, 2], [3, 4]]] -tests/test_indexing.py::test_take[[[[[1, 2, 3], [3, 4, 5]], [[1, 2, 3], [2, 1, 0]]], [[[1, 3, 5], [3, 1, 0]], [[0, 1, 2], [1, 3, 4]]]]-[[1, 2], [1, 2]]] -tests/test_indexing.py::test_take[[[[[1, 2, 3], [3, 4, 5]], [[1, 2, 3], [2, 1, 0]]], [[[1, 3, 5], [3, 1, 0]], [[0, 1, 2], [1, 3, 4]]]]-[[1, 2], [3, 4]]] -tests/test_indexing.py::test_take[[[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]], [[[13, 14, 15], [16, 17, 18]], [[19, 20, 21], [22, 23, 24]]]]-[[1, 2], [1, 2]]] -tests/test_indexing.py::test_take[[[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]], [[[13, 14, 15], [16, 17, 18]], [[19, 20, 21], [22, 23, 24]]]]-[[1, 2], [3, 4]]] tests/third_party/cupy/creation_tests/test_ranges.py::TestRanges::test_arange_no_dtype_int tests/third_party/cupy/indexing_tests/test_indexing.py::TestIndexing::test_take_no_axis tests/third_party/cupy/indexing_tests/test_insert.py::TestPlace_param_3_{n_vals=1, shape=(7,)}::test_place diff --git a/tests/test_indexing.py b/tests/test_indexing.py index c07beee0262e..6519576171d0 100644 --- a/tests/test_indexing.py +++ b/tests/test_indexing.py @@ -374,6 +374,12 @@ def test_select(): numpy.testing.assert_array_equal(expected, result) +@pytest.mark.parametrize("array_type", + [numpy.bool8, numpy.int32, numpy.int64, numpy.float32, numpy.float64, numpy.complex128], + ids=['bool8', 'int32', 'int64', 'float32', 'float64', 'complex128']) +@pytest.mark.parametrize("indices_type", + [numpy.int32, numpy.int64], + ids=['int32', 'int64']) @pytest.mark.parametrize("indices", [[[0, 0], [0, 0]], [[1, 2], [1, 2]], @@ -395,9 +401,9 @@ def test_select(): '[[[[1, 2], [3, 4]], [[1, 2], [2, 1]]], [[[1, 3], [3, 1]], [[0, 1], [1, 3]]]]', '[[[[1, 2, 3], [3, 4, 5]], [[1, 2, 3], [2, 1, 0]]], [[[1, 3, 5], [3, 1, 0]], [[0, 1, 2], [1, 3, 4]]]]', '[[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]], [[[13, 14, 15], [16, 17, 18]], [[19, 20, 21], [22, 23, 24]]]]']) -def test_take(array, indices): - a = numpy.array(array) - ind = numpy.array(indices) +def test_take(array, indices, array_type, indices_type): + a = numpy.array(array, dtype=array_type) + ind = numpy.array(indices, dtype=indices_type) ia = dpnp.array(a) iind = dpnp.array(ind) expected = numpy.take(a, ind) diff --git a/utils/dpnp_build_utils.py b/utils/dpnp_build_utils.py index d06096c4b086..2ccf211587d3 100644 --- a/utils/dpnp_build_utils.py +++ b/utils/dpnp_build_utils.py @@ -126,7 +126,7 @@ def find_cmplr(verbose=False): verbose=verbose) # try to find in Python environment - if not cmplr_include or not mathlib_path: + if not cmplr_include or not cmplr_libpath: if sys.platform in ['linux']: rel_include_path = os.path.join('include') rel_libdir_path = os.path.join('lib')