Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions .github/workflows/test_old_cpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Test on Older CPUs (x86-64-v2)

# This workflow tests numpy-quaddtype on older x86 CPUs using Intel SDE.
# It ensures compatibility with x86-64-v2 baseline CPUs (e.g., Sandy Bridge)
# that don't have AVX2/FMA support.

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
test_sandy_bridge:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only if you care to mess with it: I bet you can make a build matrix like:

strategy:
    matrix:
        build-arch: [
            ['sandy_bridge', 'Sandy Bridge (x86_64-v2)'], 
            ['haswell', 'Haswell (x86_64-v3)'],
        ]

And then reduce the definition to use only one job definition and rely on the build matrix to generate the two almost-identical jobs.

name: Test on Sandy Bridge (x86-64-v2)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Install Intel SDE
run: |
curl -o /tmp/sde.tar.xz https://downloadmirror.intel.com/859732/sde-external-9.58.0-2025-06-16-lin.tar.xz
mkdir /tmp/sde && tar -xvf /tmp/sde.tar.xz -C /tmp/sde/
sudo mv /tmp/sde/* /opt/sde && sudo ln -s /opt/sde/sde64 /usr/bin/sde

- name: Install system dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y cmake gcc g++ make git pkg-config

- name: Install Python dependencies
run: |
pip install -U pip
pip install numpy meson meson-python ninja pytest

- name: Build numpy-quaddtype
env:
LDFLAGS: "-fopenmp"
run: |
pip install . --no-build-isolation -v

- name: Test import on Sandy Bridge (x86-64-v2)
run: |
echo "Testing basic import on Sandy Bridge..."
sde -snb -- python -c "
import numpy as np
print('NumPy version:', np.__version__)
from numpy_quaddtype import QuadPrecDType
print('QuadPrecDType imported successfully!')
arr = np.zeros(3, dtype=QuadPrecDType())
print('Created quad array:', arr)
print('SUCCESS: No illegal instruction on Sandy Bridge!')
"

- name: Run tests on Sandy Bridge
run: |
pip install pytest mpmath
sde -snb -- python -m pytest tests/ -v --tb=short

test_haswell:
name: Test on Haswell (x86-64-v3)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Install Intel SDE
run: |
curl -o /tmp/sde.tar.xz https://downloadmirror.intel.com/859732/sde-external-9.58.0-2025-06-16-lin.tar.xz
mkdir /tmp/sde && tar -xvf /tmp/sde.tar.xz -C /tmp/sde/
sudo mv /tmp/sde/* /opt/sde && sudo ln -s /opt/sde/sde64 /usr/bin/sde

- name: Install system dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y cmake gcc g++ make git pkg-config

- name: Install Python dependencies
run: |
pip install -U pip
pip install numpy meson meson-python ninja pytest

- name: Build numpy-quaddtype
env:
LDFLAGS: "-fopenmp"
run: |
pip install . --no-build-isolation -v

- name: Test import on Haswell (x86-64-v3)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo, it's x86_64 with an underscore.

run: |
echo "Testing basic import on Haswell..."
sde -hsw -- python -c "
import numpy as np
print('NumPy version:', np.__version__)
from numpy_quaddtype import QuadPrecDType
print('QuadPrecDType imported successfully!')
arr = np.zeros(3, dtype=QuadPrecDType())
print('Created quad array:', arr)
print('SUCCESS: Works on Haswell!')
"

- name: Run tests on Haswell
run: |
pip install pytest mpmath
sde -hsw -- python -m pytest tests/ -v --tb=short
Loading