Skip to content

Commit 1d6e8eb

Browse files
authored
Merge pull request numpy#143 from SwayamInSync/main
Bundle SLEEF and submodules using meson wrap [sdist compatible]
2 parents b4a9429 + f14424c commit 1d6e8eb

File tree

16 files changed

+193
-222
lines changed

16 files changed

+193
-222
lines changed

.github/workflows/build_wheels.yml

Lines changed: 8 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,12 @@ 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:
3028
python-version: ">=3.11.0"
3129

32-
- name: Verify QuadBLAS submodule
33-
run: |
34-
ls -la quaddtype/numpy_quaddtype/QBLAS/
35-
ls -la quaddtype/numpy_quaddtype/QBLAS/include/quadblas/
36-
3730
- name: Install cibuildwheel
3831
run: pip install cibuildwheel==3.1.4
3932

@@ -46,21 +39,8 @@ jobs:
4639
CIBW_BEFORE_ALL: |
4740
yum update -y
4841
yum install -y cmake gcc gcc-c++ make git pkgconfig
49-
# Install SLEEF in container
50-
git clone --branch 3.8 https://github.com/shibatch/sleef.git
51-
cd sleef
52-
cmake -S . -B build \
53-
-DSLEEF_BUILD_QUAD:BOOL=ON \
54-
-DSLEEF_BUILD_SHARED_LIBS:BOOL=ON \
55-
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
56-
cmake --build build/ --clean-first -j
57-
cmake --install build --prefix /usr/local
5842
CIBW_ENVIRONMENT: >
59-
CFLAGS="-I/usr/local/include -I{project}/numpy_quaddtype/QBLAS/include $CFLAGS"
60-
CXXFLAGS="-I/usr/local/include -I{project}/numpy_quaddtype/QBLAS/include -fext-numeric-literals $CXXFLAGS"
61-
LDFLAGS="-L/usr/local/lib64 -L/usr/local/lib -Wl,-rpath,/usr/local/lib64 -Wl,-rpath,/usr/local/lib -fopenmp $LDFLAGS"
62-
LD_LIBRARY_PATH="/usr/local/lib64:/usr/local/lib:$LD_LIBRARY_PATH"
63-
PKG_CONFIG_PATH="/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
43+
LDFLAGS="-fopenmp"
6444
CIBW_REPAIR_WHEEL_COMMAND: |
6545
auditwheel repair -w {dest_dir} --plat manylinux_2_28_x86_64 {wheel}
6646
CIBW_TEST_COMMAND: |
@@ -89,8 +69,6 @@ jobs:
8969

9070
steps:
9171
- uses: actions/checkout@v3
92-
with:
93-
submodules: recursive
9472

9573
- name: Set up Python
9674
uses: actions/setup-python@v4
@@ -107,27 +85,6 @@ jobs:
10785
brew cleanup
10886
brew install $packages
10987
110-
- name: Install SLEEF
111-
env:
112-
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.os == 'macos-13' && '13.0' || '14.0' }}
113-
run: |
114-
git clone --branch 3.8 https://github.com/shibatch/sleef.git
115-
cd sleef
116-
cmake -S . -B build \
117-
-DSLEEF_BUILD_QUAD:BOOL=ON \
118-
-DSLEEF_BUILD_SHARED_LIBS:BOOL=ON \
119-
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
120-
-DCMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.os == 'macos-13' && '13.0' || '14.0' }} \
121-
-DCMAKE_INSTALL_RPATH="@loader_path/../lib" \
122-
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
123-
cmake --build build/ --clean-first -j
124-
sudo cmake --install build --prefix /usr/local
125-
126-
- name: Verify QuadBLAS submodule
127-
run: |
128-
ls -la quaddtype/numpy_quaddtype/QBLAS/
129-
ls -la quaddtype/numpy_quaddtype/QBLAS/include/quadblas/
130-
13188
- name: Installing Python dependencies
13289
run: |
13390
pip install -U pip
@@ -142,11 +99,6 @@ jobs:
14299
CIBW_BUILD_VERBOSITY: "3"
143100
CIBW_ENVIRONMENT: >
144101
MACOSX_DEPLOYMENT_TARGET="${{ matrix.os == 'macos-13' && '13.0' || '14.0' }}"
145-
DYLD_LIBRARY_PATH="/usr/local/lib:$DYLD_LIBRARY_PATH"
146-
CFLAGS="-I/usr/local/include -I{project}/numpy_quaddtype/QBLAS/include $CFLAGS"
147-
CXXFLAGS="-I/usr/local/include -I{project}/numpy_quaddtype/QBLAS/include $CXXFLAGS"
148-
LDFLAGS="-L/usr/local/lib $LDFLAGS"
149-
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
150102
CIBW_REPAIR_WHEEL_COMMAND: >
151103
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
152104
CIBW_TEST_COMMAND: |
@@ -176,8 +128,6 @@ jobs:
176128

177129
steps:
178130
- uses: actions/checkout@v3
179-
with:
180-
submodules: recursive
181131

182132
- name: Setup MSVC
183133
uses: ilammy/msvc-dev-cmd@v1
@@ -193,21 +143,6 @@ jobs:
193143
- name: Install CMake
194144
uses: lukka/get-cmake@latest
195145

196-
- name: Verify QuadBLAS submodule
197-
shell: pwsh
198-
run: |
199-
Get-ChildItem quaddtype/numpy_quaddtype/QBLAS/
200-
Get-ChildItem quaddtype/numpy_quaddtype/QBLAS/include/quadblas/
201-
202-
- name: Clone and Build SLEEF
203-
shell: pwsh
204-
run: |
205-
git clone --branch 3.8 https://github.com/shibatch/sleef.git
206-
cd sleef
207-
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
208-
cmake --build build --config Release
209-
cmake --install build --prefix "C:/sleef" --config Release
210-
211146
- name: Install build dependencies
212147
shell: bash -l {0}
213148
run: |
@@ -226,12 +161,8 @@ jobs:
226161
CIBW_BEFORE_BUILD: |
227162
pip install meson meson-python ninja numpy
228163
CIBW_ENVIRONMENT: >
229-
INCLUDE="C:/sleef/include;{project}/numpy_quaddtype/QBLAS/include;$INCLUDE"
230-
LIB="C:/sleef/lib;$LIB"
231-
PATH="C:/sleef/bin;$PATH"
232-
CFLAGS="/IC:/sleef/include /I{project}/numpy_quaddtype/QBLAS/include /DDISABLE_QUADBLAS $CFLAGS"
233-
CXXFLAGS="/IC:/sleef/include /I{project}/numpy_quaddtype/QBLAS/include /DDISABLE_QUADBLAS $CXXFLAGS"
234-
LDFLAGS="C:/sleef/lib/sleef.lib C:/sleef/lib/sleefquad.lib $LDFLAGS"
164+
CFLAGS="/DDISABLE_QUADBLAS $CFLAGS"
165+
CXXFLAGS="/DDISABLE_QUADBLAS $CXXFLAGS"
235166
CIBW_REPAIR_WHEEL_COMMAND: 'delvewheel repair -w {dest_dir} {wheel} --add-path C:\sleef\bin'
236167
CIBW_TEST_COMMAND: |
237168
pip install {package}[test]
@@ -258,49 +189,29 @@ jobs:
258189
runs-on: ubuntu-latest
259190
steps:
260191
- uses: actions/checkout@v3
261-
with:
262-
submodules: recursive
263192

264193
- name: Set up Python
265194
uses: actions/setup-python@v4
266195
with:
267196
python-version: ">=3.11.0"
268197

269-
- name: Verify QuadBLAS submodule
270-
run: |
271-
ls -la quaddtype/numpy_quaddtype/QBLAS/
272-
ls -la quaddtype/numpy_quaddtype/QBLAS/include/quadblas/
273-
274198
- name: Install system dependencies
275199
run: |
276200
sudo apt-get update -y
277201
sudo apt-get install -y cmake gcc g++ make git pkg-config
278202
279-
- name: Install SLEEF
280-
run: |
281-
git clone --branch 3.8 https://github.com/shibatch/sleef.git
282-
cd sleef
283-
cmake -S . -B build \
284-
-DSLEEF_BUILD_QUAD:BOOL=ON \
285-
-DSLEEF_BUILD_SHARED_LIBS:BOOL=ON \
286-
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
287-
cmake --build build/ --clean-first -j
288-
sudo cmake --install build --prefix /usr/local
289-
290203
- name: Install build dependencies
291204
run: |
292205
python -m pip install --upgrade pip
293-
python -m pip install build
206+
python -m pip install build pytest
294207
295-
- name: Build SDist
208+
- name: Build SDist & test sdist
296209
env:
297-
CFLAGS: "-I/usr/local/include -I$(pwd)/numpy_quaddtype/QBLAS/include"
298-
CXXFLAGS: "-I/usr/local/include -I$(pwd)/numpy_quaddtype/QBLAS/include -fext-numeric-literals"
299-
LDFLAGS: "-L/usr/local/lib64 -L/usr/local/lib -Wl,-rpath,/usr/local/lib64 -Wl,-rpath,/usr/local/lib -fopenmp"
300-
LD_LIBRARY_PATH: "/usr/local/lib64:/usr/local/lib:$LD_LIBRARY_PATH"
301-
PKG_CONFIG_PATH: "/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
210+
LDFLAGS: "-fopenmp"
302211
run: |
303212
python -m build --sdist --outdir dist/
213+
pip install dist/*.tar.gz -v
214+
pytest -s tests
304215
working-directory: ./quaddtype
305216

306217
- name: Upload SDist artifact

.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)