Automatically include and link libxsmm when present.

This commit is contained in:
Benoit Steiner 2016-12-21 13:44:59 -08:00
parent f9eff17e91
commit b91be60220
2 changed files with 20 additions and 13 deletions

View File

@ -84,6 +84,12 @@ macro(ei_add_test_internal testname testname_with_suffix)
target_link_libraries(${targetname} ${EIGEN_TEST_CUSTOM_LINKER_FLAGS}) target_link_libraries(${targetname} ${EIGEN_TEST_CUSTOM_LINKER_FLAGS})
endif() endif()
if(XSMM_FOUND)
include_directories(${XSMM_INCLUDES})
link_directories(${XSMM_LIBRARIES})
target_link_libraries(${targetname} xsmm)
endif()
if(${ARGC} GREATER 3) if(${ARGC} GREATER 3)
set(libs_to_link ${ARGV3}) set(libs_to_link ${ARGV3})
# it could be that some cmake module provides a bad library string " " (just spaces), # it could be that some cmake module provides a bad library string " " (just spaces),

View File

@ -1,24 +1,25 @@
# libxsmm # libxsmm support.
# libxsmm provides matrix multiplication kernels optimized for
# the latest Intel architectures.
# Download the library from https://github.com/hfp/libxsmm
# Compile with make BLAS=0
if (XSMM_INCLUDES AND XSMM_LIBRARIES) if (LIBXSMM)
set(XSMM_FIND_QUIETLY TRUE) set(XSMM_FIND_QUIETLY TRUE)
endif (XSMM_INCLUDES AND XSMM_LIBRARIES) set(XSMM_INCLUDES ${LIBXSMM}/include)
set(XSMM_LIBRARIES ${LIBXSMM}/lib)
endif (LIBXSMM)
find_path(XSMM_INCLUDES find_path(LIBXSMM
NAMES NAMES
scotch.h libxsmm.h
PATHS PATHS
$ENV{XSMMDIR} $ENV{XSMMDIR}/include
${INCLUDE_INSTALL_DIR} ${INCLUDE_INSTALL_DIR}
PATH_SUFFIXES
scotch
) )
find_library(XSMM_LIBRARIES xsmm PATHS $ENV{XSMMDIR} ${LIB_INSTALL_DIR})
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(XSMM DEFAULT_MSG find_package_handle_standard_args(XSMM DEFAULT_MSG
XSMM_INCLUDES XSMM_LIBRARIES) LIBXSMM)
mark_as_advanced(XSMM_INCLUDES XSMM_LIBRARIES) mark_as_advanced(LIBXSMM)