Debian Codegraph @

.github/workflows/linux_simd.yml

raw
1 name: Linux SIMD tests
2
3 # This file is meant for testing different SIMD-related build options and
4 # optimization levels. See `meson_options.txt` for the available build options.
5 #
6 # Jobs and their purposes:
7 #
8 # - baseline_only:
9 # Focuses on completing as quickly as possible and acts as a filter for other, more resource-intensive jobs.
10 # Utilizes only the default baseline targets (e.g., X86_V2 on X86_64) without enabling any runtime dispatched features.
11 #
12 # - old_gcc:
13 # Tests the oldest supported GCC version with default CPU/baseline/dispatch settings.
14 #
15 # - without_optimizations:
16 # Completely disables all SIMD optimizations and other compiler optimizations such as loop unrolling.
17 #
18 # - native:
19 # Tests against the host CPU features set as the baseline without enabling any runtime dispatched features.
20 # Intended to assess the entire NumPy codebase against host flags, even for code sections lacking handwritten SIMD intrinsics.
21 #
22 # - without_avx512:
23 # Uses runtime SIMD dispatching but disables AVX512.
24 # Intended to evaluate 128-bit/256-bit SIMD extensions.
25 #
26 # - intel_sde:
27 # Executes only the SIMD tests for various AVX512 SIMD extensions under the Intel Software Development Emulator (SDE).
28 #
29 on:
30 pull_request:
31 branches:
32 - main
33 - maintenance/**
34 paths-ignore:
35 - '**.pyi'
36 - '**.md'
37 - '**.rst'
38
39 defaults:
40 run:
41 shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"'
42
43 env:
44 TERM: xterm-256color
45
46 concurrency:
47 group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
48 cancel-in-progress: true
49
50 permissions:
51 contents: read # to fetch code (actions/checkout)
52
53 jobs:
54 baseline_only:
55 # To enable this workflow on a fork, comment out:
56 if: github.repository == 'numpy/numpy'
57 runs-on: ubuntu-latest
58 env:
59 MESON_ARGS: "-Dallow-noblas=true -Dcpu-dispatch=none"
60 steps:
61 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
62 with:
63 submodules: recursive
64 fetch-tags: true
65 persist-credentials: false
66 - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
67 with:
68 python-version: '3.11'
69 - uses: ./.github/meson_actions
70 name: Build/Test
71
72 old_gcc:
73 if: github.event_name != 'push'
74 needs: [baseline_only]
75 runs-on: ubuntu-latest
76 env:
77 MESON_ARGS: "-Dallow-noblas=true"
78 steps:
79 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
80 with:
81 submodules: recursive
82 fetch-tags: true
83 persist-credentials: false
84 - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
85 with:
86 python-version: '3.11'
87
88 - name: Install GCC9/10
89 run: |
90 echo "deb http://archive.ubuntu.com/ubuntu focal main universe" | sudo tee /etc/apt/sources.list.d/focal.list
91 sudo apt update
92 sudo apt install -y g++-9 g++-10
93
94 - name: Enable gcc-9
95 run: |
96 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 1
97 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 1
98
99 - uses: ./.github/meson_actions
100 name: Build/Test against gcc-9
101
102 - name: Enable gcc-10
103 run: |
104 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 2
105 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 2
106
107 - uses: ./.github/meson_actions
108 name: Build/Test against gcc-10
109
110 arm64_simd:
111 if: github.repository == 'numpy/numpy'
112 needs: [baseline_only]
113 runs-on: ubuntu-22.04-arm
114 strategy:
115 fail-fast: false
116 matrix:
117 config:
118 - name: "baseline only"
119 args: "-Dallow-noblas=true -Dcpu-dispatch=none"
120 - name: "with ASIMD"
121 args: "-Dallow-noblas=true -Dcpu-baseline=asimd"
122 - name: "native"
123 args: "-Dallow-noblas=true -Dcpu-baseline=native -Dcpu-dispatch=none"
124 name: "ARM64 SIMD - ${{ matrix.config.name }}"
125 steps:
126 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
127 with:
128 submodules: recursive
129 fetch-tags: true
130 - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
131 with:
132 python-version: '3.11'
133 - name: Install dependencies
134 run: |
135 python -m pip install -r requirements/build_requirements.txt -r requirements/test_requirements.txt
136 - name: Build
137 run: |
138 spin build -- ${{ matrix.config.args }}
139 - name: Test
140 run: |
141 spin test -- --timeout=600 --durations=10
142
143 specialize:
144 needs: [baseline_only]
145 runs-on: ubuntu-latest
146 if: github.event_name != 'push'
147 continue-on-error: true
148 strategy:
149 fail-fast: false
150 matrix:
151 BUILD_PROP:
152 - [
153 "without optimizations",
154 "-Dallow-noblas=true -Ddisable-optimization=true",
155 "3.12"
156 ]
157 - [
158 "native",
159 "-Dallow-noblas=true -Dcpu-baseline=native -Dcpu-dispatch=none",
160 "3.11"
161 ]
162 - [
163 "without avx512",
164 "-Dallow-noblas=true -Dcpu-dispatch=max-x86_v4",
165 "3.11"
166 ]
167
168 env:
169 MESON_ARGS: ${{ matrix.BUILD_PROP[1] }}
170
171 name: "${{ matrix.BUILD_PROP[0] }}"
172 steps:
173 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
174 with:
175 submodules: recursive
176 fetch-tags: true
177 persist-credentials: false
178 - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
179 with:
180 python-version: "${{ matrix.BUILD_PROP[2] }}"
181 - uses: ./.github/meson_actions
182 name: Build/Test
183
184 intel_sde_avx512:
185 needs: [baseline_only]
186 runs-on: ubuntu-24.04
187 steps:
188 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
189 with:
190 submodules: recursive
191 fetch-tags: true
192 persist-credentials: false
193 - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
194 with:
195 python-version: '3.11'
196
197 - name: Install Intel SDE
198 run: |
199 curl -o /tmp/sde.tar.xz https://downloadmirror.intel.com/859732/sde-external-9.58.0-2025-06-16-lin.tar.xz
200 mkdir /tmp/sde && tar -xvf /tmp/sde.tar.xz -C /tmp/sde/
201 sudo mv /tmp/sde/* /opt/sde && sudo ln -s /opt/sde/sde64 /usr/bin/sde
202
203 - name: Install dependencies
204 run: |
205 python -m pip install -r requirements/build_requirements.txt -r requirements/test_requirements.txt
206
207 - name: Build
208 run: CC=gcc-13 CXX=g++-13 spin build -- -Denable-openmp=true -Dallow-noblas=true -Dcpu-baseline=X86_V4 -Dtest-simd='BASELINE,AVX512_ICL,AVX512_SPR'
209
210 - name: Meson Log
211 if: always()
212 run: cat build/meson-logs/meson-log.txt
213
214 - name: SIMD tests (SKX)
215 run: |
216 export NUMPY_SITE=$(realpath build-install/usr/lib/python*/site-packages/)
217 export PYTHONPATH="$PYTHONPATH:$NUMPY_SITE"
218 cd build-install &&
219 sde -skx -- python -c "import numpy; numpy.show_config()" &&
220 sde -skx -- python -m pytest $NUMPY_SITE/numpy/_core/tests/test_simd*
221
222 - name: linalg/ufunc/umath tests (TGL)
223 run: |
224 export NUMPY_SITE=$(realpath build-install/usr/lib/python*/site-packages/)
225 export PYTHONPATH="$PYTHONPATH:$NUMPY_SITE"
226 cd build-install &&
227 sde -tgl -- python -c "import numpy; numpy.show_config()" &&
228 sde -tgl -- python -m pytest $NUMPY_SITE/numpy/_core/tests/test_umath* \
229 $NUMPY_SITE/numpy/_core/tests/test_ufunc.py \
230 $NUMPY_SITE/numpy/_core/tests/test_multiarray.py \
231 $NUMPY_SITE/numpy/linalg/tests/test_*
232
233
234 intel_sde_spr:
235 needs: [baseline_only]
236 runs-on: ubuntu-24.04
237 steps:
238 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
239 with:
240 submodules: recursive
241 fetch-tags: true
242 persist-credentials: false
243 - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
244 with:
245 python-version: '3.11'
246
247 - name: Install Intel SDE
248 run: |
249 curl -o /tmp/sde.tar.xz https://downloadmirror.intel.com/859732/sde-external-9.58.0-2025-06-16-lin.tar.xz
250 mkdir /tmp/sde && tar -xvf /tmp/sde.tar.xz -C /tmp/sde/
251 sudo mv /tmp/sde/* /opt/sde && sudo ln -s /opt/sde/sde64 /usr/bin/sde
252
253 - name: Install dependencies
254 run: |
255 python -m pip install -r requirements/build_requirements.txt -r requirements/test_requirements.txt
256
257 - name: Build
258 run: CC=gcc-13 CXX=g++-13 spin build -- -Denable-openmp=true -Dallow-noblas=true -Dcpu-baseline=avx512_spr
259
260 - name: Meson Log
261 if: always()
262 run: cat build/meson-logs/meson-log.txt
263
264 - name: SIMD tests (SPR)
265 run: |
266 export NUMPY_SITE=$(realpath build-install/usr/lib/python*/site-packages/)
267 export PYTHONPATH="$PYTHONPATH:$NUMPY_SITE"
268 cd build-install &&
269 sde -spr -- python -c "import numpy; numpy.show_config()" &&
270 sde -spr -- python -m pytest $NUMPY_SITE/numpy/_core/tests/test_simd*
271
272 - name: linalg/ufunc/umath tests on Intel SPR
273 run: |
274 export NUMPY_SITE=$(realpath build-install/usr/lib/python*/site-packages/)
275 export PYTHONPATH="$PYTHONPATH:$NUMPY_SITE"
276 cd build-install &&
277 sde -spr -- python -c "import numpy; numpy.show_config()" &&
278 sde -spr -- python -m pytest $NUMPY_SITE/numpy/_core/tests/test_umath* \
279 $NUMPY_SITE/numpy/_core/tests/test_ufunc.py \
280 $NUMPY_SITE/numpy/_core/tests/test_multiarray.py \
281 $NUMPY_SITE/numpy/linalg/tests/test_*