Skip to content

Commit

Permalink
more conservative use of ENV{MKLROOT}
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed May 24, 2024
1 parent 821e900 commit 78cfd9e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ find_package(Threads)

if(parallel)
find_package(MPI COMPONENTS C Fortran REQUIRED)
if(NOT DEFINED ENV{MKLROOT} OR NOT scalapack)
if(NOT DEFINED ENV{MKLROOT} AND NOT LAPACK_VENDOR MATCHES "^MKL" OR NOT scalapack)
# oneMKL MKLConfig.cmake must be invoked only once
include(cmake/lapack.cmake)
endif()
Expand Down Expand Up @@ -105,6 +105,8 @@ DESTINATION cmake

message(STATUS "MUMPS ORDERING_DEFS: ${ORDERING_DEFS}")
message(STATUS "MUMPS ORDERING_LIBS: ${ORDERING_LIBS}")
message(STATUS "MUMPS LAPACK_VENDOR: ${LAPACK_VENDOR}")
message(STATUS "MUMPS SCALAPACK_VENDOR: ${SCALAPACK_VENDOR}")

# --- download MUMPS source
include(FetchContent)
Expand Down
3 changes: 2 additions & 1 deletion cmake/FindLAPACK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,9 @@ if(NOT (lapack_cray
OR Netlib IN_LIST LAPACK_FIND_COMPONENTS
OR Atlas IN_LIST LAPACK_FIND_COMPONENTS
OR MKL IN_LIST LAPACK_FIND_COMPONENTS
OR MKL64 IN_LIST LAPACK_FIND_COMPONENTS
OR AOCL IN_LIST LAPACK_FIND_COMPONENTS))
if(DEFINED ENV{MKLROOT})
if(DEFINED ENV{MKLROOT} AND IS_DIRECTORY "$ENV{MKLROOT}")
list(APPEND LAPACK_FIND_COMPONENTS MKL)
else()
list(APPEND LAPACK_FIND_COMPONENTS Netlib)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindSCALAPACK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ if(DEFINED ENV{CRAYPE_VERSION})
endif()

if(NOT scalapack_cray)
if(NOT MKL IN_LIST SCALAPACK_FIND_COMPONENTS AND DEFINED ENV{MKLROOT})
if(NOT MKL IN_LIST SCALAPACK_FIND_COMPONENTS AND DEFINED ENV{MKLROOT} AND IS_DIRECTORY "$ENV{MKLROOT}")
list(APPEND SCALAPACK_FIND_COMPONENTS MKL)
endif()
endif()
Expand Down
9 changes: 5 additions & 4 deletions cmake/config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ set(MUMPS_d_FOUND @BUILD_DOUBLE@)
set(MUMPS_c_FOUND @BUILD_COMPLEX@)
set(MUMPS_z_FOUND @BUILD_COMPLEX16@)

if(NOT DEFINED ENV{MKLROOT})
find_dependency(LAPACK COMPONENTS ${MUMPS_LAPACK_VENDOR})
endif()

if(MUMPS_parallel)
find_dependency(MPI COMPONENTS C Fortran)

if(NOT MUMPS_LAPACK_VENDOR MATCHES "^MKL")
find_dependency(LAPACK COMPONENTS ${MUMPS_LAPACK_VENDOR})
endif()

find_dependency(SCALAPACK)
else()
find_dependency(LAPACK COMPONENTS ${MUMPS_LAPACK_VENDOR})
Expand Down
2 changes: 1 addition & 1 deletion cmake/lapack.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Handle options for finding LAPACK

if(NOT DEFINED LAPACK_VENDOR AND DEFINED ENV{MKLROOT})
if(NOT DEFINED LAPACK_VENDOR AND DEFINED ENV{MKLROOT} AND IS_DIRECTORY "$ENV{MKLROOT}")
set(LAPACK_VENDOR MKL)
endif()

Expand Down
12 changes: 9 additions & 3 deletions cmake/scalapack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ include(GNUInstallDirs)

if(find)

if(NOT DEFINED SCALAPACK_VENDOR AND DEFINED ENV{MKLROOT})
set(SCALAPACK_VENDOR MKL)
if(NOT DEFINED SCALAPACK_VENDOR)
if(LAPACK_VENDOR MATCHES "^MKL")
set(SCALAPACK_VENDOR MKL)
elseif(NOT DEFINED LAPACK_VENDOR AND
(DEFINED ENV{MKLROOT} AND IS_DIRECTORY "$ENV{MKLROOT}"))
set(SCALAPACK_VENDOR MKL)
set(LAPACK_VENDOR MKL)
endif()
endif()

if(MKL IN_LIST SCALAPACK_VENDOR)
if(MKL IN_LIST SCALAPACK_VENDOR AND NOT MKL64 IN_LIST SCALAPACK_VENDOR)
if(intsize64)
list(APPEND SCALAPACK_VENDOR MKL64)
endif()
Expand Down

0 comments on commit 78cfd9e

Please sign in to comment.