Skip to content

WIP: FindBLAS.cmake: handling implicitly linked BLAS libraries

On HPC machines (such as Titan of ORNL or Cori of NERSC) compiler wrapper scripts may implicitly link BLAS libraries as they are commonly used in applications that run on those machines. Existing implementations of FindBLAS.cmake in CMake expect that a BLAS library has to be explicitly provided for codes to link successfully. In fact if a compiler implicitly links BLAS CMake will fail stating that no BLAS library was found.

The changes made here effect the following:

  1. As a first test a program using sgemm is compiled without specifying a BLAS library. If that succeeds there is no need to explicitly specify a BLAS library.
  2. If no BLAS library needs to be specified BLAS_FOUND will be set to TRUE and BLAS_LIBRARIES will be set to "".
  3. If BLA_VENDOR is set to "All" then if an MKL library is present it would always take precedent. On large shared computer facilities often a variety of BLAS libraries is provided, often including MKL. Hence we need to ensure that a prior found BLAS library takes precedent over MKL. If MKL is commonly the preferred BLAS library for explicit linking then the test for the MKL library needs to be moved forward and made into the first BLAS library tested for. This latter change has not been included at present.

I hope you are willing to consider these changes. They would make it much easier for codes such as NWChemEx and Comscope to compile on the leadership class compute facilities that we target for our clients.

Merge request reports