From 9a1919b6cb090879f25336d6919e0415ec0284fc Mon Sep 17 00:00:00 2001 From: mattip Date: Fri, 3 Nov 2023 08:22:39 +0200 Subject: [PATCH 1/4] simplify numpy openblas handling --- .github/workflows/numpy.yml | 55 +++---------------------------------- 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/.github/workflows/numpy.yml b/.github/workflows/numpy.yml index 4beadea..66f6688 100644 --- a/.github/workflows/numpy.yml +++ b/.github/workflows/numpy.yml @@ -44,71 +44,24 @@ jobs: with: python-version: ${{ matrix.python_version }} - - name: Install OpenBLAS (linux, macOS) - run: | - cd repo - python -c "import tools.openblas_support as obs; plat=obs.get_plat(); ilp64=obs.get_ilp64(); print(f'{plat=},{ilp64=}')" - basedir=$(python tools/openblas_support.py) - sudo cp -r $basedir/lib/* /usr/local/lib - sudo cp $basedir/include/* /usr/local/include - if: matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest' - - name: Install gfortran (macOS) run: | source repo/tools/wheels/gfortran_utils.sh install_gfortran if: matrix.os == 'macos-latest' - - name: Install requirements and numpy (windows) - shell: powershell + - name: Install dependencies and scipy-openblas run: | cd repo - $ErrorActionPreference = "Stop" - # choco install --confirm --no-progress --allow-downgrade rtools --version=4.3.5550 - # choco install -y --no-progress unzip - # choco install -y --no-progress --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite - echo "RTOOLS43_HOME=c:\rtools43" >> $env:GITHUB_ENV - - # mkdir C:/opt/openblas/openblas_dll - # mkdir C:/opt/32/lib/pkgconfig - # mkdir C:/opt/64/lib/pkgconfig - # $target=$(python -c "import tools.openblas_support as obs; plat=obs.get_plat(); ilp64=obs.get_ilp64(); target=f'openblas_{plat}.zip'; obs.download_openblas(target, plat, ilp64);print(target)") - # unzip -o -d c:/opt/ $target - # echo "PKG_CONFIG_PATH=c:\opt\64\lib\pkgconfig" >> $env:GITHUB_ENV - # copy C:/opt/64/bin/*.dll C:/opt/openblas/openblas_dll - - # Unfortunately all this doesn't work, so build without openblas python -m pip install --upgrade pip python -m pip install ninja - python -m pip install -r test_requirements.txt - python -m pip install . -v -Csetup-args="--vsenv" -Csetup-args="-Dblas=none" -Csetup-args="-Dlapack=none" -Csetup-args="-Dallow-noblas=true" - if: matrix.os == 'windows-latest' + python -m pip install -r test_requirements.txt spin scipy-openblas32 + spin config-openblas --with-scipy-openblas=32 - name: Install NumPy run: | cd repo - python -m pip install --upgrade pip - python -m pip install ninja - python -m pip install -r test_requirements.txt - python -m pip install . -v -Csetup-args="--vsenv" -Csetup-args="-Duse-ilp64=true" -Csetup-args="-Dblas-symbol-suffix=64_" - if: matrix.os != 'windows-latest' - - - name: 'Copy OpenBLAS DLL to site-packages' - shell: powershell - run: | - # copy from c:/opt/openblas/openblas_dll to numpy/.libs to ensure it can - # get loaded when numpy is imported (no RPATH on Windows) - $target = $(python -c "import sysconfig; print(sysconfig.get_path('platlib'))") - mkdir $target/numpy/.libs - echo "target is $target" - copy C:/opt/openblas/openblas_dll/*.dll $target/numpy/.libs - echo "contents of target" - ls -Path $target/numpy/.libs - echo "contents of _distributor_init.py" - type repo/numpy/_distributor_init.py - # Disable this step - if: matrix.os == 'wwwwindows-latest' - + python -m pip install . -v -Csetup-args="--vsenv" - name: Test shell: bash From d1407f58f5fa5387ac762cf672b67450880eb56a Mon Sep 17 00:00:00 2001 From: mattip Date: Fri, 3 Nov 2023 08:55:05 +0200 Subject: [PATCH 2/4] add PKG_CONFIG_PATH --- .github/workflows/numpy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/numpy.yml b/.github/workflows/numpy.yml index 66f6688..0bca66a 100644 --- a/.github/workflows/numpy.yml +++ b/.github/workflows/numpy.yml @@ -23,6 +23,7 @@ jobs: env: BITS: 64 NPY_USE_BLAS_ILP64: '1' + PKG_CONFIG_PATH: ${{ github.workspace }}/repo/.openblas runs-on: ${{ matrix.os }} strategy: fail-fast: false From 56a9516c0a3f38f5c4b0c43d70aaa4f92e8bd3b7 Mon Sep 17 00:00:00 2001 From: mattip Date: Fri, 3 Nov 2023 09:27:00 +0200 Subject: [PATCH 3/4] add PKG_CONFIG_PATH (2) --- .github/workflows/numpy.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/numpy.yml b/.github/workflows/numpy.yml index 0bca66a..94f32f0 100644 --- a/.github/workflows/numpy.yml +++ b/.github/workflows/numpy.yml @@ -23,7 +23,6 @@ jobs: env: BITS: 64 NPY_USE_BLAS_ILP64: '1' - PKG_CONFIG_PATH: ${{ github.workspace }}/repo/.openblas runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -60,8 +59,11 @@ jobs: spin config-openblas --with-scipy-openblas=32 - name: Install NumPy + env: + PKG_CONFIG_PATH: ${{ github.workspace }}/repo/.openblas run: | cd repo + python -c "import os; print('PKG_CONFIG_PATH', os.environ['PKG_CONFIG_PATH'])" python -m pip install . -v -Csetup-args="--vsenv" - name: Test From e223987314659bdf24002d8e7c521a19ea34b17e Mon Sep 17 00:00:00 2001 From: mattip Date: Fri, 3 Nov 2023 10:31:39 +0200 Subject: [PATCH 4/4] install pkgconfig on windows --- .github/workflows/numpy.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/numpy.yml b/.github/workflows/numpy.yml index 94f32f0..3d45b8b 100644 --- a/.github/workflows/numpy.yml +++ b/.github/workflows/numpy.yml @@ -40,6 +40,11 @@ jobs: submodules: recursive fetch-depth: 0 + - name: Install pkg-config + run: | + choco install -y --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite + if: matrix.os == 'windows-latest' + - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python_version }}