From b91be60220d26335d3c7e205d09a34798e7a4c0c Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Wed, 21 Dec 2016 13:44:59 -0800 Subject: Automatically include and link libxsmm when present. --- cmake/EigenTesting.cmake | 6 ++++++ cmake/FindXsmm.cmake | 27 ++++++++++++++------------- 2 files changed, 20 insertions(+), 13 deletions(-) (limited to 'cmake') diff --git a/cmake/EigenTesting.cmake b/cmake/EigenTesting.cmake index a92a2978b..a83b9435e 100644 --- a/cmake/EigenTesting.cmake +++ b/cmake/EigenTesting.cmake @@ -84,6 +84,12 @@ macro(ei_add_test_internal testname testname_with_suffix) target_link_libraries(${targetname} ${EIGEN_TEST_CUSTOM_LINKER_FLAGS}) endif() + if(XSMM_FOUND) + include_directories(${XSMM_INCLUDES}) + link_directories(${XSMM_LIBRARIES}) + target_link_libraries(${targetname} xsmm) + endif() + if(${ARGC} GREATER 3) set(libs_to_link ${ARGV3}) # it could be that some cmake module provides a bad library string " " (just spaces), diff --git a/cmake/FindXsmm.cmake b/cmake/FindXsmm.cmake index 745414c72..809d6f414 100644 --- a/cmake/FindXsmm.cmake +++ b/cmake/FindXsmm.cmake @@ -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) -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 - scotch.h + libxsmm.h PATHS - $ENV{XSMMDIR} + $ENV{XSMMDIR}/include ${INCLUDE_INSTALL_DIR} - PATH_SUFFIXES - scotch ) - -find_library(XSMM_LIBRARIES xsmm PATHS $ENV{XSMMDIR} ${LIB_INSTALL_DIR}) - include(FindPackageHandleStandardArgs) find_package_handle_standard_args(XSMM DEFAULT_MSG - XSMM_INCLUDES XSMM_LIBRARIES) + LIBXSMM) -mark_as_advanced(XSMM_INCLUDES XSMM_LIBRARIES) +mark_as_advanced(LIBXSMM) -- cgit v1.2.3