forked from numpy/numpy
-
Notifications
You must be signed in to change notification settings - Fork 0
401 lines (338 loc) · 13 KB
/
linux_blas.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
name: BLAS tests (Linux)
# This file is meant for testing different BLAS/LAPACK flavors and build
# options on Linux. All other yml files for Linux will only test without BLAS
# (mostly because that's easier and faster to build) or with the same 64-bit
# OpenBLAS build that is used in the wheel jobs.
#
# Jobs and their purpose:
#
# - openblas32_stable_nightly:
# Uses the 32-bit OpenBLAS builds, both the latest stable release
# and a nightly build.
# - openblas_no_pkgconfig_fedora:
# Test OpenBLAS on Fedora. Fedora doesn't ship .pc files for OpenBLAS,
# hence this exercises the "system dependency" detection method.
# - flexiblas_fedora:
# Tests FlexiBLAS (the default on Fedora for its own packages), via
# pkg-config. FlexiBLAS allows runtime switching of BLAS/LAPACK
# libraries, which is a useful capability (not tested in this job).
# - openblas_cmake:
# Tests whether OpenBLAS LP64 is detected correctly when only CMake
# and not pkg-config is installed.
# - netlib-debian:
# Installs libblas/liblapack, which in Debian contains libcblas within
# libblas.
# - netlib-split:
# Installs vanilla Netlib blas/lapack with separate libcblas, which is
# the last option tried in auto-detection.
# - mkl:
# Tests MKL installed from PyPI (because easiest/fastest, if broken) in
# 3 ways: both LP64 and ILP64 via pkg-config, and then using the
# Single Dynamic Library (SDL, or `libmkl_rt`).
# - blis:
# Simple test for LP64 via pkg-config
# - atlas:
# Simple test for LP64 via pkg-config
on:
pull_request:
branches:
- main
- maintenance/**
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
openblas32_stable_nightly:
# To enable this workflow on a fork, comment out:
if: github.repository == 'numpy/numpy'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
USE_NIGHTLY_OPENBLAS: [false, true]
env:
USE_NIGHTLY_OPENBLAS: ${{ matrix.USE_NIGHTLY_OPENBLAS }}
name: "Test Linux (${{ matrix.USE_NIGHTLY_OPENBLAS && 'nightly' || 'stable' }} OpenBLAS)"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-tags: true
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r requirements/build_requirements.txt
# Install OpenBLAS
if [[ $USE_NIGHTLY_OPENBLAS == "true" ]]; then
python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple scipy-openblas32
else
python -m pip install -r requirements/ci32_requirements.txt
fi
mkdir -p ./.openblas
python -c"import scipy_openblas32 as ob32; print(ob32.get_pkg_config())" > ./.openblas/scipy-openblas.pc
echo "PKG_CONFIG_PATH=${{ github.workspace }}/.openblas" >> $GITHUB_ENV
ld_library_path=$(python -c"import scipy_openblas32 as ob32; print(ob32.get_lib_dir())")
echo "LD_LIBRARY_PATH=$ld_library_path" >> $GITHUB_ENV
- name: Build
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"'
env:
TERM: xterm-256color
run:
spin build -- --werror -Dallow-noblas=false
- name: Check build-internal dependencies
run:
ninja -C build -t missingdeps
- name: Check installed test and stub files
run:
python tools/check_installed_files.py $(find ./build-install -path '*/site-packages/numpy')
- name: Ensure scipy-openblas
run: |
set -ex
spin python tools/check_openblas_version.py 0.3.26
- name: Test
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"'
env:
TERM: xterm-256color
run: |
pip install pytest pytest-xdist hypothesis typing_extensions
spin test -j auto
openblas_no_pkgconfig_fedora:
if: github.repository == 'numpy/numpy'
runs-on: ubuntu-latest
container: fedora:39
name: "OpenBLAS (Fedora, no pkg-config, LP64/ILP64)"
steps:
- name: Install system dependencies
run: |
dnf install git gcc-gfortran g++ python3-devel openblas-devel -y
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-tags: true
- name: Install dependencies
run: |
pip install -r requirements/build_requirements.txt
pip install pytest hypothesis typing_extensions
- name: Build (LP64)
run: spin build -- -Dblas=openblas -Dlapack=openblas -Ddisable-optimization=true -Dallow-noblas=false
- name: Test
run: spin test -- numpy/linalg
- name: Build (ILP64)
run: |
rm -rf build
spin build -- -Duse-ilp64=true -Ddisable-optimization=true -Dallow-noblas=false
- name: Test
run: spin test -- numpy/linalg
flexiblas_fedora:
if: github.repository == 'numpy/numpy'
runs-on: ubuntu-latest
container: fedora:39
name: "FlexiBLAS (LP64, ILP64 on Fedora)"
steps:
- name: Install system dependencies
run: |
dnf install git gcc-gfortran g++ python3-devel flexiblas-devel -y
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-tags: true
- name: Install dependencies
run: |
pip install -r requirements/build_requirements.txt
pip install pytest hypothesis typing_extensions
- name: Build
run: spin build -- -Ddisable-optimization=true -Dallow-noblas=false
- name: Test
run: spin test -- numpy/linalg
- name: Build (ILP64)
run: |
rm -rf build
spin build -- -Ddisable-optimization=true -Duse-ilp64=true -Dallow-noblas=false
- name: Test (ILP64)
run: spin test -- numpy/linalg
openblas_cmake:
if: github.repository == 'numpy/numpy'
runs-on: ubuntu-latest
name: "OpenBLAS with CMake"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-tags: true
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r requirements/build_requirements.txt
pip install pytest pytest-xdist hypothesis typing_extensions
sudo apt-get update
sudo apt-get install libopenblas-dev cmake
sudo apt-get remove pkg-config
- name: Build
run: spin build -- -Ddisable-optimization=true -Dallow-noblas=false
- name: Test
run: spin test -j auto -- numpy/linalg
netlib-debian:
if: github.repository == 'numpy/numpy'
runs-on: ubuntu-latest
name: "Debian libblas/liblapack"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-tags: true
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r requirements/build_requirements.txt
sudo apt-get update
sudo apt-get install liblapack-dev pkg-config
- name: Build
run: |
spin build -- -Ddisable-optimization=true -Dallow-noblas=false
- name: Test
run: |
pip install pytest pytest-xdist hypothesis typing_extensions
spin test -j auto -- numpy/linalg
netlib-split:
if: github.repository == 'numpy/numpy'
runs-on: ubuntu-latest
container: opensuse/tumbleweed
name: "OpenSUSE Netlib BLAS/LAPACK"
steps:
- name: Install system dependencies
run: |
# No blas.pc on OpenSUSE as of Nov 2023, so no need to install pkg-config.
# If it is needed in the future, use install name `pkgconf-pkg-config`
zypper install -y git gcc-c++ python3-pip python3-devel blas cblas lapack
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-tags: true
- name: Install PyPI dependencies
run: |
pip install --break-system-packages -r requirements/build_requirements.txt
- name: Build
run: |
spin build -- -Dblas=blas -Dlapack=lapack -Ddisable-optimization=true -Dallow-noblas=false
- name: Test
run: |
pip install --break-system-packages pytest pytest-xdist hypothesis typing_extensions
spin test -j auto -- numpy/linalg
mkl:
if: github.repository == 'numpy/numpy'
runs-on: ubuntu-latest
name: "MKL (LP64, ILP64, SDL)"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-tags: true
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r requirements/build_requirements.txt
pip install pytest pytest-xdist hypothesis typing_extensions
pip install mkl mkl-devel
- name: Repair MKL pkg-config files and symlinks
run: |
# MKL 2023.2 works when installed from conda-forge (except for `-iomp`
# and `-tbb` pkg-config files), Spack, or with the standalone Intel
# installer. The standalone installer is the worst option, since it's
# large and clumsy to install and requires running a setvars.sh script
# before things work. The PyPI MKL packages are broken and need the
# fixes in this step. For details, see
# https://github.com/conda-forge/intel_repack-feedstock/issues/34
cd $Python3_ROOT_DIR/lib/pkgconfig
sed -i 's/\/intel64//g' mkl*.pc
# add the expected .so -> .so.2 symlinks to fix linking
cd ..
for i in $( ls libmkl*.so.2 ); do ln -s $i ${i%.*}; done
- name: Build with defaults (LP64)
run: |
pkg-config --libs mkl-dynamic-lp64-seq # check link flags
spin build -- -Ddisable-optimization=true -Dallow-noblas=false
- name: Test
run: spin test -- numpy/linalg
- name: Build with ILP64
run: |
git clean -xdf > /dev/null
pkg-config --libs mkl-dynamic-ilp64-seq
spin build -- -Duse-ilp64=true -Ddisable-optimization=true -Dallow-noblas=false
- name: Test
run: spin test -- numpy/linalg
- name: Build without pkg-config (default options, SDL)
run: |
git clean -xdf > /dev/null
pushd $Python3_ROOT_DIR/lib/pkgconfig
rm mkl*.pc
popd
export MKLROOT=$Python3_ROOT_DIR
spin build -- -Ddisable-optimization=true -Dallow-noblas=false
- name: Test
run: spin test -- numpy/linalg
blis:
if: github.repository == 'numpy/numpy'
runs-on: ubuntu-latest
name: "BLIS"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-tags: true
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r requirements/build_requirements.txt
pip install pytest pytest-xdist hypothesis typing_extensions
sudo apt-get update
sudo apt-get install libblis-dev libopenblas-dev pkg-config
- name: Add BLIS pkg-config file
run: |
# Needed because blis.pc missing in Debian:
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=989076
# The alternative here would be to use another distro or Miniforge
sudo cp tools/ci/_blis_debian.pc /usr/lib/x86_64-linux-gnu/pkgconfig/blis.pc
# Check if the patch works:
pkg-config --libs blis
pkg-config --cflags blis
- name: Build
run: spin build -- -Dblas=blis -Ddisable-optimization=true -Dallow-noblas=false
- name: Test
run: spin test -- numpy/linalg
atlas:
if: github.repository == 'numpy/numpy'
runs-on: ubuntu-latest
name: "ATLAS"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-tags: true
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r requirements/build_requirements.txt
pip install pytest pytest-xdist hypothesis typing_extensions
sudo apt-get update
sudo apt-get install libatlas-base-dev pkg-config
- name: Build
run: spin build -- -Dblas=blas-atlas -Dlapack=lapack-atlas -Ddisable-optimization=true -Dallow-noblas=false
- name: Test
run: spin test -- numpy/linalg