From c91f91282c6b0e0528445fd5b0cc4ce8e16946d3 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Thu, 8 Sep 2022 07:15:32 -0500 Subject: [PATCH] Add workflow for Win Fix typo Relax a strict pinning for numpy & cmake Update run command for conda build on Win Fix declaring DPLROOT env Fix DPLROOT source Fix DPLROOT for Win Add missing double quotes Try conda-incubator for Linux Setup conda-incubator for Linux Update caching Exclude python 3.8 Strickly pin on 3.8.13 Change channel order Fix artifcat uploading Replace to single quotes Add missing backslash Corect backslash --- .github/workflows/conda-package.yml | 178 ++++++++++++++++++++++++---- conda-recipe/bld.bat | 1 + conda-recipe/meta.yaml | 8 +- scripts/build_conda_package.sh | 2 +- utils/dpnp_build_utils.py | 2 +- 5 files changed, 164 insertions(+), 27 deletions(-) diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index e401cf78c837..00e05f687ea3 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -1,20 +1,35 @@ name: Conda package -on: push +on: + push: + branches: + - master + pull_request: env: - PACKAGE_NAME: dpctl + PACKAGE_NAME: dpnp + MODULE_NAME: dpnp + VER_SCRIPT1: "import json; f = open('ver.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] + 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 repo + - name: Checkout DPNP repo uses: actions/checkout@v3 with: fetch-depth: 0 @@ -24,44 +39,165 @@ 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 - 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 + + build_windows: + runs-on: windows-latest + + defaults: + run: + shell: cmd /C CALL {0} + + strategy: + matrix: + 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 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: 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: Install conda-build + run: conda install conda-build + + - name: Build conda package + run: conda build --no-test --python ${{ matrix.python }} -c dppy/label/dev -c intel -c defaults --override-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 + + upload_linux: + needs: build_linux + + if: ${{github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/')}} - upload: - needs: build - if: ${{ github.ref == 'refs/heads/master' }} runs-on: ubuntu-latest strategy: matrix: - python: [3.8, 3.9] + 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 + + upload_windows: + needs: build_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 + + strategy: + matrix: + python: ['3.8', '3.9'] 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 }} + + - 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 diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat index 1695b2e74c90..6d4389b93dd0 100644 --- a/conda-recipe/bld.bat +++ b/conda-recipe/bld.bat @@ -1,4 +1,5 @@ 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%" IF DEFINED DPLROOT ( diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index bc705e2715d2..c24d86e5473b 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -8,16 +8,16 @@ requirements: host: - python - setuptools - - numpy 1.19 + - numpy >=1.19 - 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 diff --git a/scripts/build_conda_package.sh b/scripts/build_conda_package.sh index c9ad065b1509..ae9474e1f773 100755 --- a/scripts/build_conda_package.sh +++ b/scripts/build_conda_package.sh @@ -5,7 +5,7 @@ DPLROOT=$2 export DPLROOT -CHANNELS="-c dppy/label/dev -c intel -c defaults --override-channels" +CHANNELS="-c dppy/label/dev -c defaults -c intel --override-channels" VERSIONS="--python $PYTHON_VERSION" TEST="--no-test" 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')