Debian Codegraph @

.github/workflows/linux_blas.yml

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