Skip to content

Commit e1ccd4b

Browse files
authored
Merge branch 'numpy:main' into big-endian-ci
2 parents 61406c5 + c3dd685 commit e1ccd4b

33 files changed

+1862
-542
lines changed

.github/workflows/build_wheels.yml

Lines changed: 87 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -21,50 +21,35 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- uses: actions/checkout@v3
24-
with:
25-
submodules: recursive
2624

2725
- name: Set up Python
2826
uses: actions/setup-python@v4
2927
with:
30-
python-version: ">=3.10.0"
31-
32-
- name: Verify QuadBLAS submodule
33-
run: |
34-
ls -la quaddtype/numpy_quaddtype/QBLAS/
35-
ls -la quaddtype/numpy_quaddtype/QBLAS/include/quadblas/
28+
python-version: ">=3.11.0"
3629

3730
- name: Install cibuildwheel
38-
run: pip install cibuildwheel==2.20.0
31+
run: pip install cibuildwheel==3.1.4
3932

4033
- name: Build wheels
4134
env:
42-
CIBW_BUILD: "cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64"
35+
CIBW_BUILD: "cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64 cp313t-manylinux_x86_64 cp314-manylinux_x86_64 cp314t-manylinux_x86_64"
36+
CIBW_ENABLE: cpython-prerelease cpython-freethreading
4337
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
4438
CIBW_BUILD_VERBOSITY: "3"
4539
CIBW_BEFORE_ALL: |
4640
yum update -y
4741
yum install -y cmake gcc gcc-c++ make git pkgconfig
48-
# Install SLEEF in container
49-
git clone --branch 3.8 https://github.com/shibatch/sleef.git
50-
cd sleef
51-
cmake -S . -B build \
52-
-DSLEEF_BUILD_QUAD:BOOL=ON \
53-
-DSLEEF_BUILD_SHARED_LIBS:BOOL=ON \
54-
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
55-
cmake --build build/ --clean-first -j
56-
cmake --install build --prefix /usr/local
5742
CIBW_ENVIRONMENT: >
58-
CFLAGS="-I/usr/local/include -I{project}/numpy_quaddtype/QBLAS/include $CFLAGS"
59-
CXXFLAGS="-I/usr/local/include -I{project}/numpy_quaddtype/QBLAS/include -fext-numeric-literals $CXXFLAGS"
60-
LDFLAGS="-L/usr/local/lib64 -L/usr/local/lib -Wl,-rpath,/usr/local/lib64 -Wl,-rpath,/usr/local/lib -fopenmp $LDFLAGS"
61-
LD_LIBRARY_PATH="/usr/local/lib64:/usr/local/lib:$LD_LIBRARY_PATH"
62-
PKG_CONFIG_PATH="/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
43+
LDFLAGS="-fopenmp"
6344
CIBW_REPAIR_WHEEL_COMMAND: |
6445
auditwheel repair -w {dest_dir} --plat manylinux_2_28_x86_64 {wheel}
6546
CIBW_TEST_COMMAND: |
6647
pip install {package}[test]
67-
pytest -s {project}/tests
48+
if python -c "import sys; exit(0 if hasattr(sys, '_is_gil_enabled') and not sys._is_gil_enabled() else 1)"; then
49+
pytest --parallel-threads=10 --iterations=10 {project}/tests
50+
else
51+
pytest -s {project}/tests
52+
fi
6853
CIBW_TEST_EXTRAS: "test"
6954
run: |
7055
python -m cibuildwheel --output-dir wheelhouse
@@ -80,63 +65,49 @@ jobs:
8065
runs-on: ${{ matrix.os }}
8166
strategy:
8267
matrix:
83-
os: [macos-13, macos-14]
68+
os: [macos-14, macos-15]
8469

8570
steps:
8671
- uses: actions/checkout@v3
87-
with:
88-
submodules: recursive
8972

9073
- name: Set up Python
9174
uses: actions/setup-python@v4
9275
with:
93-
python-version: "3.10"
76+
python-version: ">=3.11.0"
9477

9578
- name: Install dependencies
9679
run: |
97-
brew install cmake libomp git
98-
99-
- name: Install SLEEF
100-
env:
101-
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.os == 'macos-13' && '13.0' || '14.0' }}
102-
run: |
103-
git clone --branch 3.8 https://github.com/shibatch/sleef.git
104-
cd sleef
105-
cmake -S . -B build \
106-
-DSLEEF_BUILD_QUAD:BOOL=ON \
107-
-DSLEEF_BUILD_SHARED_LIBS:BOOL=ON \
108-
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
109-
-DCMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.os == 'macos-13' && '13.0' || '14.0' }} \
110-
-DCMAKE_INSTALL_RPATH="@loader_path/../lib" \
111-
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
112-
cmake --build build/ --clean-first -j
113-
sudo cmake --install build --prefix /usr/local
114-
115-
- name: Verify QuadBLAS submodule
80+
packages="cmake libomp git"
81+
echo "Remove preinstalled dependencies"
82+
for pkg in $packages; do
83+
brew uninstall --ignore-dependencies $pkg 2>/dev/null || true
84+
done
85+
brew cleanup
86+
brew install $packages
87+
88+
- name: Installing Python dependencies
11689
run: |
117-
ls -la quaddtype/numpy_quaddtype/QBLAS/
118-
ls -la quaddtype/numpy_quaddtype/QBLAS/include/quadblas/
119-
120-
- name: Install cibuildwheel
121-
run: pip install cibuildwheel==2.20.0
90+
pip install -U pip
91+
pip install cibuildwheel==3.1.4
92+
pip install pytest-run-parallel
12293
12394
- name: Build wheels
12495
env:
125-
CIBW_BUILD: "cp310-* cp311-* cp312-*"
126-
CIBW_ARCHS_MACOS: ${{ matrix.os == 'macos-13' && 'x86_64' || 'arm64' }}
96+
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-* cp313t-* cp314t-*"
97+
CIBW_ENABLE: cpython-prerelease cpython-freethreading
98+
# CIBW_ARCHS_MACOS: ${{ matrix.os == 'macos-13' && 'x86_64' || 'arm64' }}
12799
CIBW_BUILD_VERBOSITY: "3"
128100
CIBW_ENVIRONMENT: >
129-
MACOSX_DEPLOYMENT_TARGET="${{ matrix.os == 'macos-13' && '13.0' || '14.0' }}"
130-
DYLD_LIBRARY_PATH="/usr/local/lib:$DYLD_LIBRARY_PATH"
131-
CFLAGS="-I/usr/local/include -I{project}/numpy_quaddtype/QBLAS/include $CFLAGS"
132-
CXXFLAGS="-I/usr/local/include -I{project}/numpy_quaddtype/QBLAS/include $CXXFLAGS"
133-
LDFLAGS="-L/usr/local/lib $LDFLAGS"
134-
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
101+
MACOSX_DEPLOYMENT_TARGET="${{ matrix.os == 'macos-14' && '14.0' || '15.0' }}"
135102
CIBW_REPAIR_WHEEL_COMMAND: >
136103
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
137104
CIBW_TEST_COMMAND: |
138105
pip install {package}[test]
139-
pytest -s {project}/tests
106+
if python -c "import sys; exit(0 if hasattr(sys, '_is_gil_enabled') and not sys._is_gil_enabled() else 1)"; then
107+
pytest --parallel-threads=10 --iterations=10 {project}/tests
108+
else
109+
pytest -s {project}/tests
110+
fi
140111
CIBW_TEST_EXTRAS: "test"
141112
run: |
142113
python -m cibuildwheel --output-dir wheelhouse
@@ -157,67 +128,44 @@ jobs:
157128

158129
steps:
159130
- uses: actions/checkout@v3
160-
with:
161-
submodules: recursive
162131

163132
- name: Setup MSVC
164133
uses: ilammy/msvc-dev-cmd@v1
165134
with:
166135
arch: ${{ matrix.architecture }}
167136

168-
- name: Set up Python 3.10
137+
- name: Set up Python
169138
uses: actions/setup-python@v4
170139
with:
171-
python-version: "3.10"
140+
python-version: ">=3.11.0"
172141
architecture: ${{ matrix.architecture }}
173142

174143
- name: Install CMake
175144
uses: lukka/get-cmake@latest
176145

177-
- name: Verify QuadBLAS submodule
178-
shell: pwsh
179-
run: |
180-
Get-ChildItem quaddtype/numpy_quaddtype/QBLAS/
181-
Get-ChildItem quaddtype/numpy_quaddtype/QBLAS/include/quadblas/
182-
183-
- name: Clone and Build SLEEF
184-
shell: pwsh
185-
run: |
186-
git clone --branch 3.8 https://github.com/shibatch/sleef.git
187-
cd sleef
188-
cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture == 'x86' && 'Win32' || 'x64' }} -DSLEEF_BUILD_QUAD:BOOL=ON -DSLEEF_BUILD_SHARED_LIBS:BOOL=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON
189-
cmake --build build --config Release
190-
cmake --install build --prefix "C:/sleef" --config Release
191-
192146
- name: Install build dependencies
193147
shell: bash -l {0}
194148
run: |
195149
pip install -U pip
196-
pip install cibuildwheel==2.20.0 ninja meson meson-python numpy delvewheel pytest
150+
pip install cibuildwheel==3.1.4 ninja meson meson-python numpy delvewheel pytest
197151
198152
- name: Build wheels
199153
env:
200-
CIBW_BUILD: "cp310-* cp311-* cp312-*"
201-
CIBW_SKIP: "pp* cp36-* cp37-* cp38-* cp39-* cp313-*"
154+
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-* cp313t-* cp314t-*"
155+
CIBW_ENABLE: cpython-prerelease cpython-freethreading
156+
CIBW_SKIP: "pp* cp36-* cp37-* cp38-* cp39-*"
202157
CIBW_ARCHS_WINDOWS: ${{ matrix.architecture == 'x86' && 'x86' || 'AMD64' }}
203158
CIBW_BUILD_VERBOSITY: "3"
204159
DISTUTILS_USE_SDK: "1"
205160
MSSdk: "1"
206161
CIBW_BEFORE_BUILD: |
207162
pip install meson meson-python ninja numpy
208163
CIBW_ENVIRONMENT: >
209-
INCLUDE="C:/sleef/include;{project}/numpy_quaddtype/QBLAS/include;$INCLUDE"
210-
LIB="C:/sleef/lib;$LIB"
211-
PATH="C:/sleef/bin;$PATH"
212-
CFLAGS="/IC:/sleef/include /I{project}/numpy_quaddtype/QBLAS/include /DDISABLE_QUADBLAS $CFLAGS"
213-
CXXFLAGS="/IC:/sleef/include /I{project}/numpy_quaddtype/QBLAS/include /DDISABLE_QUADBLAS $CXXFLAGS"
214-
LDFLAGS="C:/sleef/lib/sleef.lib C:/sleef/lib/sleefquad.lib $LDFLAGS"
164+
CFLAGS="/DDISABLE_QUADBLAS $CFLAGS"
165+
CXXFLAGS="/DDISABLE_QUADBLAS $CXXFLAGS"
215166
CIBW_REPAIR_WHEEL_COMMAND: 'delvewheel repair -w {dest_dir} {wheel} --add-path C:\sleef\bin'
216-
CIBW_TEST_COMMAND: |
217-
pip install {package}[test]
218-
pytest -s {project}/tests
167+
CIBW_TEST_COMMAND_WINDOWS: pip install {package}[test] && pytest -s {project}/tests
219168
CIBW_TEST_EXTRAS: test
220-
CIBW_TEST_FAIL_FAST: 1
221169
shell: pwsh
222170
run: |
223171
python -m cibuildwheel --output-dir wheelhouse
@@ -229,9 +177,51 @@ jobs:
229177
path: ./quaddtype/wheelhouse/*.whl
230178
name: wheels-windows-${{ matrix.architecture }}
231179

180+
build_sdist:
181+
name: Build SDist
182+
runs-on: ubuntu-latest
183+
steps:
184+
- uses: actions/checkout@v3
185+
186+
- name: Set up Python
187+
uses: actions/setup-python@v4
188+
with:
189+
python-version: ">=3.11.0"
190+
191+
- name: Install system dependencies
192+
run: |
193+
sudo apt-get update -y
194+
sudo apt-get install -y cmake gcc g++ make git pkg-config
195+
196+
- name: Install build dependencies
197+
run: |
198+
python -m pip install --upgrade pip
199+
python -m pip install build pytest
200+
201+
- name: Build SDist & test sdist
202+
env:
203+
LDFLAGS: "-fopenmp"
204+
run: |
205+
python -m build --sdist --outdir dist/
206+
pip install dist/*.tar.gz -v
207+
pytest -s tests
208+
working-directory: ./quaddtype
209+
210+
- name: Upload SDist artifact
211+
uses: actions/upload-artifact@v4
212+
with:
213+
name: sdist
214+
path: ./quaddtype/dist/*.tar.gz
215+
232216
publish_to_pypi:
233217
name: Publish to PyPI
234-
needs: [build_wheels_linux, build_wheels_macos, build_wheels_windows]
218+
needs:
219+
[
220+
build_wheels_linux,
221+
build_wheels_macos,
222+
build_wheels_windows,
223+
build_sdist,
224+
]
235225
runs-on: ubuntu-latest
236226
if: startsWith(github.ref, 'refs/tags/quaddtype-v')
237227

@@ -246,9 +236,9 @@ jobs:
246236
- name: Download all workflow run artifacts
247237
uses: actions/download-artifact@v4
248238
with:
239+
pattern: "*"
249240
path: dist
241+
merge-multiple: true
250242

251243
- name: Publish to PyPI
252244
uses: pypa/gh-action-pypi-publish@release/v1
253-
with:
254-
packages-dir: dist/*

.github/workflows/ci.yml

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,35 +60,11 @@ jobs:
6060
sudo apt-get update
6161
sudo apt-get install -y libmpfr-dev libssl-dev libfftw3-dev
6262
63-
- name: Install SLEEF
64-
run: |
65-
sudo apt-get update -y
66-
sudo apt-get install -y cmake gcc g++ make git pkg-config
67-
git clone --branch 3.8 https://github.com/shibatch/sleef.git
68-
cd sleef
69-
cmake -S . -B build -DSLEEF_BUILD_QUAD:BOOL=ON -DSLEEF_BUILD_SHARED_LIBS:BOOL=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON
70-
cmake --build build/ --clean-first -j
71-
sudo cmake --install build --prefix /usr/local
72-
7363
- name: Install quaddtype
7464
working-directory: quaddtype
7565
run: |
76-
# Initialize submodules first
77-
git submodule update --init --recursive
78-
ls -la numpy_quaddtype/QBLAS/
79-
80-
# Set environment variables with proper export and correct paths
81-
export CFLAGS="-I/usr/local/include -I$(pwd)/numpy_quaddtype/QBLAS/include"
82-
export CXXFLAGS="-I/usr/local/include -I$(pwd)/numpy_quaddtype/QBLAS/include -fext-numeric-literals"
83-
export LDFLAGS="-L/usr/local/lib64 -L/usr/local/lib -Wl,-rpath,/usr/local/lib64 -Wl,-rpath,/usr/local/lib -fopenmp"
84-
export LD_LIBRARY_PATH="/usr/local/lib64:/usr/local/lib:$LD_LIBRARY_PATH"
85-
86-
# Install with meson args to ensure the C++ flags are passed through
87-
python -m pip install . -v --no-build-isolation \
88-
-Cbuilddir=build \
89-
-C'compile-args=-v' \
90-
-Csetup-args="-Dbuildtype=debug" \
91-
-Csetup-args="-Dcpp_args=-fext-numeric-literals"
66+
export LDFLAGS="-fopenmp"
67+
python -m pip install . -v
9268
9369
- name: Run quaddtype tests
9470
working-directory: quaddtype

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,8 @@ compile_commands.json
137137
*.whl
138138
.DS_Store
139139
.idea/
140+
141+
# quaddtype
142+
/quaddtype/subprojects/qblas/
143+
/quaddtype/subprojects/sleef/
144+
.wraplock

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "quaddtype/numpy_quaddtype/QBLAS"]
2-
path = quaddtype/numpy_quaddtype/QBLAS
3-
url = https://github.com/SwayamInSync/QBLAS

quaddtype/LICENSE

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Copyright (c) 2022, NumPy Developers.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are
6+
met:
7+
8+
* Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above
12+
copyright notice, this list of conditions and the following
13+
disclaimer in the documentation and/or other materials provided
14+
with the distribution.
15+
16+
* Neither the name of the NumPy Developers nor the names of any
17+
contributors may be used to endorse or promote products derived
18+
from this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)