devernay / cminpack

A C/C++ rewrite of the MINPACK software (originally in FORTRAN) for solving nonlinear equations and nonlinear least squares problems
http://devernay.free.fr/hacks/cminpack/
145 stars 63 forks source link

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

Closed anntzer closed 1 year ago

anntzer commented 3 years ago

(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.)

devernay commented 3 years ago
anntzer commented 3 years ago

I renamed USE_CBLAS to USE_BLAS throughout.

do all cblas implementations also propose a FORTRAN API?

I'll have to check that :(

anntzer commented 3 years ago

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.)