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

github.com/marian-nmt/intgemm/intgemm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2018-06-28 22:08:20 +0300
committerKenneth Heafield <github@kheafield.com>2018-06-28 22:17:20 +0300
commitf8e7a6eecadcd3f142e74765634c03aaf3d1eb77 (patch)
treef7605a7e22692476b06441382b7f135c7cbba970 /CMakeLists.txt
parentc10b7b4ea08c39c7b6cbb5314a97d829920268ac (diff)
cmake with avx512 compilation test
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt29
1 files changed, 29 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..e1fe596
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,29 @@
+cmake_minimum_required(VERSION 2.8)
+project(intgemm)
+
+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 quantize_test.cc multiply_test.cc benchmark.cc PROPERTIES COMPILE_DEFINITIONS "INTGEMM_NO_AVX512")
+endif()
+
+add_library(intgemm STATIC ${GEMMS} intgemm.cc)
+foreach(exe multiply_test quantize_test example benchmark)
+ add_executable(${exe} ${exe}.cc)
+ target_link_libraries(${exe} intgemm)
+endforeach()