Add blas_symbol_suffix CMake option for symbol-suffixed BLAS libraries#129
Add blas_symbol_suffix CMake option for symbol-suffixed BLAS libraries#129rileyjmurray wants to merge 4 commits into
Conversation
Lets BLAS++ link against BLAS libraries whose Fortran symbols carry a
suffix, e.g. OpenBLAS built with INTERFACE64=1 SYMBOLSUFFIX=64_ exports
dgemm_64_ instead of dgemm_. Motivation is downstream consumers (e.g.,
conda-forge blaspp-feedstock) that want a clean ILP64 build against
libopenblas64_ in the same prefix as the LP64 build.
Adds a new CMake cache var `blas_symbol_suffix` (empty by default,
strict no-op) that propagates as `-DBLAS_FORTRAN_SUFFIX=<value>` into:
- include/blas/mangling.h (consumer-visible name mangling)
- config/config.h (compile/link probes in BLASFinder)
- installed defines.h, via blaspp_defs_, so downstream consumers
see the same name mangling.
When the suffix is set, the OpenBLAS search probe links
-lopenblas${blas_symbol_suffix} to match upstream library naming
convention (libopenblas64_).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Question: Does this need to apply to CBLAS/LAPACKE wrappers too? OpenBLAS suffixes CBLAS symbols as EDIT: above is from a robot (along with all commits in this PR). |
|
LAPACK++ doesn't link with CBLAS. Perhaps BLAS++ and LAPACK++ use CBLAS and LAPACKE for their testers, but the libraries themselves both directly wrap the Fortran interface, not the CBLAS or LAPACKE interface. (Granted, some libraries are reversed: the Fortran interface is a wrapper around the CBLAS interface.) |
|
Gotcha, RE: LAPACK++ not linking with CBLAS. Another question for you, @mgates3. I just landed a PR getting an updated BLAS++ in conda-forge. That PR's implementation set three different internal CMake cache variables across EDIT: crossing out questions based on Mark's response at conda-forge/blaspp-feedstock#10 (comment). In my next blaspp-feedstock PR I'll revert the changes that related on undocumented CMake config variables above.
Finally, can you approve the CI workflow? I imagine "passing CI" is a prerequisite to merge this PR. |
…fails, PR icl-utk-edu#129 works Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…P64 OpenBLAS Holds the conda environment fixed and varies only the source tree, exposing the conda prefix via CPATH/LIBRARY_PATH/LD_LIBRARY_PATH so the OpenBLAS search probe can resolve -lopenblas64_. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…nk diagnostic System g++ couldn't resolve conda OpenBLAS transitive deps (libgfortran etc.); switch to conda's $CXX (cxx-compiler) with rpath flags and add a direct g++ -lopenblas64_ probe to capture the real linker error. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Real cause of prior failures: conda's libopenblas-ilp64 runtime ships only libopenblas64_.so.0 (no unversioned .so), and bash -el's set -e aborted the diagnose step on the expected-to-fail -lopenblas64_ probe. Resolve LIB to the real .so.0, guard probes from set -e, prove icl-utk-edu#129 via explicit full path, and recreate the dev .so symlink to also exercise the -lopenblas64_ auto-search. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
One run emits one attachable log per claim, each stating its claim and ending in FATAL_ERROR or 'Built target blaspp': apt master FAILS, apt by-path BUILDS, conda master FAILS, conda PR icl-utk-edu#129 BUILDS. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…bol suffix) Shows there is no blaspp-free workaround for conda's libopenblas64_: master mangles to dgemm_ but the lib only exports dgemm_64_, so even a correct -DBLAS_LIBRARIES path fails the routine link probe. Renumber PR icl-utk-edu#129 demo to 05. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
config/lapack.py hardcodes -lopenblas (line 321) and has no symbol-suffix dimension, so 'configure.py blas=openblas blas_int=int64' fails to auto-detect ILP64 OpenBLAS for both apt and conda. Shows the issue is not CMake-specific; PR icl-utk-edu#129 (CMake-only) does not fix the Make build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
I would have to review the exact behavior, but I think setting |
Apply the symbol-suffix handling to the Make/configure.py build (config/lapack.py),
matching the existing CMake option: probe -lopenblas${suffix} and define
BLAS_FORTRAN_SUFFIX so calls mangle to e.g. dgemm_64_. Both build systems now also
probe -lopenblas64, so the ILP64 OpenBLAS that Debian/Ubuntu ship as libopenblas64
(plain symbols) is auto-detected without BLAS_LIBRARIES or BLA_VENDOR.
Adds a throwaway CI workflow (ilp64-fix-verify.yml) that builds against apt and
conda-forge ILP64 OpenBLAS via both build systems; to be removed once logs pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks for the feedback Mark. I've pushed updates:
Verified on a stock
Logs attached. LMK if other changes are needed! 04-make-conda-suffix.log |
Lets BLAS++ link against BLAS libraries whose Fortran symbols carry a suffix, e.g. OpenBLAS built with INTERFACE64=1 SYMBOLSUFFIX=64_ exports dgemm_64_ instead of dgemm_. Motivation is downstream consumers (e.g., conda-forge blaspp-feedstock) that want a clean ILP64 build against libopenblas64_ in the same prefix as the LP64 build.
Adds a new CMake cache var
blas_symbol_suffix(empty by default, strict no-op) that propagates as-DBLAS_FORTRAN_SUFFIX=<value>into:When the suffix is set, the OpenBLAS search probe links -lopenblas${blas_symbol_suffix} to match upstream library naming convention (libopenblas64_).