4.2.2.2 : Le fichier CMakeLists.txt



Écrivons le fichier CMakeLists.txt :



On définit les sources de nos tests (les sources de la bibliothèque vectorizée VECTORIZE_PROPAGATION_SRC et le main) :
1
set(progVectorizeSrc ${VECTORIZE_PROPAGATION_SRC} main_vectorized.cpp)


Nous allons faire des tests en (-O1, -O2, -O3 avec les options de vectorisation -ftree-vectorize -march=native -mtune=native et l'option -mavx2 (ou -mavx512f ou encore -msse4 suivant votre architecture) pour indiquer au compileur que l'on veut vraiment optimiser pour notre architecture avec des instructions completement vectorisées :
1
2
3
4
phoenix_compileAndRunExample(perf_grayscott_seq_vectorize_O1 "-O1 -ftree-vectorize -march=native -mtune=native -mavx2" "${CONFIG_GRAYSCOTT}" ${progVectorizeSrc})
phoenix_compileAndRunExample(perf_grayscott_seq_vectorize_O2 "-O2 -ftree-vectorize -march=native -mtune=native -mavx2" "${CONFIG_GRAYSCOTT}" ${progVectorizeSrc})
phoenix_compileAndRunExample(perf_grayscott_seq_vectorize_O3 "-O3 -ftree-vectorize -march=native -mtune=native -mavx2" "${CONFIG_GRAYSCOTT}" ${progVectorizeSrc})
phoenix_compileAndRunExample(perf_grayscott_seq_vectorize_Ofast "-Ofast -ftree-vectorize -march=native -mtune=native -mavx2" "${CONFIG_GRAYSCOTT}" ${progVectorizeSrc})


Finalement, la comparaison des résultats :
1
2
3
phoenix_plotPerf("grayscott_seqVectorize" perf_grayscott_seq_O3 perf_grayscott_seq_vectorize_O1
					perf_grayscott_seq_vectorize_O2 perf_grayscott_seq_vectorize_O3
					perf_grayscott_seq_vectorize_Ofast)


Le fichier CMakeLists.txt complet :

1
2
3
4
5
6
7
8
set(progVectorizeSrc ${VECTORIZE_PROPAGATION_SRC} main_vectorized.cpp)
phoenix_compileAndRunExample(perf_grayscott_seq_vectorize_O1 "-O1 -ftree-vectorize -march=native -mtune=native -mavx2" "${CONFIG_GRAYSCOTT}" ${progVectorizeSrc})
phoenix_compileAndRunExample(perf_grayscott_seq_vectorize_O2 "-O2 -ftree-vectorize -march=native -mtune=native -mavx2" "${CONFIG_GRAYSCOTT}" ${progVectorizeSrc})
phoenix_compileAndRunExample(perf_grayscott_seq_vectorize_O3 "-O3 -ftree-vectorize -march=native -mtune=native -mavx2" "${CONFIG_GRAYSCOTT}" ${progVectorizeSrc})
phoenix_compileAndRunExample(perf_grayscott_seq_vectorize_Ofast "-Ofast -ftree-vectorize -march=native -mtune=native -mavx2" "${CONFIG_GRAYSCOTT}" ${progVectorizeSrc})
phoenix_plotPerf("grayscott_seqVectorize" perf_grayscott_seq_O3 perf_grayscott_seq_vectorize_O1
					perf_grayscott_seq_vectorize_O2 perf_grayscott_seq_vectorize_O3
					perf_grayscott_seq_vectorize_Ofast)


Vous pouvez le télécharger ici.