Skip to content

CMake blas_int#103

Merged
mgates3 merged 7 commits intoicl-utk-edu:masterfrom
mgates3:cmake_blas_int
Apr 10, 2025
Merged

CMake blas_int#103
mgates3 merged 7 commits intoicl-utk-edu:masterfrom
mgates3:cmake_blas_int

Conversation

@mgates3
Copy link
Collaborator

@mgates3 mgates3 commented Feb 19, 2025

  1. Updates CMake so it always goes through the BLAS++ BLASFinder to detect the Fortran mangling and whether the BLAS is int32 or int64.

  2. Updates the GitHub CT so that it checks additional BLAS libraries, adding OpenBLAS, specifying BLAS using CMake's FindBLAS (to verify 1), and specifying BLAS using BLAS_LIBRARIES. BLIS can be added once it is working on ICL's machines.

Details

There are 3 ways to specify the BLAS library:

  1. BLAS++ BLASFinder, using blas, blas_int, blas_threaded, etc.:
    cmake -Dblas=openblas ..
  2. BLAS_LIBRARIES, which also uses BLASFinder:
    cmake -DBLAS_LIBRARIES='-lopenblas' ..
  3. CMake FindBLAS:
    cmake -DBLA_VENDOR=OpenBLAS ..

For blas=xyz, blas_int is a constraint on what libraries are checked. E.g., blas=mkl blas_int=int32 will check only mkl_gf_lp64 and mkl_intel_lp64, not mkl_gf_ilp64 and mkl_intel_ilp64. However, for all libraries, BLAS++ checks both 32-bit and 64-bit int. That is, we detect the int size even though in some cases like MKL, we already know the answer. (Except when cross-compiling.)

For BLAS_LIBRARIES, as above, BLASFinder tests 32-bit int, and if that fails, tests 64-bit int. This is the safest action. Only when cross-compiling do we need to trust that blas_int was correctly set.

For CMake's FindBLAS using BLA_VENDOR, blas_int was never referenced, so BLAS++ would implicitly assume 32-bit integers. With this PR, after FindBLAS, the BLAS_LIBRARIES are run through the BLAS++ BLASFinder to detect int sizes and Fortran mangling.

@mgates3 mgates3 marked this pull request as draft February 19, 2025 05:27
@mgates3 mgates3 changed the base branch from blis to master April 2, 2025 04:56
@mgates3 mgates3 force-pushed the cmake_blas_int branch 2 times, most recently from 6cc2c13 to 226bc6e Compare April 2, 2025 23:57
Copy link
Collaborator Author

@mgates3 mgates3 left a comment

Choose a reason for hiding this comment

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

Reviewed.

@mgates3 mgates3 marked this pull request as ready for review April 10, 2025 19:56
@mgates3 mgates3 merged commit cc1176d into icl-utk-edu:master Apr 10, 2025
8 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.

1 participant