I am trying to adapt a source code originally written for Intel MKL to the latest OneAPI and compile it under MacOS.
I have modified the CMakeLists to find OneAPI libraries like this:
option (USE_ONEAPI "Enable MKL solver support via OneAPI Base Toolkit" ON)
...
if (USE_ONEAPI)
message(STATUS "Seeking OneAPI libraries...")
list(APPEND MKL_LIBS "mkl_core" "mkl_gf_lp64" "mkl_gnu_thread" "pthread")
foreach (f ${MKL_LIBS})
if (INTEL_ONEAPI_DIR)
# user provided OneAPI directory
set(oneapiMklDir "${INTEL_ONEAPI_DIR}/mkl/latest")
message(STATUS " Seeking for ${f} in custom path: ${oneapiMklDir}...")
find_library (${f}_LIB ${f} PATH "${INTEL_ONEAPI_DIR}/mkl/lib/intel64/" DOC "MKLPARDISO (library)")
include_directories ("${INTEL_ONEAPI_DIR}/mkl/include")
else ()
set(oneapiDir "/opt/intel/oneapi")
set(oneapiMklDir "${oneapiDir}/mkl/latest")
message(STATUS " Seeking for ${f} in default path: ${oneapiMklDir}...")
find_library (${f}_LIB ${f} HINTS "${oneapiMklDir}/lib" DOC "MKLPARDISO (library)")
include_directories ("${oneapiMklDir}/include")
endif ()
if (${${f}_LIB} STREQUAL "${f}_LIB-NOTFOUND")
message (FATAL_ERROR "OneAPI ${f} library not found")
else()
message (STATUS "OK: ${f} library successfully found")
endif ()
list (APPEND EXT_LIBS ${${f}_LIB})
endforeach ()
list (APPEND MODULE_LIST "MKLPARDISO")
endif ()
And this is the outcome:
-- Seeking OneAPI libraries...
-- Seeking for mkl_core in default path: /opt/intel/oneapi/mkl/latest...
-- OK: mkl_core_LIB library successfully found
-- Seeking for mkl_gf_lp64 in default path: /opt/intel/oneapi/mkl/latest...
CMake Error at CMakeLists.txt:379 (message):
OneAPI mkl_gf_lp64 library not found
I am not sure why CMake fails to find those libraries. Are they not installed with OneAPI base and HPC toolkits?
This is old so likely you already found a solution, but since I'm going through oneapi questions I figured I'd answer for the next person.
The mkl_gf_lp64 is not included but mkl_intel_lp64 is. The two are not equivalent so you would likely need mkl_intel_thread.
You can also use the oneAPI MKL Library Link Line Advisor to figure out exactly what you need.
https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.html