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: 933a9422ef21bc6577bff3ce9ae3c0df3ed8bcc9 (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
cmake_minimum_required(VERSION 3.5)
project(intgemm)
string(ASCII 27 Esc)
set(Orange "${Esc}[33m")
set(ColourReset "${Esc}[m")

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

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

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)

if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
  # Working around https://bugs.llvm.org/show_bug.cgi?id=41482
  # Anything compiled with clang might not work properly in SSE2/SSSE3 world
  message("${Orange}Compiling with Clang and using -mavx2 due to https://bugs.llvm.org/show_bug.cgi?id=41482. Support for SSE2/SSSE3 is likely broken.${ColourReset}")
  SET(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -mavx2")
endif()


if (NOT AVX512)
  message("${Orange}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.${ColourReset}")
  set_source_files_properties(intgemm.cc test/quantize_test.cc test/multiply_test.cc benchmark.cc PROPERTIES COMPILE_DEFINITIONS "INTGEMM_NO_AVX512")
endif()

foreach(exe example benchmark)
  add_executable(${exe} ${exe}.cc)
endforeach()

include_directories(.)
add_executable(tests test/multiply_test.cc test/quantize_test.cc)

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