6.6.2.3 : The CMakeLists.txt file

The new compilation options will be :
-O3 -ftree-vectorize -march=native -mtune=native -mavx2
We need to add a target to test the vectorized function and do both the performances tests and the plots :
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
project(HadamardProduct)
cmake_minimum_required(VERSION 3.0)

add_executable(hadamard_product_O0 main.cpp)
set_property(TARGET hadamard_product_O0 PROPERTY COMPILE_FLAGS "-O0")
runExample(hadamard_product_O0)

add_executable(hadamard_product_O1 main.cpp)
set_property(TARGET hadamard_product_O1 PROPERTY COMPILE_FLAGS "-O1")
runExample(hadamard_product_O1)

add_executable(hadamard_product_O2 main.cpp)
set_property(TARGET hadamard_product_O2 PROPERTY COMPILE_FLAGS "-O2")
runExample(hadamard_product_O2)

add_executable(hadamard_product_O3 main.cpp)
set_property(TARGET hadamard_product_O3 PROPERTY COMPILE_FLAGS "-O3")
runExample(hadamard_product_O3)

add_executable(hadamard_product_Ofast main.cpp)
set_property(TARGET hadamard_product_Ofast PROPERTY COMPILE_FLAGS "-Ofast")
runExample(hadamard_product_Ofast)

plotPerf("hadamardBase" hadamard_product_O0 hadamard_product_O1 hadamard_product_O2 hadamard_product_O3 hadamard_product_Ofast)

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

plotPerf("hadamardVectorize" hadamard_product_O3 hadamard_product_vectorize)