diff --git a/.github/workflows/posix.yml b/.github/workflows/posix.yml index 12182965..d6475e16 100644 --- a/.github/workflows/posix.yml +++ b/.github/workflows/posix.yml @@ -29,7 +29,8 @@ jobs: fail-fast: false matrix: include: - - { os: ubuntu-latest, PLAT: i686, INTERFACE64: '0', MB_ML_VER: '_2_28', MB_ML_LIBC: manylinux} + # Pin docker builds to ubuntu-24.04 https://github.com/actions/runner-images/issues/14790 + - { os: ubuntu-24.04, PLAT: i686, INTERFACE64: '0', MB_ML_VER: '_2_28', MB_ML_LIBC: manylinux} - { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '0', MB_ML_VER: '_2_28', MB_ML_LIBC: manylinux} - { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '1', MB_ML_VER: '_2_28', MB_ML_LIBC: manylinux} @@ -58,8 +59,8 @@ jobs: - { os: ubuntu-24.04-arm, PLAT: riscv64, INTERFACE64: '0', MB_ML_VER: '_2_39', MB_ML_LIBC: manylinux} - { os: ubuntu-24.04-arm, PLAT: riscv64, INTERFACE64: '1', MB_ML_VER: '_2_39', MB_ML_LIBC: manylinux} - - { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '0', MB_ML_LIBC: android} - - { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '1', MB_ML_LIBC: android} + - { os: ubuntu-24.04, PLAT: x86_64, INTERFACE64: '0', MB_ML_LIBC: android} + - { os: ubuntu-24.04, PLAT: x86_64, INTERFACE64: '1', MB_ML_LIBC: android} - { os: ubuntu-latest, PLAT: arm64_v8a, INTERFACE64: '0', MB_ML_LIBC: android} - { os: ubuntu-latest, PLAT: arm64_v8a, INTERFACE64: '1', MB_ML_LIBC: android} diff --git a/.github/workflows/windows-arm.yml b/.github/workflows/windows-arm.yml index d6472edd..bce9ad0d 100644 --- a/.github/workflows/windows-arm.yml +++ b/.github/workflows/windows-arm.yml @@ -1,4 +1,4 @@ -name: Windows-on-ARM +name: Windows on: push: @@ -24,18 +24,30 @@ env: # Without this, invoking bash will cd to the home directory CHERE_INVOKING: "yes" BASH_PATH: "C:\\Program Files\\Git\\bin\\bash.exe" - PLAT: arm64 + LLVM_VERSION: "22.1.8" + NINJA_VERSION: "1.13.1" jobs: build: - runs-on: windows-11-arm + name: ${{ matrix.PLAT }}_${{ matrix.INTERFACE64 }} + runs-on: ${{ matrix.os }} timeout-minutes: 90 strategy: + fail-fast: false matrix: - INTERFACE64: ['1', '0'] + # Both architectures build with the same toolchain (clang-cl + + # flang-new + cmake + ninja) and the same script, so they differ only + # in the runner, the installer assets and the wheel tag. + include: + - { os: windows-latest, PLAT: x86_64, WHEEL_PLAT: win_amd64, PY_ARCH: x64, LLVM_ASSET: win64, NINJA_ASSET: win, INTERFACE64: '0' } + - { os: windows-latest, PLAT: x86_64, WHEEL_PLAT: win_amd64, PY_ARCH: x64, LLVM_ASSET: win64, NINJA_ASSET: win, INTERFACE64: '1' } + - { os: windows-11-arm, PLAT: arm64, WHEEL_PLAT: win_arm64, PY_ARCH: arm64, LLVM_ASSET: woa64, NINJA_ASSET: winarm64, INTERFACE64: '0' } + - { os: windows-11-arm, PLAT: arm64, WHEEL_PLAT: win_arm64, PY_ARCH: arm64, LLVM_ASSET: woa64, NINJA_ASSET: winarm64, INTERFACE64: '1' } env: + PLAT: ${{ matrix.PLAT }} + WHEEL_PLAT: ${{ matrix.WHEEL_PLAT }} INTERFACE64: ${{ matrix.INTERFACE64 }} # A scheduled or manually triggered run builds against the latest # OpenBLAS HEAD instead of openblas_commit.txt @@ -50,28 +62,39 @@ jobs: uses: actions/setup-python@v6.2.0 with: python-version: 3.12 - architecture: arm64 + architecture: ${{ matrix.PY_ARCH }} - name: Download and install LLVM installer + # The runner images' preinstalled LLVM has no flang; the official + # installer does. run: | - Invoke-WebRequest https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.8/LLVM-20.1.8-woa64.exe -UseBasicParsing -OutFile LLVM-woa64.exe - Start-Process -FilePath ".\LLVM-woa64.exe" -ArgumentList "/S" -Wait + $url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${env:LLVM_VERSION}/LLVM-${env:LLVM_VERSION}-${{ matrix.LLVM_ASSET }}.exe" + echo "Downloading $url" + Invoke-WebRequest $url -UseBasicParsing -OutFile LLVM-installer.exe + Start-Process -FilePath ".\LLVM-installer.exe" -ArgumentList "/S" -Wait echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - name: Install CMake and Ninja for Win-ARM64 + - name: Install Ninja + shell: pwsh + run: | + $url = "https://github.com/ninja-build/ninja/releases/download/v${env:NINJA_VERSION}/ninja-${{ matrix.NINJA_ASSET }}.zip" + echo "Downloading $url" + Invoke-WebRequest $url -OutFile ninja.zip + Expand-Archive ninja.zip -DestinationPath ninja + Copy-Item ninja\ninja.exe -Destination "C:\Windows\System32" + + - name: Install CMake for Win-ARM64 + # windows-latest already ships a usable cmake; the ARM64 image does not. + if: matrix.PLAT == 'arm64' shell: pwsh run: | Invoke-WebRequest https://github.com/Kitware/CMake/releases/download/v3.29.4/cmake-3.29.4-windows-arm64.msi -OutFile cmake-arm64.msi Start-Process msiexec.exe -ArgumentList "/i cmake-arm64.msi /quiet /norestart" -Wait echo "C:\Program Files\CMake\bin" >> $env:GITHUB_PATH - Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.13.1/ninja-winarm64.zip -OutFile ninja-winarm64.zip - Expand-Archive ninja-winarm64.zip -DestinationPath ninja - Copy-Item ninja\ninja.exe -Destination "C:\Windows\System32" - - name: Set env variables run: | - if ( ${{ matrix.INTERFACE64 }} -eq "1" ) { + if ( "${{ matrix.INTERFACE64 }}" -eq "1" ) { echo "INTERFACE_BITS=64" >> $env:GITHUB_ENV } else { echo "INTERFACE_BITS=32" >> $env:GITHUB_ENV @@ -80,9 +103,9 @@ jobs: - name: Build run: | git submodule update --init --recursive - .\tools\build_steps_win_arm64.bat 64 ${env:INTERFACE_BITS} + .\tools\build_steps_win.bat 64 ${env:INTERFACE_BITS} - - name: Test ${{ matrix.INTERFACE_BITS }}-bit interface wheel + - name: Test wheel, INTERFACE64=${{ matrix.INTERFACE64 }} run: | python -m pip install --no-index --find-links dist scipy_openblas${env:INTERFACE_BITS} python -m scipy_openblas${env:INTERFACE_BITS} @@ -90,7 +113,7 @@ jobs: - uses: actions/upload-artifact@v6.0.0 with: - name: wheels-${{ env.PLAT }}-${{ env.INTERFACE64 }} + name: wheels-${{ matrix.PLAT }}-${{ matrix.INTERFACE64 }} path: dist/scipy_openblas*.whl upload: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 18b0eb89..6aa78e06 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -22,18 +22,16 @@ env: # Preserve working directory for calls into bash # Without this, invoking bash will cd to the home directory CHERE_INVOKING: "yes" - BASH_PATH: "c:\\rtools40\\usr\\bin\\bash.exe" + BASH_PATH: "c:\\rtools45\\usr\\bin\\bash.exe" jobs: build: + if: false # disable strategy: matrix: - plat: ['x64', 'x86'] + plat: ['x64'] INTERFACE64: ['1', '0'] os: [windows-latest] - exclude: - - plat: x86 - INTERFACE64: '1' fail-fast: false runs-on: ${{ matrix.os }} @@ -46,30 +44,19 @@ jobs: timeout-minutes: 90 steps: - uses: actions/checkout@v6.0.1 - - name: install-rtools - run: | - # rtools 42+ does not support 32 bits builds. - choco install -y rtools --no-progress --force --version=4.0.0.20220206 + # Already installed + # - name: install-rtools + # run: | + # choco install -y rtools --no-progress --force --version=4.5.6768 - name: Set env variables run: | echo "START_DIR=$PWD" >> $env:GITHUB_ENV - # For interpretation of MSYSTEM, see: - # https://sourceforge.net/p/msys2/discussion/general/thread/b7dfdac8/#3939 - if ( "${{ matrix.plat }}" -eq "x86") { - echo "PLAT=i686" >> $env:GITHUB_ENV - echo "WHEEL_PLAT=win32" >> $env:GITHUB_ENV - echo "MSYSTEM=MINGW32" >> $env:GITHUB_ENV - # No ucrt on 32-bits, so use _snprintf_c instead - echo "LDFLAGS=-static -static-libgcc -Wl,--defsym,_quadmath_snprintf=__snprintf_c" >> $env:GITHUB_ENV - echo "BUILD_BITS=32" >> $env:GITHUB_ENV - } else { - echo "PLAT=x86_64" >> $env:GITHUB_ENV - echo "WHEEL_PLAT=win_amd64" >> $env:GITHUB_ENV - echo "MSYSTEM=UCRT64" >> $env:GITHUB_ENV - echo "LDFLAGS=-lucrt -static -static-libgcc -Wl,--defsym,quadmath_snprintf=snprintf" >> $env:GITHUB_ENV - echo "BUILD_BITS=64" >> $env:GITHUB_ENV - } + echo "PLAT=x86_64" >> $env:GITHUB_ENV + echo "WHEEL_PLAT=win_amd64" >> $env:GITHUB_ENV + echo "MSYSTEM=UCRT64" >> $env:GITHUB_ENV + echo "LDFLAGS=-lucrt -static -static-libgcc -Wl,--defsym,quadmath_snprintf=snprintf" >> $env:GITHUB_ENV + echo "BUILD_BITS=64" >> $env:GITHUB_ENV if ( ${{ matrix.INTERFACE64 }} -eq "1" ) { echo "INTERFACE64=1" >> $env:GITHUB_ENV } @@ -185,6 +172,7 @@ jobs: github.repository == 'MacPython/openblas-libs' && !inputs.publish && github.event_name != 'pull_request' + && false # disable name: Upload to anaconda.org needs: build runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index 019d8b61..45df8ca0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## OpenBLAS v0.3.34 (v0.3.34) +### 0.3.34.481.4 (2026-11-19) + +- Drop 32-bit windows wheels, update rtools + ### 0.3.34.481.3 (2026-11-2) - Refactor gha upload to anaconda.org diff --git a/pyproject.toml b/pyproject.toml index f03f77a9..1a9b3199 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta" [project] name = "scipy-openblas64" # 0.3.34-481-g5137bb62 -version = "0.3.34.481.3" +version = "0.3.34.481.4" requires-python = ">=3.7" description = "Provides OpenBLAS for python packaging" readme = "README.md" diff --git a/tools/build_steps_win_arm64.bat b/tools/build_steps_win.bat similarity index 67% rename from tools/build_steps_win_arm64.bat rename to tools/build_steps_win.bat index 6446b3ca..a4f925d1 100755 --- a/tools/build_steps_win_arm64.bat +++ b/tools/build_steps_win.bat @@ -1,17 +1,17 @@ -REM Build script for scipy_openblas wheel on Windows on ARM64 +REM Build script for scipy_openblas wheels on Windows, x86_64 and ARM64 alike. -REM Usage: build_steps_win_arm64.bat [build_bits] [if_bits] -REM e.g build_steps_win_arm64.bat 64 64 +REM Usage: build_steps_win.bat [build_bits] [if_bits] +REM e.g build_steps_win.bat 64 64 REM build_bits (default binary architecture, 32 or 64, unspec -> 64). REM if_bits (default interface size, 32 or 64, unspec -> 32) REM If INTERFACE64 environment variable is 1, then if_bits defaults to 64 +REM PLAT (target architecture, x86_64 or arm64; unspec -> derived from +REM PROCESSOR_ARCHITECTURE) +REM WHEEL_PLAT (wheel platform tag, win_amd64 or win_arm64; unspec -> +REM derived from PLAT) REM Expects these binaries on the PATH: -REM clang-cl, flang-new, cmake, perl -REM First commit containing WoA build fixes. -REM Minimum OpenBLAS commit to build; we'll update to this if commit not -REM present. -set first_woa_buildable_commit="de2380e5a6149706a633322a16a0f66faa5591fc" +REM clang-cl, flang, cmake, perl @echo off setlocal enabledelayedexpansion @@ -31,8 +31,29 @@ if "%2"=="" ( ) else ( set "if_bits=%2" ) -echo Building for %build_bits%-bit binary, %if_bits%-bit interface... - +REM Resolve the target architecture. The workflow passes PLAT and WHEEL_PLAT, +REM but derive them when running locally so the script is usable by hand. +if "%PLAT%"=="" ( + if /I "%PROCESSOR_ARCHITECTURE%"=="ARM64" ( + set "PLAT=arm64" + ) else ( + set "PLAT=x86_64" + ) +) +if "%WHEEL_PLAT%"=="" ( + if "%PLAT%"=="arm64" ( + set "WHEEL_PLAT=win_arm64" + ) else ( + set "WHEEL_PLAT=win_amd64" + ) +) +if "%PLAT%"=="arm64" ( + set "vcvars_arch=arm64" +) else ( + set "vcvars_arch=x64" +) +echo Building %PLAT% for %build_bits%-bit binary, %if_bits%-bit interface, wheel tag %WHEEL_PLAT%... + REM Define destination directory pushd "%~dp0\.." set "ob_out_root=%CD%\local\scipy_openblas" @@ -70,13 +91,7 @@ if "%NIGHTLY%"=="true" ( git checkout %OPENBLAS_COMMIT% ) if errorlevel 1 exit /b 1 -git merge-base --is-ancestor %first_woa_buildable_commit% HEAD 2>NUL -if errorlevel 1 ( - echo OpenBLAS commit does not contain WoA build fixes. - echo Commit needs to contain %first_woa_buildable_commit%. - exit /b 2 -) - + REM Patch set patch_rc=0 for %%f in (..\patches-common\*.patch ..\patches\*.patch ..\patches-windows\*.patch) do ( @@ -113,9 +128,9 @@ REM Create build directory and navigate to it if exist build (rmdir /S /Q build || exit /b 1) mkdir build || exit /b 1 & cd build || exit /b 1 -echo Setting up ARM64 Developer Command Prompt and running CMake... +echo Setting up %vcvars_arch% Developer Command Prompt and running CMake... -REM Initialize VS ARM64 environment. +REM Initialize the VS environment for the target architecture. REM REM Ask vswhere where Visual Studio is rather than hardcoding the version and REM edition: the windows-11-arm image migrated from VS 2022 to VS 2026 in @@ -144,9 +159,9 @@ if not exist "%VCVARSALL%" ( exit /b 1 ) echo Using Visual Studio at "%VSINSTALL%" -CALL "%VCVARSALL%" arm64 +CALL "%VCVARSALL%" %vcvars_arch% if errorlevel 1 ( - echo Error: "%VCVARSALL%" arm64 failed. + echo Error: "%VCVARSALL%" %vcvars_arch% failed. exit /b 1 ) where mt.exe >NUL 2>&1 @@ -159,22 +174,81 @@ if errorlevel 1 ( REM Prefer LLVM flang PATH=C:\Program Files\LLVM\bin;%PATH% +REM Visual Studio ships its own LLVM with an incomplete flang, so confirm +REM which compilers we actually resolved to. +where clang-cl +if errorlevel 1 ( + echo Error: clang-cl is not on PATH. + exit /b 1 +) +where flang +if errorlevel 1 ( + echo Error: flang is not on PATH. + exit /b 1 +) +clang-cl --version +flang --version + +REM flang's objects carry a /DEFAULTLIB:flang_rt.runtime.dynamic directive, but +REM OpenBLAS links the DLL with a hand-written lld-link call (no flang driver, +REM no /LIBPATH), so the runtime archive must be findable through LIB. It +REM lives in LLVM's per-target resource directory, whose version component +REM tracks the LLVM release, so look it up rather than hardcoding it. +if "%PLAT%"=="arm64" ( + set "flang_rt_triple=aarch64-pc-windows-msvc" +) else ( + set "flang_rt_triple=x86_64-pc-windows-msvc" +) +REM "for /d" over a quoted wildcard matches nothing, and the path has a space +REM in it, so list the version directories with dir instead. +set "clang_res_root=C:\Program Files\LLVM\lib\clang" +set "FLANG_RT_DIR=" +for /f "delims=" %%v in ('dir /b /ad "%clang_res_root%" 2^>NUL') do ( + if exist "%clang_res_root%\%%v\lib\%flang_rt_triple%\flang_rt.runtime.dynamic.lib" set "FLANG_RT_DIR=%clang_res_root%\%%v\lib\%flang_rt_triple%" +) +if not defined FLANG_RT_DIR ( + echo Error: no flang_rt.runtime.dynamic.lib for %flang_rt_triple% under + echo "%clang_res_root%" - the DLL link would fail with + echo "lld-link: error: could not open flang_rt.runtime.dynamic.lib". + exit /b 1 +) +echo Using flang runtime from "%FLANG_RT_DIR%" +set "LIB=%FLANG_RT_DIR%;%LIB%" + REM Run CMake and Ninja build -set CFLAGS=-Wno-reserved-macro-identifier -Wno-unsafe-buffer-usage -Wno-unused-macros -Wno-sign-conversion -Wno-reserved-identifier +REM CONSISTENT_FPCSR is x86-only: it makes blas_server_win32.c save and restore +REM the FPU/SSE control words with ldmxcsr/fldcw/fnstcw/stmxcsr inline asm, +REM which clang-cl rejects on arm64 ("unrecognized instruction mnemonic"). +if "%PLAT%"=="arm64" ( + set "arch_flags=-DTARGET=ARMV8 -DCMAKE_SYSTEM_PROCESSOR=arm64 -DCMAKE_SYSTEM_NAME=Windows" +) else ( + set "arch_flags=-DTARGET=PRESCOTT -DDYNAMIC_ARCH=ON -DDYNAMIC_LIST=NEHALEM;SANDYBRIDGE;HASWELL;SKYLAKEX -DCONSISTENT_FPCSR=1" +) + +REM OpenBLAS's cmake/cc.cmake appends -Wall for any Clang, but clang-cl parses +REM -Wall as MSVC /Wall, i.e. -Weverything: that produced 63k warnings and a +REM 30MB log. It is appended to CMAKE_C_FLAGS after anything we put in CFLAGS, +REM so the only slot that lands later is CMAKE_C_FLAGS_RELEASE. +set CFLAGS= +set "release_flags=/MD /O2 /Ob2 /DNDEBUG -Wno-everything" cmake .. -G Ninja ^ -DCMAKE_BUILD_TYPE=Release ^ - -DTARGET=ARMV8 ^ + -DCMAKE_C_FLAGS_RELEASE="%release_flags%" ^ -DBINARY=%build_bits% ^ -DCMAKE_C_COMPILER=clang-cl ^ - -DCMAKE_Fortran_COMPILER=flang-new ^ + -DCMAKE_Fortran_COMPILER=flang ^ -DBUILD_SHARED_LIBS=ON ^ - -DCMAKE_SYSTEM_PROCESSOR=arm64 ^ - -DCMAKE_SYSTEM_NAME=Windows ^ -DSYMBOLPREFIX="scipy_" ^ -DLIBNAMEPREFIX="scipy_" ^ - -DUSE_THREADS=1 ^ + -DUSE_THREAD=1 ^ + -DUSE_OPENMP=0 ^ -DNUM_THREADS=24 ^ + -DNO_WARMUP=1 ^ + -DBUILD_LAPACK_DEPRECATED=ON ^ + -DFIXED_LIBNAME=1 ^ + -DBUFFERSIZE=20 ^ + %arch_flags% ^ %interface_flags% if errorlevel 1 exit /b 1 @@ -248,6 +322,14 @@ if errorlevel 1 ( exit /b 1 ) +REM Append the bundled-software notices to LICENSE.txt, as the posix build and +REM the old mingw Windows build both do. +(echo.)>> LICENSE.txt +(echo ----)>> LICENSE.txt +(echo.)>> LICENSE.txt +type tools\LICENSE_win32.txt >> LICENSE.txt +if errorlevel 1 exit /b 1 + REM Build the Wheel & Install It echo Running 'python -m build' to build the wheel in %CD% python -c "import build" 2>NUL || pip install build @@ -269,7 +351,7 @@ REM Rename the wheel for %%f in (dist\*any.whl) do ( set WHEEL_FILE=dist\%%f set "filename=%%~nxf" - set "newname=!filename:any.whl=win_arm64.whl!" + set "newname=!filename:any.whl=%WHEEL_PLAT%.whl!" ren "dist\!filename!" "!newname!" )