CMakeLists.txt 3 KB
Newer Older
martinp16cs's avatar
martinp16cs committed
1 2 3
cmake_minimum_required(VERSION 3.6)
project(blasJoin)

Martin Perdacher's avatar
Martin Perdacher committed
4
set(UTIL_SOURCES util/dataIo.cpp util/arguments.cpp util/allocation.cpp  measure/timer.cpp)
Martin Perdacher's avatar
Martin Perdacher committed
5 6 7

set(SOURCE_FILES_SELF main.cpp blasJoin/blasJoin.cpp ${UTIL_SOURCES})
set(SOURCE_FILES_JOIN mainJoin.cpp blasJoin/blasJoin.cpp ${UTIL_SOURCES})
martinp16cs's avatar
martinp16cs committed
8 9 10 11 12

#####################
# build type: Release
#####################
# NDDEBUG turns off asserts
Martin Perdacher's avatar
Martin Perdacher committed
13
set(CMAKE_CXX_FLAGS "-std=c++11")
Martin Perdacher's avatar
Martin Perdacher committed
14

martinp16cs's avatar
martinp16cs committed
15
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
16 17
  # some issues with GNU, use Intel Compiler instead
  # set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -march=skylake-avx512 -fpic -ffast-math -DNDEBUG -O3 -DNDDEBUG -fopenmp -lboost_system -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl")
martinp16cs's avatar
martinp16cs committed
18
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
19
  set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -xCore-AVX512 -qopenmp -DNDEBUG -O3 -lmkl_intel_thread  -liomp5 -lpthread -lmkl_core -lmkl_intel_lp64 -lboost_system")
Martin Perdacher's avatar
Martin Perdacher committed
20
  # set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -qopt-report=2")
21
  add_definitions(-DDEBUG)
martinp16cs's avatar
martinp16cs committed
22 23 24 25 26 27 28 29 30
endif()

add_definitions(-DNUM_THREADS=64)

####################
# build type: Debug
####################
# cmake -D CMAKE_BUILD_TYPE:STRING=Debug ..
# and ignore the warning: "Manually-specified variables were not used by the project: CMAKE_BUID_TYPE"
Martin Perdacher's avatar
Martin Perdacher committed
31
set(CMAKE_CXX_FLAGS_DEBUG "-std=c++11")
martinp16cs's avatar
martinp16cs committed
32 33

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
Martin Perdacher's avatar
Martin Perdacher committed
34
  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -march=knl -mtune=knl -fpic -ffast-math -O0 -fopenmp -lboost_system")
martinp16cs's avatar
martinp16cs committed
35
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
Martin Perdacher's avatar
Martin Perdacher committed
36
  set(CMAKE_CXX_FLAGS_DEBUG  "${CMAKE_CXX_FLAGS_DEBUG} -xmic-avx512 -fpic -qopenmp -axCOMMON-AVX512 -lmemkind -lmkl_core -lmkl_intel_lp64 -lmkl_intel_thread -liomp5 -lpthread -g -debug all -save-temps -Wl, -O0 -fstack-security-check -lboost_system")
martinp16cs's avatar
martinp16cs committed
37 38 39 40 41 42 43 44
endif()

# adding MKL include directory
include_directories($ENV{MKLROOT}/include)

# xeon-phi
link_directories($ENV{MKLROOT}/lib/intel64)

Martin Perdacher's avatar
Martin Perdacher committed
45 46
include_directories($ENV{BOOST_HOME}/include/boost)
link_directories($ENV{BOOST_HOME}/lib)
martinp16cs's avatar
martinp16cs committed
47

Martin Perdacher's avatar
Martin Perdacher committed
48
# mkl libraries
martinp16cs's avatar
martinp16cs committed
49 50 51 52 53 54 55 56 57
find_library ( mkl_lp64_LIB NAMES libmkl_intel_lp64.a
        PATHS $ENV{MKLROOT} PATH_SUFFIXES lib)
find_library ( mkl_core_LIB NAMES libmkl_core.a
        PATHS $ENV{MKLROOT} PATH_SUFFIXES lib)
find_library ( mkl_thread_LIB NAMES libmkl_intel_thread.a
        PATHS $ENV{MKLROOT} PATH_SUFFIXES lib)
find_library ( mkl_omp_LIB NAMES libiomp5.a
        PATHS $ENV{MKLROOT} PATH_SUFFIXES lib)

Martin Perdacher's avatar
Martin Perdacher committed
58 59 60 61 62 63
# papi library
set(PAPI_PREFIX "/usr/local")
find_library(PAPI_LIBRARIES
    # Pick the static library first for easier run-time linking.
    NAMES libpapi.a papi PATHS ${PAPI_PREFIX}/lib
)
martinp16cs's avatar
martinp16cs committed
64

Martin Perdacher's avatar
Martin Perdacher committed
65 66 67
# add_executable(blasSelfJoin ${SOURCE_FILES_SELF})
add_executable(blasSelfJoinCardinality ${SOURCE_FILES_SELF})
target_compile_definitions(blasSelfJoinCardinality PRIVATE -DCOUNT_ONLY)
Martin Perdacher's avatar
Martin Perdacher committed
68

Martin Perdacher's avatar
Martin Perdacher committed
69 70 71
# add_executable(blasJoin ${SOURCE_FILES_JOIN})
add_executable(blasJoinCardinality ${SOURCE_FILES_JOIN})
target_compile_definitions(blasJoinCardinality PRIVATE -DCOUNT_ONLY)
Martin Perdacher's avatar
update  
Martin Perdacher committed
72
# target_link_libraries(blasJoin ${PAPI_LIBRARIES})