10.6.4 : The CMakeLists.txt file

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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
project(SGEMM)
cmake_minimum_required(VERSION 3.0)

add_executable(sgemm_base_O0 sgemm.cpp main_sgemm.cpp)
set_property(TARGET sgemm_base_O0 PROPERTY COMPILE_FLAGS "-O0")
target_link_libraries(sgemm_base_O0 asterics_hpc)
runExample(sgemm_base_O0)

add_executable(sgemm_base_O1 sgemm.cpp main_sgemm.cpp)
set_property(TARGET sgemm_base_O1 PROPERTY COMPILE_FLAGS "-O1")
target_link_libraries(sgemm_base_O1 asterics_hpc)
runExample(sgemm_base_O1)

add_executable(sgemm_base_O2 sgemm.cpp main_sgemm.cpp)
set_property(TARGET sgemm_base_O2 PROPERTY COMPILE_FLAGS "-O2")
target_link_libraries(sgemm_base_O2 asterics_hpc)
runExample(sgemm_base_O2)

add_executable(sgemm_base_O3 sgemm.cpp main_sgemm.cpp)
set_property(TARGET sgemm_base_O3 PROPERTY COMPILE_FLAGS "-O3")
target_link_libraries(sgemm_base_O3 asterics_hpc)
runExample(sgemm_base_O3)

add_executable(sgemm_base_Ofast sgemm.cpp main_sgemm.cpp)
set_property(TARGET sgemm_base_Ofast PROPERTY COMPILE_FLAGS "-Ofast")
target_link_libraries(sgemm_base_Ofast asterics_hpc)
runExample(sgemm_base_Ofast)

plotPerf("sgemmBase" sgemm_base_O0 sgemm_base_O1 sgemm_base_O2 sgemm_base_O3 sgemm_base_Ofast)

add_executable(sgemm_swap_O3 sgemm_swap.cpp main_sgemm_swap.cpp)
set_property(TARGET sgemm_swap_O3 PROPERTY COMPILE_FLAGS "-O3")
target_link_libraries(sgemm_swap_O3 asterics_hpc)
runExample(sgemm_swap_O3)

add_executable(sgemm_swap_Ofast sgemm_swap.cpp main_sgemm_swap.cpp)
set_property(TARGET sgemm_swap_Ofast PROPERTY COMPILE_FLAGS "-Ofast")
target_link_libraries(sgemm_swap_Ofast asterics_hpc)
runExample(sgemm_swap_Ofast)

plotPerf("sgemmSwap" sgemm_base_O3 sgemm_base_Ofast sgemm_swap_O3 sgemm_swap_Ofast)

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

add_executable(sgemm_vectorize_Ofast sgemm_vectorize.cpp main_sgemm_vectorize.cpp)
set_property(TARGET sgemm_vectorize_Ofast PROPERTY COMPILE_FLAGS "-Ofast -ftree-vectorize -march=native -mtune=native -mavx2")
target_link_libraries(sgemm_vectorize_Ofast asterics_hpc)
runExample(sgemm_vectorize_Ofast)

plotPerf("sgemmVectorize" sgemm_swap_O3 sgemm_swap_Ofast sgemm_vectorize_O3 sgemm_vectorize_Ofast)

add_executable(sgemm_intrinsics_O3 sgemm_intrinsics.cpp main_sgemm_intrinsics.cpp)
set_property(TARGET sgemm_intrinsics_O3 PROPERTY COMPILE_FLAGS "-O3 -march=native -mtune=native -mavx2")
target_link_libraries(sgemm_intrinsics_O3 asterics_hpc)
runExample(sgemm_intrinsics_O3)

plotPerf("sgemmIntrinsics" sgemm_vectorize_O3 sgemm_vectorize_Ofast sgemm_intrinsics_O3)

add_executable(sgemm_intrinsicsPitch_O3 sgemm_intrinsics_pitch.cpp main_sgemm_intrinsics_pitch.cpp)
set_property(TARGET sgemm_intrinsicsPitch_O3 PROPERTY COMPILE_FLAGS "-O3 -march=native -mtune=native -mavx2 -g")
target_link_libraries(sgemm_intrinsicsPitch_O3 asterics_hpc)
runExample(sgemm_intrinsicsPitch_O3)

plotPerf("sgemmIntrinsicsPitch" sgemm_vectorize_O3 sgemm_vectorize_Ofast sgemm_intrinsics_O3 sgemm_intrinsicsPitch_O3)