Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 14 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,25 @@ jobs:
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores

# FindSIMD compiles with -march=native, which bakes the building runner's
# ISA into every cached object file, but ccache hashes the flag string and
# not the CPU it expands to. Without a CPU component in the cache key,
# objects built on one runner model get restored onto another, and a
# translation unit compiled fresh on the new CPU then disagrees with the
# cached ones about xsimd::default_arch. Key the cache on the CPU so it
# only restores onto matching hardware.
- name: CPU fingerprint
run: |
CPU=$(grep -m1 '^model name' /proc/cpuinfo | cut -d: -f2-)
echo "CPU: $CPU"
echo "CPU_KEY=$(printf '%s' "$CPU" | sha256sum | cut -c1-12)" >> "$GITHUB_ENV"

- name: Cache Build
id: cache-build
uses: actions/cache@v5
with:
path: ${{ env.CACHE_PATH }}
key: coverage-cache
key: coverage-${{ env.CPU_KEY }}-cache

- name: Prepare ccache
run: |
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,25 @@ jobs:
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores

# FindSIMD compiles with -march=native, which bakes the building runner's
# ISA into every cached object file, but ccache hashes the flag string and
# not the CPU it expands to. Without a CPU component in the cache key,
# objects built on one runner model get restored onto another, and a
# translation unit compiled fresh on the new CPU then disagrees with the
# cached ones about xsimd::default_arch. Key the cache on the CPU so it
# only restores onto matching hardware.
- name: CPU fingerprint
run: |
CPU=$(grep -m1 '^model name' /proc/cpuinfo | cut -d: -f2-)
echo "CPU: $CPU"
echo "CPU_KEY=$(printf '%s' "$CPU" | sha256sum | cut -c1-12)" >> "$GITHUB_ENV"

- name: Cache Build
id: cache-build
uses: actions/cache@v5
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-${{ matrix.config }}-cache
key: ${{ runner.os }}-${{ matrix.config }}-${{ env.CPU_KEY }}-cache

- name: Prepare ccache
run: |
Expand Down
31 changes: 30 additions & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,41 @@ jobs:
choco install ccache
"CACHE_PATH=${env:LOCALAPPDATA}\ccache" | Out-File -FilePath $env:GITHUB_ENV -Append

# FindSIMD compiles with -march=native, which bakes the building runner's
# ISA into every cached object file, but ccache hashes the flag string and
# not the CPU it expands to. Without a CPU component in the cache key,
# objects built on one runner model get restored onto another, and a
# translation unit compiled fresh on the new CPU then disagrees with the
# cached ones about xsimd::default_arch. Key the cache on the CPU so it
# only restores onto matching hardware.
- name: CPU fingerprint (Linux/macOS)
if: runner.os != 'Windows'
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
CPU=$(grep -m1 '^model name' /proc/cpuinfo | cut -d: -f2-)
KEY=$(printf '%s' "$CPU" | sha256sum | cut -c1-12)
else
CPU=$(sysctl -n machdep.cpu.brand_string)
KEY=$(printf '%s' "$CPU" | shasum -a 256 | cut -c1-12)
fi
echo "CPU: $CPU"
echo "CPU_KEY=$KEY" >> "$GITHUB_ENV"

- name: CPU fingerprint (Windows)
if: runner.os == 'Windows'
run: |
$cpu = Get-CimInstance Win32_Processor | Select-Object -First 1 -ExpandProperty Name
Write-Host "CPU: $cpu"
$stream = [IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($cpu))
$key = (Get-FileHash -InputStream $stream -Algorithm SHA256).Hash.Substring(0, 12)
"CPU_KEY=$key" | Out-File -FilePath $env:GITHUB_ENV -Append

- name: Cache Build
id: cache-build
uses: actions/cache@v5
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-Python${{ matrix.python-version }}-cache
key: ${{ runner.os }}-Python${{ matrix.python-version }}-${{ env.CPU_KEY }}-cache

- name: Prepare Ccache
run: |
Expand Down
Loading