3
votes

I am a bit confused by the utility of

find_package(BLAS) and find_package( LAPACK) within CMake.

It seems that depending on the vendor found, different source code is necessary. For example, mkl has

mkl.h and/or mkl_lapacke.h

but at least one other implementation of lapack has a header which is just called lapacke.h

so different headers are needed.

and also somatcopy for mkl is mkl_somatcopy whereas other libraries clearly wont have the mkl_ prefix.

How do you reconcile this in a generic fashion as to make a tool such as find_package( LAPACK) work effectively?

Is there a standard header, because it doesn't appear to be lapacke.h for the lapacke interface..?

Finally, Accelerate is listed as an option, but, Accelerate includes LAPACK 3.2.1 equivalent features which misses the LAPACKE interface which is available in MKL and current netlib lapacke 3.5..

1

1 Answers

1
votes

Ok, so the example I gave is an example of blas extension. The blas functions themselves are all the same. The only issue is the different header between mkl and other blas/lapack interfaces. As far as cmake is concerned the find_package() routines mentioned are a bit out of place. I found it easiest to search for mkl, use it if found, otherwise fall back to the findblas routines of cmake, then I use add_definitions to define a preprocessor macro to change between mkl and other Implementations...