- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried to compile my program by using CMake at first and my CMakeLists file is as the following.
cmake_minimum_required(VERSION 3.11)
project(LMMNET LANGUAGES CXX)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "-O2 -msse -msse2")
#set(CMAKE_CXX_COMPILER "icpc")
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
find_package(Boost 1.58.0 COMPONENTS program_options REQUIRED)
find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
target_link_libraries(dataIO PUBLIC ${Boost_LIBRARIES})
target_link_libraries(DataMatrix PUBLIC DataUtils
${Boost_LIBRARIES}
${LAPACK_LIBRARIES})
target_link_libraries(LMMNET PUBLIC dataIO
DataMatrix)
I can link the Intel Math Kernel Library correctly and the program works well. However, I find it is interesting that when I link the Intel Math Kernel Library following the official instruction as
-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel64/libmkl_gnu_thread.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lgomp -lpthread -lm -ldl.
The performance of my program is much better than ever. My program even run faster four times than before. (I just do the matrix-matrix multiplication). Why it comes for that?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If Cmake built the first program by using a version of the Lapack library different from that inside MKL, whereas the second program was built using MKL, one should expect the second program to run faster since the MKL library is highly optimized for fast execution.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page