cminpack icon indicating copy to clipboard operation
cminpack copied to clipboard

Switch to FORTRAN BLAS API to be able to use FindBLAS.cmake.

Open anntzer opened this issue 3 years ago • 3 comments

(This also means declaring the function signatures ourselves.)

This is a proposed fix for https://github.com/devernay/cminpack/issues/12#issuecomment-886528582, taking into account the blas/cblas difference mentioned at https://github.com/devernay/cminpack/issues/12#issuecomment-886608220. I think avoiding having to maintain a FindCBLAS.cmake as part of this project trumps the slight inconvenience of using the fortran blas API rather than the C cblas one, but YMMV...

(Tested on fedora, arch, and ubuntu.)

anntzer avatar Jul 26 '21 12:07 anntzer

  • shouldn't we also rename USE_CBLAS to USE_BLAS?
  • do all cblas implementations also propose a FORTRAN API? If not, then maybe it should be an option to use either the blas or the cblas API. If yes, then we're fine with using the blas API.

devernay avatar Jul 26 '21 12:07 devernay

I renamed USE_CBLAS to USE_BLAS throughout.

do all cblas implementations also propose a FORTRAN API?

I'll have to check that :(

anntzer avatar Jul 26 '21 13:07 anntzer

Based on https://github.com/Kitware/CMake/blob/6c01bbe180df8771fa1e93776f0b716ac146218f/Modules/FindBLAS.cmake#L344 (where _name has typically been set to something like sgemm), I believe that cmake's FindBLAS.cmake ensures the presence of segmm_, i.e. a FORTRAN API. (The only exception would be https://github.com/Kitware/CMake/blob/6c01bbe180df8771fa1e93776f0b716ac146218f/Modules/FindBLAS.cmake#L443, i.e. when using the BLAS FORTRAN95 interfaces which are probably not supported here anyways.)

anntzer avatar Jul 26 '21 18:07 anntzer