Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor CMake code for finding MKL #8

Open
fnrizzi opened this issue Dec 13, 2022 · 1 comment
Open

refactor CMake code for finding MKL #8

fnrizzi opened this issue Dec 13, 2022 · 1 comment
Assignees

Comments

@fnrizzi
Copy link

fnrizzi commented Dec 13, 2022

Similarly to #7 , the logic for the Intel library MKL needs to be update in the build system to detect the new oneMKL library properly and manage its targets to enable functionalities for both CPU and GPU.

@mperrinel
Copy link
Collaborator

mperrinel commented Feb 7, 2023

This comment is in progress. Its aims to summarize a bit of MKL history and current status. The idea is to understand how MKL is currently included in the project and how we could improve that:

Links:
From the doc: https://github.com/trilinos/Trilinos/blob/master/cmake/TPLs/FindTPLMKL.cmake :

  • Intel's Math Kernel Library (MKL) provides an implementation of :
    • BLAS and LAPACK, which can be used to satisfy the BLAS and LAPACK TPLs
    • MKL TPL refers to other functionalities provided by MKL (sparse matrix kernels, pseudorandom number generators)
  • Link to know what you need depending of you os, compiler, architecture,...:
    https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.html#gs.pict98
    • Number of combinaison is very long
    • A lot of options are common
  • Since version 10.3, MKL => (option) only one lib necessary: mkl_rt
    • Doesn't need to know all the different inners lib
    • Additional libs can be necessary for different OS (Linux: thread and m)

From the doc https://www.intel.com/content/www/us/en/develop/documentation/onemkl-linux-developer-guide/top/getting-started/cmake-config-for-onemkl.html

  • MKLConfig.cmake is provided ( starting with (oneMKL) 2021.3 release) => find_package possible
target_compile_options(myapp PUBLIC $<TARGET_PROPERTY:MKL::MKL,INTERFACE_COMPILE_OPTIONS>)
target_include_directories(myapp PUBLIC $<TARGET_PROPERTY:MKL::MKL,INTERFACE_INCLUDE_DIRECTORIES>)
target_link_libraries(myapp PUBLIC $<LINK_ONLY:MKL::MKL>)
  • This module file is modern and uses TARGETs

From the doc https://www.intel.com/content/www/us/en/developer/articles/guide/intel-math-kernel-library-intel-mkl-2019-install-guide.html?wapkw=one%20mkl

  • What look like the directory layout of MKL (not one MKL => Before 2020, 2019 for instance)
    • \bin<arch>\
    • \include\
    • \lib<arch>\
    • No CMake find module
  • Ubunutu LTS 20 and 22 => used intel mkl 2020 (but doesn't seem to use oneMKL)
    • Lib 2019 respected but 'mkl' is added for include
    • /usr/include/mkl/mkl.h
    • /usr/lib/x86_64-linux-gnu/libmkl_rt.so
    • No CMake find module
  • Layout directory of >= 2021 ?

From the doc https://en.wikipedia.org/wiki/Math_Kernel_Library :

  • The oneAPI Math Kernel Library (oneMKL) oneMKL interface (https://spec.oneapi.io/versions/latest/elements/oneMKL/source/index.html) => no code, only interface which anymore can implement.
  • Intel oneAPI Math Kernel Library != oneAPI Math Kernel Library (oneMKL) Interface intel oneMKL.
    • oneMKL Interfaces is an open-source implementation of the oneMKL Data Parallel C++ (DPC++) interface according to the oneMKL specification (https://github.com/oneapi-src/oneMKL)
    • Intel oneAPI Math Kernel Library is not DPC++ only
    • Since April 2020, MKL has become part of oneAPI

Recommended way to get MKL on linux ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: In Progress
Development

No branches or pull requests

2 participants