3.2.3 : Fonctions CMake

Écrivons le fichier multiplePerfTest.cmake :



La première fonction devra compiler et lancer les tests de performances et devra définir toutes les macros dont le main_generic.cpp a besoin :

L'ensemble des macro à définir est :



  • INCLUDE_FUNCTION_NAME : le textbfheader à utiliser
  • FUNCTION_NAME : le nom de la fonction à utiliser
  • FUNCTION_STR_NAME_DEF : le nom de la fonction à utiliser sous forme textuelle
  • RATIO_NB_NAN : la proportion de nombres exotiques à initialiser dans les tenseurs
  • VALUE_DEF : la valeurs que l'on veut insérer dans les tenseurs


Nous devons nous contenter d'appeler correctement la fonction phoenix_compileAndRunExample qui fera le travail pour nous.

Commençons par definir la fonction :



1
2
3
4
5
6
7
8
9
10
11
12
# Function which creates generic performance tests automatically
# 	baseTargetName : base name of the target (for example hadamard_product)
# 	optimsiationMode : mode of the optimisation (basic, vectorize, intrinsics)
# 	valueType : type of the inserted value to be tested (nan, denorm)
# 	optimisationFlag : flag of the optimsiation without vectorization (-O0, -O1, -O2, -O3, -Ofast)
# 	functionName : name of the function to be used
# 	valueNbNan : value to be put randomly for vector initialisation
# 	defNanValue : definition of the exotic value to be used
# 	vectorizeOption : option for the vectorization
# 	configPerformance : configuration to be passed to the program to get performance restult for each point
# 	ARGN : list of program sources
function(generic_compileAndRunExample baseTargetName optimsiationMode valueType optimisationFlag functionName valueNbNan defNanValue vectorizeOption configPerformance)


Et prennons tout de suite en compte les paramètres supplémentaires à notre fonction qui seront les sources à compiler :
1
	set(PROGRAM_SRC ${ARGN})


Transformons les flags d'optimisation (-O0, -O1, -O2, -O3, -Ofast) en suffixes (O0, O1, O2, O3, Ofast) pour nommer nos executables :
1
2
	string(REPLACE "-" "" nameOptimisationFlag ${optimisationFlag})
	set(baseProgramName "${baseTargetName}_${optimsiationMode}")


Si on passe un type de valeur, on le concatenne au nom du programme :
1
2
3
	if(NOT valueType STREQUAL "")
		set(baseProgramName "${baseProgramName}_${valueType}")
	endif()


Si on passe une proportion de valeur, on définit la macro correspondante :
1
2
3
4
5
6
7
	if(valueNbNan STREQUAL "")
		set(DEFINE_RATIO_NB_NAN "")
	else()
		string(REPLACE "." "" nameValueNbNan ${valueNbNan})
		set(baseProgramName "${baseProgramName}_${nameValueNbNan}")
		set(DEFINE_RATIO_NB_NAN "-DRATIO_NB_NAN=${valueNbNan}")
	endif()


On créé ensuite le nom du programme de test :
1
	set(targetName "${baseProgramName}_${nameOptimisationFlag}")


Si on passe une définition de valeur, on ajoute la macro correspondante :
1
2
3
4
5
	if(defNanValue STREQUAL "")
		set(DEFINE_NAN_VALUE "")
	else()
		set(DEFINE_NAN_VALUE "-DVALUE_DEF=\"${defNanValue}\"")
	endif()


On définit ensuite les macros relatives aux fonctions en prennant garde à les échaper pour passer la phase de mise en forme de CMake :
1
2
3
	set(FUNCTION_INCLUDE_DEF "-DINCLUDE_FUNCTION_NAME=\"\\\"${functionName}.h\\\"\"")
	set(FUNCTION_NAME_DEF "-DFUNCTION_NAME=${functionName}")
	set(FUNCTION_STR_NAME_DEF "-DKERNEL_STR_FUNCTION_NAME=\"\\\"${functionName}\\\"\"")


On appelle la fonction phoenix_compileAndRunExample :
1
2
3
	phoenix_compileAndRunExample(${targetName}
		"${optimisationFlag} ${DEFINE_RATIO_NB_NAN} ${vectorizeOption} ${FUNCTION_INCLUDE_DEF} ${FUNCTION_NAME_DEF} ${FUNCTION_STR_NAME_DEF} ${DEFINE_NAN_VALUE}"
		"${configPerformance}" ${PROGRAM_SRC})


Et on finalise la fonction :
1
endfunction(generic_compileAndRunExample)


Ensuite, la deuxième fonction doit compiler et lancer un ensemble de tests de référence (donc sans valeurs exotiques) :
1
2
3
4
5
6
7
8
# Function which creates multiple performance tests automatically
# 	baseComparisonPlotName : base name of the comparison plot to be created (for example hadamardProductVectorizeNanO3)
# 	baseTargetName : base name of the target (for example hadamard_product)
# 	optimsiationMode : mode of the optimisation (basic, vectorize, intrinsics)
# 	vectorizeOption : option for the vectorization
# 	configPerformance : configuration to be passed to the program to get performance restult for each point
# 	ARGN : list of program sources
function(multiplePerfTest baseComparisonPlotName baseTargetName optimsiationMode vectorizeOption configPerformance)


Nous prennons également tout de suite en compte les paramètres supplémentaires à notre fonction qui seront les sources à compiler :
1
	set(PROGRAM_SRC ${ARGN})


Le nom de la fonction est plus simple car il n'y a pas de valeur exotique :
1
	set(functionName "${baseTargetName}_${optimsiationMode}")


On définie une list qui contient les options d'optimisations pertinentes suivant le mode vectorisé ou non. Il est en effet inutile de compiler en -O0 tout en vectorisant :
1
2
3
4
5
	if(vectorizeOption STREQUAL "")
		set(listOptimisationFlag -O0 -O1 -O2 -O3 -Ofast)
	else()
		set(listOptimisationFlag -O2 -O3 -Ofast)
	endif()


Ensuite, on parcours, la liste que nous venons de créer :
1
2
	set(listTargetPerf)
	foreach(optimisationFlag ${listOptimisationFlag})


Nous transformons les flags d'optimisation (-O0, -O1, -O2, -O3, -Ofast) en suffixes (O0, O1, O2, O3, Ofast) pour nommer nos executables :
1
2
		string(REPLACE "-" "" nameOptimisationFlag ${optimisationFlag})
		set(baseProgramName "${baseTargetName}_${optimsiationMode}_${nameOptimisationFlag}")


Nous appellons notre fonction précédente qui se chargera du reste :
1
2
		generic_compileAndRunExample(${baseTargetName} ${optimsiationMode} "" "${optimisationFlag}"
					${functionName} "" "" "${vectorizeOption}" "${configPerformance}" ${PROGRAM_SRC})


Nous ajoutons tous kes programmes créés pour pouvoir automatiser la création des graphes qui seront fait dans cette fonction :
1
		list(APPEND listTargetPerf ${baseProgramName})


Fin du foreach
1
	endforeach(optimisationFlag)


On appelle la fonction pour faire les graphes de performance :
1
	phoenix_plotPerf("${baseComparisonPlotName}" ${listTargetPerf})


Et on finalise la fonction :
1
endfunction(multiplePerfTest)


Petit bonus, c'est la même fonction que la précédente mais pour faire des graph avec l'axe des abscisses en log :
1
2
3
4
5
6
7
8
# Function which creates multiple performance tests automatically
# 	baseComparisonPlotName : base name of the comparison plot to be created (for example hadamardProductVectorizeNanO3)
# 	baseTargetName : base name of the target (for example hadamard_product)
# 	optimsiationMode : mode of the optimisation (basic, vectorize, intrinsics)
# 	vectorizeOption : option for the vectorization
# 	configPerformance : configuration to be passed to the program to get performance restult for each point
# 	ARGN : list of program sources
function(multiplePerfTestLogX baseComparisonPlotName baseTargetName optimsiationMode vectorizeOption configPerformance)


Nous prennons également tout de suite en compte les paramètres supplémentaires à notre fonction qui seront les sources à compiler :
1
	set(PROGRAM_SRC ${ARGN})


Le nom de la fonction est plus simple car il n'y a pas de valeur exotique :
1
	set(functionName "${baseTargetName}_${optimsiationMode}")


On définie une list qui contient les options d'optimisations pertinentes suivant le mode vectorisé ou non. Il est en effet inutile de compiler en -O0 tout en vectorisant :
1
2
3
4
5
	if(vectorizeOption STREQUAL "")
		set(listOptimisationFlag -O0 -O1 -O2 -O3 -Ofast)
	else()
		set(listOptimisationFlag -O2 -O3 -Ofast)
	endif()


Ensuite, on parcours, la liste que nous venons de créer :
1
2
	set(listTargetPerf)
	foreach(optimisationFlag ${listOptimisationFlag})


Nous transformons les flags d'optimisation (-O0, -O1, -O2, -O3, -Ofast) en suffixes (O0, O1, O2, O3, Ofast) pour nommer nos executables :
1
2
		string(REPLACE "-" "" nameOptimisationFlag ${optimisationFlag})
		set(baseProgramName "${baseTargetName}_${optimsiationMode}_${nameOptimisationFlag}")


Nous appellons notre fonction précédente qui se chargera du reste :
1
2
		generic_compileAndRunExample(${baseTargetName} ${optimsiationMode} "" "${optimisationFlag}"
					${functionName} "" "" "${vectorizeOption}" "${configPerformance}" ${PROGRAM_SRC})


Nous ajoutons tous kes programmes créés pour pouvoir automatiser la création des graphes qui seront fait dans cette fonction :
1
		list(APPEND listTargetPerf ${baseProgramName})


Fin du foreach
1
	endforeach(optimisationFlag)


On appelle la fonction pour faire les graphes de performance :
1
	phoenix_plotPerfLogX("${baseComparisonPlotName}" ${listTargetPerf})


Et on finalise la fonction :
1
endfunction(multiplePerfTestLogX)


Enfin, la troisième fonction doit compiler et lancer un ensemble de tests avec des valeurs exotiques :
1
2
3
4
5
6
7
8
9
10
11
# Function which creates multiple performance tests automatically
# 	baseComparisonPlotName : base name of the comparison plot to be created (for example hadamardProductVectorizeNanO3)
# 	baseTargetName : base name of the target (for example hadamard_product)
# 	optimsiationMode : mode of the optimisation (basic, vectorize, intrinsics)
# 	valueType : type of the inserted value to be tested (nan, denorm)
# 	optimisationFlag : flag of the optimsiation without vectorization (-O0, -O1, -O2, -O3, -Ofast)
# 	defNanValue : definition of the exotic value to be used
# 	vectorizeOption : option for the vectorization
# 	configPerformance : configuration to be passed to the program to get performance restult for each point
# 	ARGN : list of program sources
function(multiplePerfTestValue baseComparisonPlotName baseTargetName optimsiationMode valueType optimisationFlag defNanValue vectorizeOption configPerformance)


Nous prennons toujours en compte les paramètres supplémentaires à notre fonction qui seront les sources à compiler :
1
	set(PROGRAM_SRC ${ARGN})


Quelques manipulations semblables aux fonctions précédentes :
1
2
3
4
	set(functionName "${baseTargetName}_${optimsiationMode}")
	string(REPLACE "-" "" nameOptimisationFlag ${optimisationFlag})
	set(baseProgramName "${baseTargetName}_${optimsiationMode}_${valueType}")
	set(comparisonProgramName "${baseTargetName}_${optimsiationMode}_${nameOptimisationFlag}")


Créons une liste de proportions de nombres exotiques que nous voulons traiter :
1
	set(listRatioNbNan 0.01 0.1 0.25 0.5 0.75 0.9 1)


Dans ce cas nous allons itérer sur les différentes proportions de nombres exotiques que nous voulons traiter :
1
2
	set(listTargetPerf)
	foreach(valueNbNan ${listRatioNbNan})


On transforme les valeurs entre 0 et 1 par des chaînes de caractères en supprimant le point :
1
		string(REPLACE "." "" nameValueNbNan ${valueNbNan})


On créer le nom du programme et on appelle la première fonction que l'on a déveoppée :
1
2
3
4
5
6
7
		set(tmpTargetName ${baseProgramName}_${nameValueNbNan}_${nameOptimisationFlag})
		generic_compileAndRunExample(${baseTargetName} ${optimsiationMode} "${valueType}" "${optimisationFlag}"
						"${functionName}" "${valueNbNan}" "${defNanValue}" "${vectorizeOption}"
						"${configPerformance}" ${PROGRAM_SRC})
		
		list(APPEND listTargetPerf ${tmpTargetName})
	endforeach(valueNbNan)


On appelle la fonction pour faire les graphes de performance :
1
2
	phoenix_plotPerf("${baseComparisonPlotName}" ${comparisonProgramName}
						${listTargetPerf})


Et on finalise la fonction :
1
endfunction(multiplePerfTestValue)


Deuxième petit bonus, nous allons créer une fonction supplémentaire pour faire la même chose que la précédente, mais avec l'axe des abscisses en log :
1
2
3
4
5
6
7
8
9
10
11
# Function which creates multiple performance tests automatically (plot result with x axis in log)
# 	baseComparisonPlotName : base name of the comparison plot to be created (for example hadamardProductVectorizeNanO3)
# 	baseTargetName : base name of the target (for example hadamard_product)
# 	optimsiationMode : mode of the optimisation (basic, vectorize, intrinsics)
# 	valueType : type of the inserted value to be tested (nan, denorm)
# 	optimisationFlag : flag of the optimsiation without vectorization (-O0, -O1, -O2, -O3, -Ofast)
# 	defNanValue : definition of the exotic value to be used
# 	vectorizeOption : option for the vectorization
# 	configPerformance : configuration to be passed to the program to get performance restult for each point
# 	ARGN : list of program sources
function(multiplePerfTestValueLogX baseComparisonPlotName baseTargetName optimsiationMode valueType optimisationFlag defNanValue vectorizeOption configPerformance)


Nous prennons toujours en compte les paramètres supplémentaires à notre fonction qui seront les sources à compiler :
1
	set(PROGRAM_SRC ${ARGN})


Quelques manipulations semblables aux fonctions précédentes :
1
2
3
4
	set(functionName "${baseTargetName}_${optimsiationMode}")
	string(REPLACE "-" "" nameOptimisationFlag ${optimisationFlag})
	set(baseProgramName "${baseTargetName}_${optimsiationMode}_${valueType}")
	set(comparisonProgramName "${baseTargetName}_${optimsiationMode}_${nameOptimisationFlag}")


Créons une liste de proportions de nombres exotiques que nous voulons traiter :
1
	set(listRatioNbNan 0.01 0.1 0.25 0.5 0.75 0.9 1)


Dans ce cas nous allons itérer sur les différentes proportions de nombres exotiques que nous voulons traiter :
1
2
	set(listTargetPerf)
	foreach(valueNbNan ${listRatioNbNan})


On transforme les valeurs entre 0 et 1 par des chaînes de caractères en supprimant le point :
1
		string(REPLACE "." "" nameValueNbNan ${valueNbNan})


On créer le nom du programme et on appelle la première fonction que l'on a déveoppée :
1
2
3
4
5
6
7
		set(tmpTargetName ${baseProgramName}_${nameValueNbNan}_${nameOptimisationFlag})
		generic_compileAndRunExample(${baseTargetName} ${optimsiationMode} "${valueType}" "${optimisationFlag}"
						"${functionName}" "${valueNbNan}" "${defNanValue}" "${vectorizeOption}"
						"${configPerformance}" ${PROGRAM_SRC})
		
		list(APPEND listTargetPerf ${tmpTargetName})
	endforeach(valueNbNan)


On appelle la fonction pour faire les graphes de performance :
1
2
	phoenix_plotPerfLogX("${baseComparisonPlotName}" ${comparisonProgramName}
						${listTargetPerf})


Et on finalise la fonction :
1
endfunction(multiplePerfTestValueLogX)


Le fichier multiplePerfTest.cmake complet :

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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Function which creates generic performance tests automatically
# 	baseTargetName : base name of the target (for example hadamard_product)
# 	optimsiationMode : mode of the optimisation (basic, vectorize, intrinsics)
# 	valueType : type of the inserted value to be tested (nan, denorm)
# 	optimisationFlag : flag of the optimsiation without vectorization (-O0, -O1, -O2, -O3, -Ofast)
# 	functionName : name of the function to be used
# 	valueNbNan : value to be put randomly for vector initialisation
# 	defNanValue : definition of the exotic value to be used
# 	vectorizeOption : option for the vectorization
# 	configPerformance : configuration to be passed to the program to get performance restult for each point
# 	ARGN : list of program sources
function(generic_compileAndRunExample baseTargetName optimsiationMode valueType optimisationFlag functionName valueNbNan defNanValue vectorizeOption configPerformance)
	set(PROGRAM_SRC ${ARGN})
	string(REPLACE "-" "" nameOptimisationFlag ${optimisationFlag})
	set(baseProgramName "${baseTargetName}_${optimsiationMode}")
	if(NOT valueType STREQUAL "")
		set(baseProgramName "${baseProgramName}_${valueType}")
	endif()
	if(valueNbNan STREQUAL "")
		set(DEFINE_RATIO_NB_NAN "")
	else()
		string(REPLACE "." "" nameValueNbNan ${valueNbNan})
		set(baseProgramName "${baseProgramName}_${nameValueNbNan}")
		set(DEFINE_RATIO_NB_NAN "-DRATIO_NB_NAN=${valueNbNan}")
	endif()
	set(targetName "${baseProgramName}_${nameOptimisationFlag}")
	if(defNanValue STREQUAL "")
		set(DEFINE_NAN_VALUE "")
	else()
		set(DEFINE_NAN_VALUE "-DVALUE_DEF=\"${defNanValue}\"")
	endif()
	set(FUNCTION_INCLUDE_DEF "-DINCLUDE_FUNCTION_NAME=\"\\\"${functionName}.h\\\"\"")
	set(FUNCTION_NAME_DEF "-DFUNCTION_NAME=${functionName}")
	set(FUNCTION_STR_NAME_DEF "-DKERNEL_STR_FUNCTION_NAME=\"\\\"${functionName}\\\"\"")
	phoenix_compileAndRunExample(${targetName}
		"${optimisationFlag} ${DEFINE_RATIO_NB_NAN} ${vectorizeOption} ${FUNCTION_INCLUDE_DEF} ${FUNCTION_NAME_DEF} ${FUNCTION_STR_NAME_DEF} ${DEFINE_NAN_VALUE}"
		"${configPerformance}" ${PROGRAM_SRC})
endfunction(generic_compileAndRunExample)

# Function which creates multiple performance tests automatically
# 	baseComparisonPlotName : base name of the comparison plot to be created (for example hadamardProductVectorizeNanO3)
# 	baseTargetName : base name of the target (for example hadamard_product)
# 	optimsiationMode : mode of the optimisation (basic, vectorize, intrinsics)
# 	vectorizeOption : option for the vectorization
# 	configPerformance : configuration to be passed to the program to get performance restult for each point
# 	ARGN : list of program sources
function(multiplePerfTest baseComparisonPlotName baseTargetName optimsiationMode vectorizeOption configPerformance)
	set(PROGRAM_SRC ${ARGN})
	set(functionName "${baseTargetName}_${optimsiationMode}")
	if(vectorizeOption STREQUAL "")
		set(listOptimisationFlag -O0 -O1 -O2 -O3 -Ofast)
	else()
		set(listOptimisationFlag -O2 -O3 -Ofast)
	endif()
	set(listTargetPerf)
	foreach(optimisationFlag ${listOptimisationFlag})
		string(REPLACE "-" "" nameOptimisationFlag ${optimisationFlag})
		set(baseProgramName "${baseTargetName}_${optimsiationMode}_${nameOptimisationFlag}")
		generic_compileAndRunExample(${baseTargetName} ${optimsiationMode} "" "${optimisationFlag}"
					${functionName} "" "" "${vectorizeOption}" "${configPerformance}" ${PROGRAM_SRC})
		list(APPEND listTargetPerf ${baseProgramName})
	endforeach(optimisationFlag)
	phoenix_plotPerf("${baseComparisonPlotName}" ${listTargetPerf})
endfunction(multiplePerfTest)

# Function which creates multiple performance tests automatically
# 	baseComparisonPlotName : base name of the comparison plot to be created (for example hadamardProductVectorizeNanO3)
# 	baseTargetName : base name of the target (for example hadamard_product)
# 	optimsiationMode : mode of the optimisation (basic, vectorize, intrinsics)
# 	vectorizeOption : option for the vectorization
# 	configPerformance : configuration to be passed to the program to get performance restult for each point
# 	ARGN : list of program sources
function(multiplePerfTestLogX baseComparisonPlotName baseTargetName optimsiationMode vectorizeOption configPerformance)
	set(PROGRAM_SRC ${ARGN})
	set(functionName "${baseTargetName}_${optimsiationMode}")
	if(vectorizeOption STREQUAL "")
		set(listOptimisationFlag -O0 -O1 -O2 -O3 -Ofast)
	else()
		set(listOptimisationFlag -O2 -O3 -Ofast)
	endif()
	set(listTargetPerf)
	foreach(optimisationFlag ${listOptimisationFlag})
		string(REPLACE "-" "" nameOptimisationFlag ${optimisationFlag})
		set(baseProgramName "${baseTargetName}_${optimsiationMode}_${nameOptimisationFlag}")
		generic_compileAndRunExample(${baseTargetName} ${optimsiationMode} "" "${optimisationFlag}"
					${functionName} "" "" "${vectorizeOption}" "${configPerformance}" ${PROGRAM_SRC})
		list(APPEND listTargetPerf ${baseProgramName})
	endforeach(optimisationFlag)
	phoenix_plotPerfLogX("${baseComparisonPlotName}" ${listTargetPerf})
endfunction(multiplePerfTestLogX)
# Function which creates multiple performance tests automatically
# 	baseComparisonPlotName : base name of the comparison plot to be created (for example hadamardProductVectorizeNanO3)
# 	baseTargetName : base name of the target (for example hadamard_product)
# 	optimsiationMode : mode of the optimisation (basic, vectorize, intrinsics)
# 	valueType : type of the inserted value to be tested (nan, denorm)
# 	optimisationFlag : flag of the optimsiation without vectorization (-O0, -O1, -O2, -O3, -Ofast)
# 	defNanValue : definition of the exotic value to be used
# 	vectorizeOption : option for the vectorization
# 	configPerformance : configuration to be passed to the program to get performance restult for each point
# 	ARGN : list of program sources
function(multiplePerfTestValue baseComparisonPlotName baseTargetName optimsiationMode valueType optimisationFlag defNanValue vectorizeOption configPerformance)
	set(PROGRAM_SRC ${ARGN})
	set(functionName "${baseTargetName}_${optimsiationMode}")
	string(REPLACE "-" "" nameOptimisationFlag ${optimisationFlag})
	set(baseProgramName "${baseTargetName}_${optimsiationMode}_${valueType}")
	set(comparisonProgramName "${baseTargetName}_${optimsiationMode}_${nameOptimisationFlag}")
	set(listRatioNbNan 0.01 0.1 0.25 0.5 0.75 0.9 1)
	set(listTargetPerf)
	foreach(valueNbNan ${listRatioNbNan})
		string(REPLACE "." "" nameValueNbNan ${valueNbNan})
		set(tmpTargetName ${baseProgramName}_${nameValueNbNan}_${nameOptimisationFlag})
		generic_compileAndRunExample(${baseTargetName} ${optimsiationMode} "${valueType}" "${optimisationFlag}"
						"${functionName}" "${valueNbNan}" "${defNanValue}" "${vectorizeOption}"
						"${configPerformance}" ${PROGRAM_SRC})
		
		list(APPEND listTargetPerf ${tmpTargetName})
	endforeach(valueNbNan)
	phoenix_plotPerf("${baseComparisonPlotName}" ${comparisonProgramName}
						${listTargetPerf})
endfunction(multiplePerfTestValue)
# Function which creates multiple performance tests automatically (plot result with x axis in log)
# 	baseComparisonPlotName : base name of the comparison plot to be created (for example hadamardProductVectorizeNanO3)
# 	baseTargetName : base name of the target (for example hadamard_product)
# 	optimsiationMode : mode of the optimisation (basic, vectorize, intrinsics)
# 	valueType : type of the inserted value to be tested (nan, denorm)
# 	optimisationFlag : flag of the optimsiation without vectorization (-O0, -O1, -O2, -O3, -Ofast)
# 	defNanValue : definition of the exotic value to be used
# 	vectorizeOption : option for the vectorization
# 	configPerformance : configuration to be passed to the program to get performance restult for each point
# 	ARGN : list of program sources
function(multiplePerfTestValueLogX baseComparisonPlotName baseTargetName optimsiationMode valueType optimisationFlag defNanValue vectorizeOption configPerformance)
	set(PROGRAM_SRC ${ARGN})
	set(functionName "${baseTargetName}_${optimsiationMode}")
	string(REPLACE "-" "" nameOptimisationFlag ${optimisationFlag})
	set(baseProgramName "${baseTargetName}_${optimsiationMode}_${valueType}")
	set(comparisonProgramName "${baseTargetName}_${optimsiationMode}_${nameOptimisationFlag}")
	set(listRatioNbNan 0.01 0.1 0.25 0.5 0.75 0.9 1)
	set(listTargetPerf)
	foreach(valueNbNan ${listRatioNbNan})
		string(REPLACE "." "" nameValueNbNan ${valueNbNan})
		set(tmpTargetName ${baseProgramName}_${nameValueNbNan}_${nameOptimisationFlag})
		generic_compileAndRunExample(${baseTargetName} ${optimsiationMode} "${valueType}" "${optimisationFlag}"
						"${functionName}" "${valueNbNan}" "${defNanValue}" "${vectorizeOption}"
						"${configPerformance}" ${PROGRAM_SRC})
		
		list(APPEND listTargetPerf ${tmpTargetName})
	endforeach(valueNbNan)
	phoenix_plotPerfLogX("${baseComparisonPlotName}" ${comparisonProgramName}
						${listTargetPerf})
endfunction(multiplePerfTestValueLogX)


Vous pouvez le télécharger ici.