Skip to content

fix: use OpenBLAS instead of Accelerate on macOS - #1193

Merged
riclarsson merged 1 commit into
atmtools:mainfrom
olemke:ditch-accelerate-framework
Oct 20, 2026
Merged

riclarsson merged 1 commit into
atmtools:mainfrom
olemke:ditch-accelerate-framework

Conversation

@olemke

@olemke olemke commented Oct 15, 2026

Copy link
Copy Markdown
Member

Summary

Apple's Accelerate BLAS/LAPACK is not thread-safe: concurrent dgeev calls silently corrupt the returned eigenvectors while the eigenvalues stay exact. VDISORT diagonalizes one transport operator per frequency inside an OpenMP loop, so pyarts.arts.tests.core.disort.vdisort-workspace.rt3 failed intermittently and any parallel use of the LAPACK diagonalization was affected. This PR makes macOS builds select the environment's OpenBLAS instead of Accelerate and pins OpenBLAS in the macOS dev environment, mirroring the Linux environment files.

Changes

  • CMakeLists.txt: sets BLA_VENDOR=Generic before find_package(LAPACK REQUIRED) when building on macOS, so FindBLAS/FindLAPACK pick the environment's plain libblas/liblapack (OpenBLAS in the conda environments) instead of Accelerate; an explicit -DBLA_VENDOR=... is still honored.
  • environment-dev-mac.yml: adds the openblas=*=*openmp* dependency so macOS dev environments always provide OpenBLAS, consistent with the Linux dev environment files.

Breaking Changes

⚠️ macOS builds now require a generic libblas/liblapack (such as the OpenBLAS the conda environments install); configuration fails if neither is found. Existing macOS environments need mamba env update -f environment-dev-mac.yml, or pass -DBLA_VENDOR=Apple to keep using Accelerate.

Apple's Accelerate LAPACK is not thread-safe: concurrent dgeev
calls silently corrupt the returned eigenvectors while the
eigenvalues stay exact.  VDISORT diagonalizes one operator per
frequency inside an OpenMP loop, so the pyarts test
vdisort-workspace.rt3 failed intermittently.

Have FindBLAS/FindLAPACK pick the environment's plain
libblas/liblapack (OpenBLAS in the conda environments) on macOS
via BLA_VENDOR=Generic; an explicit -DBLA_VENDOR still wins.

Add the openblas openmp variant to the macOS dev environment,
mirroring the Linux environment files.
@olemke

olemke commented Oct 16, 2026

Copy link
Copy Markdown
Member Author

@riclarsson I'm wondering, did you also see the high failure rate on ctest --test-dir build -R pyarts.arts.tests.core.disort.vdisort-workspace.rt3? For me it was failing >80% of the time. I never saw it happen in the CI. I'm curious if it's depending on the M processor type or OS. I'm on Golden Gate.

@riclarsson

riclarsson commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

@olemke I have never had a test fail locally. But this is all using a lot of lapack and a lot of that is really processor dependent. My processors are just some intel card, an amd card, and a M3 Ultra (or whatever it is called, maybe max?). So just standard AMD64 and standard Mac.

Edit: though I have not tested OpenBLAS on mac.

@riclarsson
riclarsson merged commit 84dabb1 into atmtools:main Oct 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants