Last active
August 30, 2023 21:25
-
-
Save scivision/98bf58b0325734a5fbcebe3fd0013691 to your computer and use it in GitHub Desktop.
Intel oneMKL Scalapack build built-in examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.20.2...3.27) | |
project(ScalapackMKL LANGUAGES Fortran) | |
message(STATUS "ENV{MKLROOT}: $ENV{MKLROOT}") | |
# this find_package() isn't required, but we do it here | |
# to discover if Scalapack is missing | |
set(ENABLE_BLACS true) | |
set(ENABLE_SCALAPACK true) | |
find_package(MKL CONFIG REQUIRED) | |
message(STATUS "MKL_ROOT: ${MKL_ROOT}") | |
# this is how to link MKL in general | |
# target_link_library(myexe PRIVATE MKL::MKL) | |
include(ExternalProject) | |
find_file(archive | |
NAMES examples_cluster_f.tgz examples_cluster_f.zip | |
HINTS ${MKL_ROOT} | |
PATH_SUFFIXES examples | |
NO_DEFAULT_PATH | |
REQUIRED | |
) | |
message(STATUS "source archive: ${archive}") | |
set(cmake_args | |
-DCMAKE_MODULE_PATH:PATH=${MKL_ROOT}/examples/cmake | |
-DCMAKE_Fortran_COMPILER:FILEPATH=${CMAKE_Fortran_COMPILER} | |
) | |
ExternalProject_Add(examples | |
URL ${archive} | |
CONFIGURE_HANDLED_BY_BUILD true | |
CMAKE_ARGS ${cmake_args} | |
INSTALL_COMMAND "" | |
TEST_BEFORE_INSTALL true | |
) | |
ExternalProject_Get_Property(examples BINARY_DIR) | |
message(STATUS "To run tests after build manually: | |
ctest --test-dir ${BINARY_DIR}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment