Skip to content

Link the library MKL SDL to run pardiso_basic #3

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ find_package(LAPACK REQUIRED)
find_package(SCALAPACK REQUIRED)
find_package(MUMPS)
find_package(METIS)
find_package(MKL_SDL)

add_subdirectory(src)
64 changes: 64 additions & 0 deletions cmake/FindMKL_SDL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#[=======================================================================[.rst:
FindMKL_SDL
-------
Cauã Chagas.

Finds the Single Dynamic Library (SDL) of MKL.

Imported Targets
^^^^^^^^^^^^^^^^

MKL_SDL::MKL_SDL

Result Variables
^^^^^^^^^^^^^^^^

``MKL_SDL_FOUND``
MKL_SDL libraries were found
``MKL_SDL_LIBRARIES``
MKL_SDL library files
``MKL_SDL_INCLUDE_DIRS``
MKL_SDL include directories


#]=======================================================================]


find_library(MKL_LIBRARY
NAMES "libmkl_rt.so"
HINTS ${MKLROOT}
PATH_SUFFIXES lib lib/intel64
NO_DEFAULT_PATH
)

find_path(MKL_INCLUDE_DIR
NAMES mkl_pardiso.h
HINTS ${MKLROOT}
PATH_SUFFIXES include
NO_DEFAULT_PATH
)


include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(MKL_SDL HANDLE_COMPONENTS
REQUIRED_VARS MKL_LIBRARY MKL_INCLUDE_DIR
)

if(MKL_SDL_FOUND)

set(HAVE_PARDISO true)
set(MKL_SDL_LIBRARIES ${MKL_LIBRARY})
set(MKL_SDL_INCLUDE_DIRS ${MKL_INCLUDE_DIR})

if(NOT TARGET MKL_SDL::MKL_SDL)
add_library(MKL_SDL::MKL_SDL INTERFACE IMPORTED)
set_property(TARGET MKL_SDL::MKL_SDL PROPERTY INTERFACE_LINK_LIBRARIES "${MKL_SDL_LIBRARIES}")
set_property(TARGET MKL_SDL::MKL_SDL PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MKL_SDL_INCLUDE_DIR}")
endif()
endif(MKL_SDL_FOUND)

mark_as_advanced(MKL_INCLUDE_DIR MKL_LIBRARY)
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ HAVE_PARDISO

if(HAVE_PARDISO)
add_executable(pardiso_basic pardiso_basic.f90)
target_link_libraries(pardiso_basic PRIVATE SCALAPACK::SCALAPACK LAPACK::LAPACK)
target_link_libraries(pardiso_basic PRIVATE MKL_SDL::MKL_SDL)
add_test(NAME pardisoBasic COMMAND pardiso_basic)
endif()