Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CMakeLists.txt - github.com/marian-nmt/intgemm/intgemm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 05e395ac285057c52aeb02fcf4f9b061f3ec7e0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
cmake_minimum_required(VERSION 3.5)
project(intgemm)

if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Release)
endif()

#Only the benchmark uses C++11
set(CMAKE_CXX_STANDARD 11)

set_source_files_properties(sse2_gemm.cc PROPERTIES COMPILE_FLAGS -msse2)
set_source_files_properties(ssse3_gemm.cc PROPERTIES COMPILE_FLAGS "-msse2 -mssse3")
set_source_files_properties(avx2_gemm.cc PROPERTIES COMPILE_FLAGS -mavx2)
set_source_files_properties(avx512_gemm.cc PROPERTIES COMPILE_FLAGS "-mavx512f -mavx512bw -mavx512dq")

try_compile(AVX512 "${CMAKE_BINARY_DIR}/compile_tests" "${CMAKE_SOURCE_DIR}/compile_test_avx512.cc"
  #Hack: pass compiler arguments as definitions because the test code overrides CXX_FLAGS :'(
  COMPILE_DEFINITIONS -mavx512f -mavx512bw -mavx512dq)

set(GEMMS
  avx2_gemm.cc
  sse2_gemm.cc
  ssse3_gemm.cc)

if (AVX512)
  set(GEMMS avx512_gemm.cc ${GEMMS})
else()
  message("Not building AVX512-based multiplication because your compiler is too old.\nFor details rerun cmake with --debug-trycompile then try to build in compile_tests/CMakeFiles/CMakeTmp.")
  set_source_files_properties(intgemm.cc test/quantize_test.cc test/multiply_test.cc benchmark.cc PROPERTIES COMPILE_DEFINITIONS "INTGEMM_NO_AVX512")
endif()

#add_library(intgemm STATIC ${GEMMS} intgemm.cc)
#foreach(exe example benchmark)
#  add_executable(${exe} ${exe}.cc)
#  target_link_libraries(${exe} intgemm)
#endforeach()

include_directories(.)
add_executable(tests test/multiply_test.cc test/quantize_test.cc avx2_gemm.cc) # avx512_gemm.cc)
#target_link_libraries(tests intgemm)

#CTest integration with Catch2
include(CMake/Catch.cmake)
include(CTest)
catch_discover_tests(tests)