-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
82 lines (68 loc) · 2.79 KB
/
CMakeLists.txt
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#
#
#
project(icc_junk LANGUAGES CXX)
cmake_minimum_required(VERSION 3.10)
message(STATUS "CMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
macro(make_executables)
file(GLOB source_files "*.cpp" )
foreach(cpp ${source_files})
get_filename_component(dir ${cpp} DIRECTORY)
get_filename_component(dir ${dir} NAME)
get_filename_component(prog ${cpp} NAME_WE)
get_filename_component(src ${cpp} NAME)
# Target 1
set (target "${dir}_${prog}")
message(STATUS "add_executable(${target} ${src})")
add_executable(${target} ${src})
target_compile_options(${target} PRIVATE "-Wall")
if ( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
target_compile_options(${target} PRIVATE "-msse4")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" )
target_compile_options(${target} PRIVATE "-qopenmp -static")
target_link_libraries(${target} PRIVATE "-qopenmp -static")
target_compile_options(${target} PRIVATE "-qopt-report=5")
else ()
message (WARNING "Default compiler settings...")
endif ()
# Target 2
set (target "${dir}_${prog}_x512")
message(STATUS "add_executable(${target} ${src})")
add_executable(${target} ${src})
target_compile_options(${target} PRIVATE "-Wall")
if ( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
#target_compile_options(${target} PRIVATE "-mavx512f -mavx512cd -mavx512er -mavx512pf")
target_compile_options(${target} PRIVATE "-mmmx")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" )
target_compile_options(${target} PRIVATE "-qopt-report=5")
target_compile_options(${target} PRIVATE "-qopenmp")
target_link_libraries(${target} PRIVATE "-qopenmp")
target_compile_options(${target} PRIVATE "-xCORE-AVX2")
else ()
message (WARNING "Default compiler settings...")
endif ()
# Target 3
set (target "${dir}_${prog}_novec")
message(STATUS "add_executable(${target} ${src})")
add_executable(${target} ${src})
target_compile_options(${target} PRIVATE "-Wall")
if ( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
target_compile_options(${target} PRIVATE "-fno-openmp")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" )
target_compile_options(${target} PRIVATE "-qopt-report=5")
target_compile_options(${target} PRIVATE "-qno-openmp")
target_compile_options(${target} PRIVATE "-no-vec")
else ()
message (WARNING "Default compiler settings...")
endif ()
# target_link_libraries(${target} PRIVATE Threads::Threads)
endforeach()
endmacro(make_executables)
# icpc -c -qopt-report=5 -xMIC-AVX512 stencil.cc
make_executables()
configure_file(matr_mult_proj.cmake matr_mult_proj)
# end of file