7.4.2 : The CMakeLists.txt

There is the CMakeLists.txt file :
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
project(Saxpy)
cmake_minimum_required(VERSION 3.0)

add_executable(saxpy_O0 main.cpp)
set_property(TARGET saxpy_O0 PROPERTY COMPILE_FLAGS "-O0")
target_link_libraries(saxpy_O0 asterics_hpc)
runExample(saxpy_O0)

add_executable(saxpy_O1 main.cpp)
set_property(TARGET saxpy_O1 PROPERTY COMPILE_FLAGS "-O1")
target_link_libraries(saxpy_O1 asterics_hpc)
runExample(saxpy_O1)

add_executable(saxpy_O2 main.cpp)
set_property(TARGET saxpy_O2 PROPERTY COMPILE_FLAGS "-O2")
target_link_libraries(saxpy_O2 asterics_hpc)
runExample(saxpy_O2)

add_executable(saxpy_O3 main.cpp)
set_property(TARGET saxpy_O3 PROPERTY COMPILE_FLAGS "-O3")
target_link_libraries(saxpy_O3 asterics_hpc)
runExample(saxpy_O3)

add_executable(saxpy_Ofast main.cpp)
set_property(TARGET saxpy_Ofast PROPERTY COMPILE_FLAGS "-Ofast")
target_link_libraries(saxpy_Ofast asterics_hpc)
runExample(saxpy_Ofast)

plotPerf("saxpyBase" saxpy_O0 saxpy_O1 saxpy_O2 saxpy_O3 saxpy_Ofast)

add_executable(saxpy_vectorize main_vectorize.cpp)
set_property(TARGET saxpy_vectorize PROPERTY COMPILE_FLAGS "-O3 -ftree-vectorize -march=native -mtune=native -mavx2")
target_link_libraries(saxpy_vectorize asterics_hpc)
runExample(saxpy_vectorize)

plotPerf("saxpyVectorize" saxpy_O3 saxpy_vectorize)

add_executable(saxpy_intrinsics main_intrinsics.cpp)
set_property(TARGET saxpy_intrinsics PROPERTY COMPILE_FLAGS "-O3 -march=native -mtune=native")
target_link_libraries(saxpy_intrinsics asterics_hpc)
runExample(saxpy_intrinsics)

plotPerf("saxpyIntrinsics" saxpy_O3 saxpy_vectorize saxpy_intrinsics)