Closed mathomp4 closed 4 years ago
I don't have possibility to test MKL on Darwin, @tlmquintino do you?
Thanks for reporting this. Yes I can test it. But the approach to define the MKL_Fortran is not the advised CMake approach to create FindXXX macros. It should be achieved via COMPONENTS options passed to the find_package() function. I will have a look at this.
Using the above CMakeLists.txt I cannot reproduce this with the latest master branch ecbuild 3.3.4
> cmake -DCMAKE_MODULE_PATH=~/git/ecbuild/cmake/ -DMKL_ROOT=/opt/intel/compilers_and_libraries_2020.2.258/mac/mkl/ ..
-- The Fortran compiler identification is GNU 10.2.0
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- The C compiler identification is AppleClang 11.0.0.11000033
...
-- Detecting C compile features
-- Detecting C compile features - done
-- Found MKL: /opt/intel/compilers_and_libraries_2020.2.258/mac/mkl/lib/libmkl_intel_lp64.dylib;/opt/intel/compilers_and_libraries_2020.2.258/mac/mkl/lib/libmkl_sequential.dylib;/opt/intel/compilers_and_libraries_2020.2.258/mac/mkl/lib/libmkl_core.dylib
-- Configuring done
-- Generating done
-- Build files have been written to: xxxx/git/fmkl/build
Note that the current FindMKL.cmake in ecbuild 3.3.4 does not support Fortran. Maybe that should be the aim for another PR.
Ah, I can reproduce if I use MKLROOT instead of MKL_ROOT.
> cmake -DCMAKE_MODULE_PATH=~/git/ecbuild/cmake/ -DMKLROOT=/opt/intel/compilers_and_libraries_2020.2.258/mac/mkl/ ..
...
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at /usr/local/Cellar/cmake/3.18.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
Could NOT find MKL (missing: MKL_LIBRARIES)
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.18.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
/Users/tiago/git/ecbuild/cmake/FindMKL.cmake:73 (find_package_handle_standard_args)
CMakeLists.txt:4 (find_package)
-- Configuring incomplete, errors occurred!
See also "/Users/tiago/git/fmkl/build/CMakeFiles/CMakeOutput.log".
OK, I got a fix for this issue. I will push it to develop. Note that this will not include support to search for Fortran libraries.
Solved with 3162b9f
All,
We seems to have an issue using ecbuild's
FindMKL.cmake
when used on Apple. To wit, using this simpleCMakeLists.txt
:on my Macbook with MKL actually around:
when I run cmake against
develop
(ormaster
, they are the same forFindMKL
) I get (editing out some of the cmake status output):Now we have a patch we've been using locally on a fork which when used gives:
You can see the changes here: https://github.com/ecmwf/ecbuild/compare/develop...mathomp4:bugfix/fix-mkl-darwin
You'll notice a few changes. I think the real fix is in the end because on Mac's there is no
lib/intel64
directory, justlib
. Linux:where
intel64
is actually a symlink tointel64_lin
, sofd
is resolving it. On a Mac:There is also a section with
MKL_Fortran
which is a bit hazy in my memory. A colleague seems to remember that in the past you could install just the MKL Fortran bindings and not the C somkl.h
would not exist butmkl_blas.f90
would. Since we don't use MKL in anything but Fortran, this change allowed MKL to be found withoutmkl.h
(though you had to doset(MKL_Fortran)
which is no big deal).If you can confirm this issue, I could make a PR with our changes.