Skip to content

Commit b9a655f

Browse files
authored
Merge pull request #87 from mattip/wheel
Create an openblas wheel
2 parents f48875d + f76e4c2 commit b9a655f

File tree

14 files changed

+546
-114
lines changed

14 files changed

+546
-114
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 87 deletions
This file was deleted.

.github/workflows/multibuild.yml renamed to .github/workflows/posix.yml

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: multibuild
1+
name: posix
22

33
on:
44
push:
@@ -19,38 +19,29 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
os: [ubuntu-latest, macos-11]
22-
platform: [x64]
2322
PLAT: [i686, x86_64]
2423
INTERFACE64: ['0', '1']
25-
MB_ML_VER: ['', 2010, 2014]
24+
MB_ML_VER: ['2014']
2625
include:
2726
- os: macos-11
2827
PLAT: arm64
2928
INTERFACE64: '1'
30-
platform: [x64]
3129
- os: macos-11
3230
PLAT: arm64
3331
INTERFACE64: '0'
34-
platform: [x64]
3532
- os: ubuntu-latest
3633
PLAT: x86_64
3734
INTERFACE64: '1'
3835
MB_ML_LIBC: musllinux
3936
MB_ML_VER: _1_1
40-
platform: [x64]
4137
- os: ubuntu-latest
4238
PLAT: x86_64
4339
INTERFACE64: '0'
4440
MB_ML_LIBC: musllinux
4541
MB_ML_VER: _1_1
46-
platform: [x64]
4742
exclude:
48-
- os: macos-11
49-
PLAT: i686
50-
- os: macos-11
51-
MB_ML_VER: 2010
52-
- os: macos-11
53-
MB_ML_VER: 2014
43+
- PLAT: i686
44+
os: macos-11
5445
- PLAT: i686
5546
INTERFACE64: '1'
5647
env:
@@ -71,14 +62,13 @@ jobs:
7162
with:
7263
submodules: recursive
7364
fetch-depth: 0
74-
- name: Set up Python 3.8
75-
uses: actions/setup-python@v2
65+
- name: Set up Python
66+
uses: actions/setup-python@v4
7667
with:
77-
python-version: 3.8
68+
python-version: 3.7
7869
- name: Set extra env
7970
run: |
8071
if [ "macos-11" == "${{ matrix.os }}" ]; then
81-
ls /Library/Developer/CommandLineTools/SDKs
8272
echo "TRAVIS_OS_NAME=osx" >> $GITHUB_ENV;
8373
echo "LDFLAGS=-L/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/lib" >> $GITHUB_ENV;
8474
echo "LIBRARY_PATH=-L/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/lib" >> $GITHUB_ENV;
@@ -93,9 +83,9 @@ jobs:
9383
echo "DOCKER_TEST_IMAGE: ${DOCKER_TEST_IMAGE}"
9484
- name: Install VirtualEnv
9585
run: |
96-
python -m pip install --upgrade pip
86+
python3 -m pip install --upgrade pip
9787
pip install virtualenv
98-
- name: Build and Install Wheels
88+
- name: Build OpenBLAS
9989
run: |
10090
set -xeo pipefail
10191
if [[ "$PLAT" == "arm64" ]]; then
@@ -118,11 +108,30 @@ jobs:
118108
build_lib "$PLAT" "$INTERFACE64" "0"
119109
fi
120110
111+
- name: Build and test wheel
112+
run: |
113+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
114+
source travis-ci/build_wheel.sh
115+
else
116+
libc=${MB_ML_LIBC:-manylinux}
117+
docker_image=quay.io/pypa/${libc}${MB_ML_VER}_${PLAT}
118+
docker run --rm -e INTERFACE64="${INTERFACE64}" \
119+
-e MB_ML_LIBC="${MB_ML_LIBC}" \
120+
-v $(pwd):/openblas $docker_image \
121+
/bin/bash -xe /openblas/travis-ci/build_wheel.sh
122+
fi
123+
121124
- uses: actions/upload-artifact@v3
122125
with:
126+
name: openblas
123127
path: libs/openblas*.tar.gz
124128

125-
- name: Upload tarballs
129+
- uses: actions/upload-artifact@v3
130+
with:
131+
name: wheels
132+
path: dist/scipy_openblas*.whl
133+
134+
- name: Upload
126135
run: |
127136
set -ex
128137
TOKEN=${{ secrets.ANACONDA_SCIENTIFIC_PYTHON_UPLOAD }}

.github/workflows/windows.yml

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
name: Win
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
OPENBLAS_COMMIT: "c2f4bdb"
11+
OPENBLAS_ROOT: "c:\\opt"
12+
# Preserve working directory for calls into bash
13+
# Without this, invoking bash will cd to the home directory
14+
CHERE_INVOKING: "yes"
15+
BASH_PATH: "c:\\rtools40\\usr\\bin\\bash.exe"
16+
17+
jobs:
18+
build:
19+
strategy:
20+
matrix:
21+
plat: ['x64', 'x86']
22+
INTERFACE64: ['1', '0']
23+
os: [windows-latest]
24+
exclude:
25+
- plat: x86
26+
INTERFACE64: '1'
27+
fail-fast: false
28+
runs-on: ${{ matrix.os }}
29+
30+
steps:
31+
- uses: actions/checkout@v3
32+
- name: install-rtools
33+
run: |
34+
# rtools 42+ does not support 32 bits builds.
35+
choco install -y rtools --noprogress --force --version=4.0.0.20220206
36+
37+
- name: Set env variables
38+
run: |
39+
echo "START_DIR=$PWD" >> $env:GITHUB_ENV
40+
# For interpretation of MSYSTEM, see:
41+
# https://sourceforge.net/p/msys2/discussion/general/thread/b7dfdac8/#3939
42+
if ( "${{ matrix.plat }}" -eq "x86") {
43+
echo "PLAT=i686" >> $env:GITHUB_ENV
44+
echo "WHEEL_PLAT=win32" >> $env:GITHUB_ENV
45+
echo "MSYSTEM=MINGW32" >> $env:GITHUB_ENV
46+
echo "LDFLAGS=-static -static-libgcc" >> $env:GITHUB_ENV
47+
echo "BUILD_BITS=32" >> $env:GITHUB_ENV
48+
} else {
49+
echo "PLAT=x86_64" >> $env:GITHUB_ENV
50+
echo "WHEEL_PLAT=win_amd64" >> $env:GITHUB_ENV
51+
echo "MSYSTEM=UCRT64" >> $env:GITHUB_ENV
52+
echo "LDFLAGS=-lucrt -static -static-libgcc" >> $env:GITHUB_ENV
53+
echo "BUILD_BITS=64" >> $env:GITHUB_ENV
54+
}
55+
if ( ${{ matrix.INTERFACE64 }} -eq "1" ) {
56+
echo "INTERFACE64=1" >> $env:GITHUB_ENV
57+
}
58+
59+
- name: Build
60+
run: |
61+
git submodule update --init --recursive
62+
& $env:BASH_PATH -lc tools/build_openblas.sh
63+
64+
- name: Test
65+
run: |
66+
& $env:BASH_PATH -lc tools/build_gfortran.sh
67+
echo "Static test"
68+
.\for_test\test.exe
69+
echo "Dynamic test"
70+
.\for_test\test_dyn.exe
71+
72+
- name: Copy
73+
run: |
74+
cp for_test\test*.exe builds
75+
76+
- name: Set up Python
77+
uses: actions/setup-python@v4
78+
with:
79+
python-version: 3.7
80+
architecture: ${{ matrix.plat }}
81+
82+
83+
- name: Build wheel
84+
shell: bash
85+
run: |
86+
set -xeo pipefail
87+
python -m pip install wheel
88+
# This will fail if there is more than one file in libs
89+
unzip -d local/scipy_openblas64 builds/openblas*.zip
90+
if [[ -d local/scipy_openblas64/64 ]]; then
91+
mv local/scipy_openblas64/64/* local/scipy_openblas64
92+
else
93+
mv local/scipy_openblas64/32/* local/scipy_openblas64
94+
fi
95+
mv local/scipy_openblas64/bin/*.dll local/scipy_openblas64/lib
96+
rm local/scipy_openblas64/lib/*.a
97+
rm local/scipy_openblas64/lib/*.exp
98+
rm local/scipy_openblas64/lib/*.def
99+
if [[ -d local/scipy_openblas64/64 ]]; then
100+
rm -rf local/scipy_openblas64/64
101+
else
102+
rm -rf local/scipy_openblas64/32
103+
fi
104+
if [[ "${INTERFACE64}" != "1" ]]; then
105+
mv local/scipy_openblas64 local/scipy_openblas32
106+
# rewrite the name of the project to scipy_openblas32
107+
# this is a hack, but apparently there is no other way to change the name
108+
# of a pyproject.toml project
109+
sed -e "s/openblas64/openblas32/" -i pyproject.toml
110+
sed -e "s/openblas_get_config64_/openblas_get_config/" -i local/scipy_openblas32/__init__.py
111+
sed -e "s/openblas64/openblas32/" -i local/scipy_openblas32/__main__.py
112+
fi
113+
114+
python -m pip wheel -w dist -vv .
115+
# move the mis-named scipy_openblas64-none-any.whl to a platform-specific name
116+
for f in dist/*.whl; do mv $f "${f/%any.whl/$WHEEL_PLAT.whl}"; done
117+
118+
- name: Set up different Python
119+
uses: actions/setup-python@v4
120+
with:
121+
python-version: 3.11
122+
architecture: ${{ matrix.plat }}
123+
124+
- uses: actions/upload-artifact@v3
125+
with:
126+
name: openblas
127+
path: builds/openblas*.zip
128+
129+
- uses: actions/upload-artifact@v3
130+
with:
131+
name: wheels
132+
path: dist/scipy_openblas*.whl
133+
134+
- name: Test 64-bit interface wheel
135+
if: matrix.INTERFACE64 == '1'
136+
shell: bash
137+
run: |
138+
python -m pip install --no-index --find-links dist scipy_openblas64
139+
python -m scipy_openblas64
140+
141+
- name: Test 32-bit interface wheel
142+
if: matrix.INTERFACE64 != '1'
143+
shell: bash
144+
run: |
145+
python -m pip install --no-index --find-links dist scipy_openblas32
146+
python -m scipy_openblas32
147+
148+
- uses: conda-incubator/setup-miniconda@v2
149+
with:
150+
activate-environment: upload
151+
152+
- name: Upload
153+
env:
154+
ANACONDA_SCIENTIFIC_PYTHON_UPLOAD: ${{ secrets.ANACONDA_SCIENTIFIC_PYTHON_UPLOAD }}
155+
run: |
156+
# Pin urllib3<2 due to github.com/Anaconda-Platform/anaconda-client/issues/654
157+
conda install "urllib3<2" anaconda-client
158+
& $env:BASH_PATH -lc tools/upload_to_anaconda_staging.sh

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,16 @@ builds/
44
*.pyc
55
*.swp
66
for_test/
7+
test.exe
8+
dist/
9+
build/
10+
libs/
11+
# These are artifacts when using editable builds
12+
local/lib
13+
local/include
14+
local/scipy_openblas64.egg-info
15+
local/scipy_openblas64/lib
16+
local/scipy_openblas64/include
17+
local/scipy_openblas64/*.so
18+
local/scipy_openblas64/*.pyd
19+
local/scipy_openblas64/*.dylib

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ install:
8686
script:
8787
# Build library and collect into libs subdirectory
8888
- build_lib "$PLAT" "$INTERFACE64"
89+
- libc=${MB_ML_LIBC:-manylinux}
90+
- docker_image=quay.io/pypa/${libc}${MB_ML_VER}_${PLAT}
91+
- docker run --rm -e INTERFACE64="${INTERFACE64}" -v $(pwd):/openblas $docker_image /bin/bash -xe /openblas/travis-ci/build_wheel.sh
8992

9093
after_success:
9194
# Upload libraries to the shared staging area on anaconda.org

OpenBLAS

0 commit comments

Comments
 (0)