Permalink
Browse files

Added Intel MKL support for PhotometryTK

Added and modified an online available FindMKL script.
  • Loading branch information...
1 parent 5788c6b commit 8ff3747c1ccf0196c0bfc340d4e76a8ddd48896b Zachary Moratto committed Sep 2, 2011
Showing with 92 additions and 1 deletion.
  1. +6 −1 CMakeLists.txt
  2. +7 −0 cmake/AddPHOTK.cmake
  3. +79 −0 cmake/FindMKL.cmake
View
@@ -65,8 +65,13 @@ find_package(VisionWorkbench REQUIRED
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIRS})
find_package(GooglePerfTools)
+find_package(MKL)
photk_enable_testing()
+if (MKL_LIBRARIES)
+ include_directories(${MKL_INCLUDE_DIR})
+endif()
+
if (ENABLE_PROFILING AND GOOGLE_PERFTOOLS_FOUND)
set(PHOTK_ENABLE_PROFILING ON )
else()
@@ -96,4 +101,4 @@ add_subdirectory(src/photk)
add_subdirectory(src/tools)
# Adding test directories
-add_subdirectory(src/photk/tests)
+add_subdirectory(src/photk/tests)
@@ -12,6 +12,9 @@ macro(add_photk_executable name)
if ( PHOTK_ENABLE_TCMALLOC )
target_link_libraries( ${name} ${TCMALLOC_LIBRARY} )
endif()
+ if ( MKL_LIBRARIES )
+ target_link_libraries( ${name} ${MKL_LIBRARIES} )
+ endif()
endmacro(add_photk_executable name)
macro(add_photk_tool name)
@@ -64,6 +67,10 @@ function(photk_add_test source_file)
)
add_dependencies(check ${executable}Exec)
+ if ( MKL_LIBRARIES )
+ target_link_libraries( ${executable} ${MKL_LIBRARIES} )
+ endif()
+
# file(READ "${source_file}" contents)
# string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
# foreach(hit ${found_tests})
View
@@ -0,0 +1,79 @@
+
+if (MKL_LIBRARIES)
+ set(MKL_FIND_QUIETLY TRUE)
+endif (MKL_LIBRARIES)
+
+find_path(MKL_INCLUDE_DIR
+ NAMES mkl.h
+ HINTS $ENV{MKL_ROOT}
+ ${MKL_ROOT}
+ /opt/intel/mkl
+ /usr/intel/mkl
+ PATH_SUFFIXES include
+ )
+
+if (NOT MKL_ROOT)
+ set(MKL_ROOT ${MKL_INCLUDE_DIR}/..)
+endif()
+
+if(CMAKE_MINOR_VERSION GREATER 4)
+
+ if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
+
+ find_library(MKL_LIBRARIES
+ NAMES mkl_core
+ PATHS $ENV{MKL_ROOT}/lib/em64t
+ ${MKL_ROOT}/lib/em64t
+ /opt/intel/mkl/*/lib/em64t
+ /opt/intel/Compiler/*/*/mkl/lib/em64t
+ ${LIB_INSTALL_DIR}
+ )
+
+ find_library(MKL_GUIDE
+ NAMES guide
+ PATHS $ENV{MKL_ROOT}/lib/em64t
+ ${MKL_ROOT}/lib/em64t
+ /opt/intel/mkl/*/lib/em64t
+ /opt/intel/Compiler/*/*/mkl/lib/em64t
+ /opt/intel/Compiler/*/*/lib/intel64
+ ${LIB_INSTALL_DIR}
+ )
+
+ if(MKL_LIBRARIES AND MKL_GUIDE)
+ set(MKL_LIBRARIES ${MKL_LIBRARIES} mkl_intel_lp64 mkl_sequential ${MKL_GUIDE} pthread)
+ endif()
+
+ else(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
+
+ find_library(MKL_LIBRARIES
+ NAMES mkl_core
+ PATHS $ENV{MKL_ROOT}/lib/32
+ ${MKL_ROOT}/lib/32
+ /opt/intel/mkl/*/lib/32
+ /opt/intel/Compiler/*/*/mkl/lib/32
+ ${LIB_INSTALL_DIR}
+ )
+
+ find_library(MKL_GUIDE
+ NAMES guide
+ PATHS $ENV{MKL_ROOT}/lib/32
+ ${MKL_ROOT}/lib/32
+ /opt/intel/mkl/*/lib/32
+ /opt/intel/Compiler/*/*/mkl/lib/32
+ /opt/intel/Compiler/*/*/lib/intel32
+ ${LIB_INSTALL_DIR}
+ )
+
+ if(MKL_LIBRARIES AND MKL_GUIDE)
+ set(MKL_LIBRARIES ${MKL_LIBRARIES} mkl_intel mkl_sequential ${MKL_GUIDE} pthread)
+ endif()
+
+ endif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
+
+endif(CMAKE_MINOR_VERSION GREATER 4)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MKL DEFAULT_MSG MKL_LIBRARIES)
+
+mark_as_advanced(MKL_LIBRARIES)
+mark_as_advanced(MKL_GUIDE)

0 comments on commit 8ff3747

Please sign in to comment.