Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions .github/workflows/posix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:

jobs:
build:
name: ${{ matrix.MB_ML_LIBC }}_${{ matrix.PLAT}}, ${{ matrix.INTERFACE64 == '1' && '64' || '32' }}
runs-on: ${{ matrix.os }}
defaults:
run:
Expand Down Expand Up @@ -57,12 +58,15 @@ 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-latest, PLAT: arm64_v8a, INTERFACE64: '0', MB_ML_LIBC: android}
- { os: ubuntu-latest, PLAT: arm64_v8a, INTERFACE64: '1', MB_ML_LIBC: android}

env:
NIGHTLY: ${{ inputs.publish == false && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
MB_ML_LIBC: ${{ matrix.MB_ML_LIBC }}
MB_ML_VER: ${{ matrix.MB_ML_VER }}
INTERFACE64: ${{ matrix.INTERFACE64 }}
PLAT: ${{ matrix.PLAT }}

steps:
- uses: actions/checkout@v6.0.1
Expand All @@ -82,10 +86,6 @@ jobs:
with:
platforms: all

- name: Print some Environment variable
run: |
echo "PLAT: ${PLAT}"

# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
Expand All @@ -96,11 +96,12 @@ jobs:
uses: pypa/cibuildwheel@v4.1.0
timeout-minutes: 60
with:
# For Android, cibuildwheel has a minimum of Python 3.13, but the exact version
# doesn't matter because setup.py will replace the tag with "py3".
only: "cp313-${{ matrix.MB_ML_LIBC }}_${{matrix.PLAT}}"
output-dir: dist
env:
CIBW_ARCHS: ${{matrix.PLAT}}
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: "cp39-${{ matrix.MB_ML_LIBC }}_${{matrix.PLAT}}"

CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.MB_ML_LIBC }}${{matrix.MB_ML_VER}}
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.MB_ML_LIBC }}${{matrix.MB_ML_VER}}
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,14 @@ jobs:
rm local/scipy_openblas64/lib/*.a
rm -f local/scipy_openblas64/lib/*.exp # may not exist?
rm local/scipy_openblas64/lib/*.def
rm -rf local/scipy_openblas64/lib/pkgconfig
if [[ -d local/scipy_openblas64/64 ]]; then
rm -rf local/scipy_openblas64/64
else
rm -rf local/scipy_openblas64/32
fi
sed -e "s/bin/lib/" -i local/scipy_openblas64/lib/cmake/openblas/OpenBLASConfig.cmake
sed -e "s/dll/lib/" -i local/scipy_openblas64/lib/cmake/openblas/OpenBLASConfig.cmake
mkdir local/scipy_openblas64/lib/pkgconfig

if [[ "${INTERFACE64}" != "1" ]]; then
mv local/scipy_openblas64 local/scipy_openblas32
# rewrite the name of the project to scipy-openblas32
Expand All @@ -138,10 +137,10 @@ jobs:
sed -e "s/cflags =.*/cflags = '-DBLAS_SYMBOL_PREFIX=scipy_'/" -i local/scipy_openblas32/__init__.py
sed -e "s/openblas64/openblas32/" -i local/scipy_openblas32/__init__.py
sed -e "s/openblas64/openblas32/" -i local/scipy_openblas32/__main__.py
PYTHONPATH=$PWD/local python -c "import scipy_openblas32 as s; print(s.get_pkg_config(use_prefix=True))" > local/scipy_openblas32/lib/pkgconfig/scipy-openblas.pc
else
PYTHONPATH=$PWD/local python -c "import scipy_openblas64 as s; print(s.get_pkg_config(use_prefix=True))" > local/scipy_openblas64/lib/pkgconfig/scipy-openblas.pc
fi

source tools/get_pkg_config.sh

echo "" >> LICENSE.txt
echo "----" >> LICENSE.txt
echo "" >> LICENSE.txt
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ local/scipy_openblas64/*.so
local/scipy_openblas64/*.pyd
local/scipy_openblas64/*.dylib
objconv/
wheelhouse/
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## OpenBLAS v0.3.34 (v0.3.34)

### 0.3.34.481.2 (2026-11-01)

- Add Android wheels

### 0.3.34.481.1 (2026-10-29)

- Add a weekly scheduled run to both Windows workflows against OpenBLAS HEAD.
Expand Down
5 changes: 5 additions & 0 deletions build-openblas.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#! /bin/bash

set -xeo pipefail

# Check the required environment variables are set.
: ${MB_ML_LIBC:?}
: ${PLAT:?}

source tools/build_steps.sh
echo "------ BEFORE BUILD ---------"
before_build
Expand Down
10 changes: 10 additions & 0 deletions ci-before-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ fi
export OPENBLAS_VERSION=$version
echo "creating wheel from $OPENBLAS_COMMIT (NIGHTLY is $NIGHTLY)"

libc_plat=${CIBUILDWHEEL_BUILD_IDENTIFIER#*-}
MB_ML_LIBC=${libc_plat%%_*}
PLAT=${libc_plat#*_}

BUILD_PREFIX="$(pwd)/build/prefix/$libc_plat"
rm -rf "$BUILD_PREFIX"
mkdir -p "$BUILD_PREFIX"

# On emulated architectures, RUNNER_ARCH makes manylinux-install-clang install a
# compiler for the native architecture, which will be much faster.
case "$PLAT" in
loongarch64|ppc64le|s390x|riscv64)
manylinux-install-clang -v 21.1.6.0
Expand Down
4 changes: 1 addition & 3 deletions ci-repair-wheel.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#! /bin/bash
set -xe

PYTHON=${PYTHON:-python3.9}

if [ $(uname) == "Darwin" ]; then
$PYTHON -m pip install delocate
python3 -m pip install delocate
# move the mis-named scipy_openblas64-none-any.whl to a platform-specific name
# if [ "${PLAT}" == "arm64" ]; then
# for f in $2/*.whl; do mv $f "${f/%any.whl/macosx_11_0_$PLAT.whl}"; done
Expand Down
13 changes: 3 additions & 10 deletions ci-test.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
#!/bin/bash
# Test that the wheel works with a different python

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this comment was ever true: the build and test previously both used Python 3.9, and now they're using Python 3.13.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once upon a time we built the wheel with 3.9 and tested with 3.11, but the move to 3.13 kind of messed that all up.

set -xe

if [ "${PLAT}" == "arm64" ]; then
# Cannot test
Comment on lines -5 to -6

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this was a leftover from when GitHub Actions didn't have ARM64 runners, because it works fine now.

exit 0
fi

PYTHON=python3.9
if [ "$(uname)" == "Darwin" -a "${PLAT}" == "x86_64" ]; then
which python3.9
PYTHON="arch -x86_64 python3.9"
PYTHON=python3
if [ "$CIBUILDWHEEL_BUILD_IDENTIFIER" = "macosx_x86_64" ]; then
PYTHON="arch -x86_64 python3"
fi

# Make sure the module works and that the version strings match
Expand Down
23 changes: 19 additions & 4 deletions local/scipy_openblas64/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import ctypes
import os
from pathlib import Path
import re
import sys
from textwrap import dedent
import platform
Expand Down Expand Up @@ -91,11 +92,20 @@ def get_pkg_config(use_preloading=False, use_prefix=False):
# Don't use `$prefix` since the file may be located outside the package tree
libdir = get_lib_dir()
incdir = get_include_dir()

variables = {}
with open(f"{get_lib_dir()}/pkgconfig/scipy-openblas.pc") as pc_file:
for line in pc_file:
# The CMake build used by Windows ARM64 produces a Version: keyword but not
# a version= variable, so parse both kinds of line.
if match := re.fullmatch(r"(.+?)[:=](.*)", line.strip()):
variables[match[1].strip()] = match[2].strip()

return dedent(f"""\
libdir={libdir}
includedir={incdir}
openblas_config= {get_openblas_config()}
version={get_openblas_config().split(" ")[1]}
openblas_config= {variables["openblas_config"]}
version={variables.get("version") or variables["Version"]}
extralib={extralib}
Name: openblas
Description: OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version
Expand Down Expand Up @@ -146,5 +156,10 @@ def get_openblas_config():
bytes = openblas_config()
return bytes.decode("utf8")

# Import the DLL which will make the namespace available to NumPy/SciPy
get_openblas_config()

if "CIBUILDWHEEL" in os.environ and sys.platform == "android":
# We're cross-compiling, so we can't load the library.
pass
else:
# Import the DLL which will make the namespace available to NumPy/SciPy
get_openblas_config()
30 changes: 23 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "scipy-openblas64"
# 0.3.34-481-g5137bb62
version = "0.3.34.481.1"
version = "0.3.34.481.2"
requires-python = ">=3.7"
description = "Provides OpenBLAS for python packaging"
readme = "README.md"
Expand Down Expand Up @@ -45,15 +45,31 @@ before-build = "bash ci-before-build.sh"
repair-wheel-command = "bash ci-repair-wheel.sh {dest_dir} {wheel}"
test-command = "cd {package} && bash ci-test.sh"
environment-pass = [
"OPENBLAS_COMMIT",
"NIGHTLY",
"MB_ML_LIBC",
"MB_ML_VER",
"INTERFACE64",
"BUILD_DIR",
"PLAT",
"OS-NAME",

# On emulated architectures, RUNNER_ARCH makes manylinux-install-clang install a
# compiler for the native architecture, which will be much faster.
"RUNNER_ARCH",
]

[tool.cibuildwheel.android]
# The Linux code in ci-repair-wheel.sh isn't relevant to Android, so use the default
# repair command from the cibuildwheel documentation.
repair-wheel-command = "auditwheel repair --ldpaths {ldpaths} -w {dest_dir} {wheel}"

# Mobile platforms only support Python test-commands, not shell scripts.
test-command = """python -c '
import runpy

def run_module(mod_name):
runpy.run_module(mod_name, run_name="__main__", alter_sys=True)

try:
run_module("scipy_openblas32")
except ImportError:
run_module("scipy_openblas64")
'"""

[project.entry-points.pkg_config]
scipy-openblas = 'scipy_openblas64.lib.pkgconfig'
18 changes: 5 additions & 13 deletions tools/build_prepare_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ if [ "$?" != "0" ]; then
# inside docker
cd /project
fi
PYTHON=${PYTHON:-python3.9}

mkdir -p local/openblas
mkdir -p dist

tar -C local/scipy_openblas64 --strip-components=2 -xf libs/openblas.tar.gz
rm -rf local/scipy_openblas64/{include,lib}
tar -C local/scipy_openblas64 -xf libs/openblas.tar.gz

# do not package the static libs and symlinks, only take the shared object
find local/scipy_openblas64/lib -maxdepth 1 -type l -delete
Expand All @@ -32,7 +32,7 @@ if [[ $py_version != $pkg_version* ]]; then
exit 1
fi

if [ $(uname) == "Darwin" ]; then
if [ "$MB_ML_LIBC" == "macosx" ]; then
soname=$(cd local/scipy_openblas64/lib; ls libscipy_openblas*.dylib)
echo otool -D local/scipy_openblas64/lib/$soname
otool -D local/scipy_openblas64/lib/$soname
Expand All @@ -41,18 +41,11 @@ if [ $(uname) == "Darwin" ]; then
install_name_tool -id @rpath/$soname local/scipy_openblas64/lib/$soname
fi

rm -rf local/scipy_openblas64/lib/pkgconfig
mkdir local/scipy_openblas64/lib/pkgconfig
echo "" >> LICENSE.txt
echo "----" >> LICENSE.txt
echo "" >> LICENSE.txt
cat tools/LICENSE_posix.txt >> LICENSE.txt

if [ "$(uname)" == "Darwin" -a "${PLAT}" == "x86_64" ]; then
PYTHON="arch -x86_64 python3"
else
PYTHON=python3
fi
if [ "${INTERFACE64}" != "1" ]; then
# rewrite the name of the project to scipy-openblas32
# this is a hack, but apparently there is no other way to change the name
Expand All @@ -67,11 +60,10 @@ if [ "${INTERFACE64}" != "1" ]; then
sed -e "s/openblas64/openblas32/" -i.bak local/scipy_openblas32/__main__.py
sed -e "s/openblas64/openblas32/" -i.bak local/scipy_openblas32/__init__.py
rm local/scipy_openblas32/*.bak
PYTHONPATH=$PWD/local $PYTHON -c "import scipy_openblas32 as s; print(s.get_pkg_config(use_prefix=True))" > local/scipy_openblas32/lib/pkgconfig/scipy-openblas.pc
else
PYTHONPATH=$PWD/local $PYTHON -c "import scipy_openblas64 as s; print(s.get_pkg_config(use_prefix=True))" > local/scipy_openblas64/lib/pkgconfig/scipy-openblas.pc
fi

source tools/get_pkg_config.sh

rm -rf dist/*


Expand Down
Loading
Loading