Skip to content

Conversation

@imciner2
Copy link
Contributor

It can be useful to get information about the underlying BLAS library that is being used to capture its version, and also which dynamic architecture is being used (for libraries that provide that information).

This is a bit of a mess implementation wise, because every library provide information differently, and with different APIs. This function outputs a single string that contains the library information (independent of how/if the library actually provides it).

This is done as a separate lookup function instead of going in the library info struct to preserve the API/ABI of those elements. In the future, this can be exposed through the Julia BLAS/LBT module and included in the printing of the LBT config.

I am raising this as a draft right now because there are no tests yet, so I still need to add those.

There is no way to get a version directly from Apple Accelerate
(separate from the LAPACK version), but we can at least detect the
backend is accelerate by looking for an Apple-only symbol.
@imciner2 imciner2 added the enhancement New feature or request label Oct 18, 2025
@imciner2 imciner2 marked this pull request as ready for review November 5, 2025 11:11
@imciner2
Copy link
Contributor Author

imciner2 commented Nov 5, 2025

Ok, this is ready now.

Here is some sample output from various libraries on my laptop:

LD_LIBRARY_PATH=~/dev/numericalLA/libblastrampoline/src/build/ ./prefix/sdot_test 

Generating forwards to /usr/lib64/libopenblas64.so.0 (clear: 1, verbose: 1, suffix_hint: '')
 -> Autodetected symbol suffix ""
 -> Autodetected interface ILP64 (64-bit)
 -> Autodetected normal complex return style
 -> Autodetected gfortran calling convention
 -> CBLAS detected
Processed 5146 symbols; forwarded 5121 symbols with 64-bit interface and mangling to a suffix of ""
Generating forwards to /usr/lib64/libopenblas.so.0 (clear: 0, verbose: 1, suffix_hint: '')
 -> Autodetected symbol suffix ""
 -> Autodetected interface LP64 (32-bit)
 -> Autodetected normal complex return style
 -> Autodetected gfortran calling convention
Processed 5146 symbols; forwarded 5121 symbols with 32-bit interface and mangling to a suffix of ""
Library name: /usr/lib64/libopenblas64.so.0
Library info: OpenBLAS 0.3.29  USE64BITINT DYNAMIC_ARCH NO_AFFINITY USE_LOCKING Cooperlake SINGLE_THREADED, LAPACK v3.12.0
Library name: /usr/lib64/libopenblas.so.0
Library info: OpenBLAS 0.3.29 DYNAMIC_ARCH NO_AFFINITY USE_LOCKING Cooperlake SINGLE_THREADED, LAPACK v3.12.0

Generating forwards to /opt/intel/oneapi/mkl/latest/lib/libmkl_rt.so (clear: 1, verbose: 1, suffix_hint: '')
 -> Autodetected symbol suffix ""
 -> Autodetected interface LP64 (32-bit)
 -> Autodetected argument-passing complex return style
 -> Autodetected gfortran calling convention
 - [2822] complex(cdotc_)
 - [2823] complex(cdotu_)
 - [4610] complex(zdotc_)
 - [4611] complex(zdotu_)
Processed 5146 symbols; forwarded 4914 symbols with 32-bit interface and mangling to a suffix of ""
Library name: /opt/intel/oneapi/mkl/latest/lib/libmkl_rt.so
Library info: Intel(R) oneAPI Math Kernel Library Version 2025.3-Product Build 20251007 for Intel(R) 64 architecture applications, LAPACK v3.12.1

Generating forwards to /usr/lib64/libblis64.so.2 (clear: 1, verbose: 1, suffix_hint: '')
 -> Autodetected symbol suffix ""
 -> Autodetected interface ILP64 (64-bit)
 -> Autodetected normal complex return style
 -> Autodetected gfortran calling convention
 -> CBLAS detected
Processed 5146 symbols; forwarded 318 symbols with 64-bit interface and mangling to a suffix of ""
Generating forwards to /usr/lib64/libblis.so.2 (clear: 0, verbose: 1, suffix_hint: '')
 -> Autodetected symbol suffix ""
 -> Autodetected interface LP64 (32-bit)
 -> Autodetected normal complex return style
 -> Autodetected gfortran calling convention
Processed 5146 symbols; forwarded 318 symbols with 32-bit interface and mangling to a suffix of ""
Library name: /usr/lib64/libblis64.so.2
Library info: BLIS 0.9.0, 64-bit integer, zen3
Library name: /usr/lib64/libblis.so.2
Library info: BLIS 0.9.0, 32-bit integer, zen3

Generating forwards to /opt/AMD/aocl/aocl-linux-aocc-5.1.0/aocc/lib_ILP64/libblis-mt.so (clear: 1, verbose: 1, suffix_hint: '')
 -> Autodetected symbol suffix ""
 -> Autodetected interface ILP64 (64-bit)
 -> Autodetected argument-passing complex return style
 -> Autodetected gfortran calling convention
 -> CBLAS detected
 - [2822] complex(cdotc_64_)
 - [2823] complex(cdotu_64_)
 - [4610] complex(zdotc_64_)
 - [4611] complex(zdotu_64_)
Processed 5146 symbols; forwarded 335 symbols with 64-bit interface and mangling to a suffix of ""
Generating forwards to /opt/AMD/aocl/aocl-linux-aocc-5.1.0/aocc/lib_ILP64/libflame.so (clear: 0, verbose: 1, suffix_hint: '')
ERROR: Unable to load dependent library /opt/AMD/aocl/aocl-linux-aocc-5.1.0/aocc/lib_ILP64/libflame.so
Message: libaoclutils.so: cannot open shared object file: No such file or directory
Unable to load "/opt/AMD/aocl/aocl-linux-aocc-5.1.0/aocc/lib_ILP64/libflame.so"
Generating forwards to /opt/AMD/aocl/aocl-linux-aocc-5.1.0/aocc/lib_LP64/libblis-mt.so (clear: 0, verbose: 1, suffix_hint: '')
 -> Autodetected symbol suffix ""
 -> Autodetected interface LP64 (32-bit)
 -> Autodetected argument-passing complex return style
 -> Autodetected gfortran calling convention
 - [2822] complex(cdotc_)
 - [2823] complex(cdotu_)
 - [4610] complex(zdotc_)
 - [4611] complex(zdotu_)
Processed 5146 symbols; forwarded 335 symbols with 32-bit interface and mangling to a suffix of ""
Generating forwards to /opt/AMD/aocl/aocl-linux-aocc-5.1.0/aocc/lib_LP64/libflame.so (clear: 0, verbose: 1, suffix_hint: '')
ERROR: Unable to load dependent library /opt/AMD/aocl/aocl-linux-aocc-5.1.0/aocc/lib_LP64/libflame.so
Message: libaoclutils.so: cannot open shared object file: No such file or directory
Unable to load "/opt/AMD/aocl/aocl-linux-aocc-5.1.0/aocc/lib_LP64/libflame.so"
Library name: /opt/AMD/aocl/aocl-linux-aocc-5.1.0/aocc/lib_ILP64/libblis-mt.so
Library info: AMD AOCL-BLAS 5.1.0 Build 20250724, 64-bit integer, zen4
Library name: /opt/AMD/aocl/aocl-linux-aocc-5.1.0/aocc/lib_LP64/libblis-mt.so
Library info: AMD AOCL-BLAS 5.1.0 Build 20250724, 32-bit integer, zen4

Generating forwards to /usr/lib64/libflexiblas64.so (clear: 1, verbose: 1, suffix_hint: '')
 -> Autodetected symbol suffix ""
 -> Autodetected interface ILP64 (64-bit)
 -> Autodetected normal complex return style
 -> Autodetected gfortran calling convention
 -> CBLAS detected
Processed 5146 symbols; forwarded 2300 symbols with 64-bit interface and mangling to a suffix of ""
Generating forwards to /usr/lib64/libflexiblas.so (clear: 0, verbose: 1, suffix_hint: '')
 -> Autodetected symbol suffix ""
 -> Autodetected interface LP64 (32-bit)
 -> Autodetected normal complex return style
 -> Autodetected gfortran calling convention
Processed 5146 symbols; forwarded 2300 symbols with 32-bit interface and mangling to a suffix of ""
Library name: /usr/lib64/libflexiblas64.so
Library info: FlexiBLAS 3.4.5, backend: OPENBLAS-OPENMP64, LAPACK v3.12.0
Library name: /usr/lib64/libflexiblas.so
Library info: FlexiBLAS 3.4.5, backend: OPENBLAS-OPENMP, LAPACK v3.12.0

Copy link
Collaborator

@giordano giordano left a comment

Choose a reason for hiding this comment

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

Looks good to me 🎉

@ViralBShah
Copy link
Member

ViralBShah commented Nov 5, 2025

This looks great (although I am looking at the output not reviewing the source code where I have little to add).

Would it be useful to also try and detect LAPACKE?

Also, not relevant here, but it would be helpful to report how many forwards out of the whole list are detected (as in % of coverage).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants