Skip to content

Conda forge blas - #129

Merged
Transurgeon merged 4 commits into
mainfrom
conda-forge-blas
Oct 7, 2026
Merged

Transurgeon merged 4 commits into
mainfrom
conda-forge-blas

Conversation

@Transurgeon

@Transurgeon Transurgeon commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Closes #126. With this change, the conda-forge recipe (conda-forge/staged-recipes#34978) can drop 0001-use-conda-forge-blas.patch once a sparsediffpy release ships with it.

Changes (CMakeLists.txt)

  • MSVC BLAS: find_package(OpenBLAS CONFIG QUIET). If that provides the OpenBLAS::OpenBLAS target (vcpkg), link it. If not, fall back to find_library(openblas) plus find_path(cblas.h), which is how conda-forge's openblas is laid out. The check is on TARGET rather than OpenBLAS_FOUND, because OpenBLAS's own config file doesn't define the imported target.
  • Unix BLAS: after find_package(BLAS), link libcblas if it sits in the same directory as the BLAS that was found, and link it before BLAS. On conda-forge, libblas.so points to libopenblas at build time, so a cblas_ddot link probe would pass and libcblas would be skipped. The package would then break once a user switches to netlib BLAS. Linking libcblas explicitly is what conda-forge expects. On conda-forge this links the same libraries as the recipe's current patch, which has passed staged-recipes CI. The difference is that the patch accepts a libcblas from anywhere on the search path, while this only looks next to the BLAS that was found.
  • SDE_WARNINGS_AS_ERRORS: gates MSVC /WX. It defaults to ON for standalone builds (engine CI is unchanged) and OFF under scikit-build, so downstream MSVC toolchains don't break on new warnings. SparseDiffPy's wheel CI can pass -DSDE_WARNINGS_AS_ERRORS=ON to keep /WX.

Unchanged

  • vcpkg (engine CI, Windows wheels) still takes the config path.
  • Ubuntu libopenblas-dev: linking is the same as before, unless a separate libcblas (e.g. from ATLAS) is installed in the same directory. In that case it also gets linked, which is harmless.
  • macOS Accelerate is untouched.

Testing

  • macOS: standalone build plus ctest pass.
  • Ubuntu and Windows (vcpkg): covered by engine CI.
  • conda-forge paths: there's a new conda-forge BLAS workflow (.github/workflows/conda-forge.yml). It builds and runs ctest against conda-forge packages installed with Miniforge on Linux (libblas/libcblas, BLA_VENDOR=Generic) and on Windows (openblas, no CMake config). On Linux it also checks that libcblas.so is a NEEDED entry. It then switches to netlib libblas/libcblas and runs the tests again, which only passes because libcblas is linked explicitly.

🤖 Generated with Claude Code

Transurgeon and others added 4 commits October 6, 2026 13:22
- MSVC: use the OpenBLAS::OpenBLAS target when a config provides it (vcpkg),
  otherwise fall back to finding openblas.lib and cblas.h directly, as
  conda-forge's openblas ships no CMake config.
- Unix: link libcblas when it sits next to the BLAS FindBLAS picked, ahead of
  BLAS itself. conda-forge splits CBLAS into libcblas; linking it explicitly
  keeps the package working when users switch BLAS implementations.
- Add SDE_WARNINGS_AS_ERRORS (default ON standalone, OFF under scikit-build)
  to gate MSVC /WX.

Closes #126.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Builds and tests the engine on Linux and Windows against conda-forge's BLAS
packages (no OpenBLAS CMake config on Windows, split libcblas on Linux). On
Linux it also checks libcblas is a direct dependency and re-runs the tests
after switching to the netlib BLAS variant.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
setup-micromamba failed after creating the environment; Miniforge via
setup-miniconda is the common setup for conda-forge-based CI.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
conda-forge's global pinning builds against the netlib libblas/libcblas,
which carry the switchable libblas.so.3/libcblas.so.3 SONAMEs; the openblas
variant is a symlink to libopenblas.so.0, so linking against it records
that instead. Mirror the pinning and test the switch the other way round.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Transurgeon
Transurgeon merged commit 6332bcb into main Oct 7, 2026
14 checks passed
@Transurgeon
Transurgeon deleted the conda-forge-blas branch October 7, 2026 13:22
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.

Make CMake BLAS detection work on conda-forge (no vendor config, split libcblas) and make MSVC /WX optional

1 participant