Skip to content

Instantly share code, notes, and snippets.

@scivision
Last active October 18, 2018 17:08
Show Gist options
  • Save scivision/bddf416190320e844bd6b5f9846b1396 to your computer and use it in GitHub Desktop.
Save scivision/bddf416190320e844bd6b5f9846b1396 to your computer and use it in GitHub Desktop.
Minimal Fortran Intel MKL CMake -- assuming you want MKL BLAS
cmake_minimum_required(VERSION 3.1)
project(mytest Fortran)
# NOTE: -fdefault-integer-8 -m64 are crucial for MKL to avoid SIGSEGV at runtime!
add_compile_options(-fdefault-integer-8 -m64)
add_executable(inteld intel_dgemm.f90)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
find_package(MKL)
if(MKL_FOUND)
include_directories(${MKL_INCLUDE_DIRS})
target_link_libraries(inteld ${MKL_LIBRARIES} pthread dl)
else()
find_package(BLAS REQUIRED)
target_link_libraries(inteld blas)
endif()
@scivision
Copy link
Author

scivision commented Jun 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment