# Function which creates generic performance tests automatically # functionName : name of the function to be used (for the computation) # 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) # 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_compileAndRunExampleFunc functionName optimsiationMode valueType optimisationFlag valueNbNan defNanValue vectorizeOption configPerformance) set(PROGRAM_SRC ${ARGN}) string(REPLACE "-" "" nameOptimisationFlag ${optimisationFlag}) set(baseProgramName "${functionName}_${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() if(vectorizeOption STREQUAL "" OR vectorizeOption STREQUAL "${DENORM_DAZ_OPTION}") set(functionTestName "function_base") else() set(functionTestName "function_vectorize") endif() set(FUNCTION_INCLUDE_DEF "-DINCLUDE_FUNCTION_NAME=\"\\\"${functionTestName}.h\\\"\"") set(FUNCTION_NAME_DEF "-DFUNCTION_NAME=${functionTestName}") set(FUNCTION_STR_NAME_DEF "-DKERNEL_STR_FUNCTION_NAME=\"\\\"${functionTestName}\\\"\"") set(COMPUTE_FUNCTION_DEF "-DCOMPUTE_FUNCTION_DEF=${functionName}") set(FUNTION_OPTIONS "${FUNCTION_INCLUDE_DEF} ${FUNCTION_NAME_DEF} ${FUNCTION_STR_NAME_DEF} ${COMPUTE_FUNCTION_DEF}") phoenix_compileAndRunExample(${targetName} "${optimisationFlag} ${DEFINE_RATIO_NB_NAN} ${vectorizeOption} ${FUNTION_OPTIONS} ${DEFINE_NAN_VALUE}" "${configPerformance}" ${PROGRAM_SRC}) endfunction(generic_compileAndRunExampleFunc) # Function which creates multiple performance tests automatically # baseComparisonPlotName : base name of the comparison plot to be created (for example hadamardProductVectorizeNanO3) # functionName : name of the function to be used (for the computation) # 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(multiplePerfTestFunction baseComparisonPlotName functionName optimsiationMode vectorizeOption configPerformance) set(PROGRAM_SRC ${ARGN}) 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 "${functionName}_${optimsiationMode}_${nameOptimisationFlag}") generic_compileAndRunExampleFunc(${functionName} ${optimsiationMode} "" "${optimisationFlag}" "" "" "${vectorizeOption}" "${configPerformance}" ${PROGRAM_SRC}) list(APPEND listTargetPerf ${baseProgramName}) endforeach(optimisationFlag) phoenix_plotPerf("${baseComparisonPlotName}" ${listTargetPerf}) endfunction(multiplePerfTestFunction) # Function which creates multiple performance tests automatically # baseComparisonPlotName : base name of the comparison plot to be created (for example hadamardProductVectorizeNanO3) # functionName : name of the function to be used (for the computation) # 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(multiplePerfTestFunctionValue baseComparisonPlotName functionName optimsiationMode valueType optimisationFlag defNanValue vectorizeOption configPerformance) set(PROGRAM_SRC ${ARGN}) string(REPLACE "-" "" nameOptimisationFlag ${optimisationFlag}) set(baseProgramName "${functionName}_${optimsiationMode}_${valueType}") set(comparisonProgramName "${functionName}_${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_compileAndRunExampleFunc(${functionName} ${optimsiationMode} "${valueType}" "${optimisationFlag}" "${valueNbNan}" "${defNanValue}" "${vectorizeOption}" "${configPerformance}" ${PROGRAM_SRC}) list(APPEND listTargetPerf ${tmpTargetName}) endforeach(valueNbNan) phoenix_plotPerf("${baseComparisonPlotName}" ${comparisonProgramName} ${listTargetPerf}) endfunction(multiplePerfTestFunctionValue) # Function which call a bunch of tests for a given standard function # stdFunctionName : function name of the standard function # CONFIG_FUNCTION : configuration to be passed to the program to get performance restult for each point # VECTORIZED_OPTION : option for the vectorization # NAN_DEF : definition of NaN # INF_DEF : definition of Inf # DENORM_DEF : definition of Denorm # MIN_TO_DENORM_DEF : definition to create denorm function(allTestFunction stdFunctionName CONFIG_FUNCTION VECTORIZED_OPTION NAN_DEF INF_DEF DENORM_DEF MIN_TO_DENORM_DEF) set(FUNCTION_BASE_SRC function_base.cpp main_function.cpp) set(FUNCTION_VECTORIZE_SRC function_vectorize.cpp main_function.cpp) multiplePerfTestFunction("${stdFunctionName}Base" ${stdFunctionName} base "" "${CONFIG_FUNCTION}" ${FUNCTION_BASE_SRC}) multiplePerfTestFunction("${stdFunctionName}Vectorize" ${stdFunctionName} vectorize "${VECTORIZED_OPTION}" "${CONFIG_FUNCTION}" ${FUNCTION_VECTORIZE_SRC}) phoenix_plotPerf("cmp${stdFunctionName}Safe03" ${stdFunctionName}_base_O3 ${stdFunctionName}_vectorize_O3) phoenix_plotPerf("cmp${stdFunctionName}Safe0fast" ${stdFunctionName}_base_Ofast ${stdFunctionName}_vectorize_Ofast) multiplePerfTestFunctionValue("${stdFunctionName}BaseNanOfast" ${stdFunctionName} base nan -Ofast "${NAN_DEF}" "" "${CONFIG_FUNCTION}" ${FUNCTION_BASE_SRC}) multiplePerfTestFunctionValue("${stdFunctionName}VectorizeNanOfast" ${stdFunctionName} vectorize nan -Ofast "${NAN_DEF}" "${VECTORIZED_OPTION}" "${CONFIG_FUNCTION}" ${FUNCTION_VECTORIZE_SRC}) multiplePerfTestFunctionValue("${stdFunctionName}BaseInfOfast" ${stdFunctionName} base inf -Ofast "${INF_DEF}" "" "${CONFIG_FUNCTION}" ${FUNCTION_BASE_SRC}) multiplePerfTestFunctionValue("${stdFunctionName}VectorizeInfOfast" ${stdFunctionName} vectorize inf -Ofast "${INF_DEF}" "${VECTORIZED_OPTION}" "${CONFIG_FUNCTION}" ${FUNCTION_VECTORIZE_SRC}) multiplePerfTestFunctionValue("${stdFunctionName}BaseDenormOfast" ${stdFunctionName} base denorm -Ofast "${DENORM_DEF}" "" "${CONFIG_FUNCTION}" ${FUNCTION_BASE_SRC}) multiplePerfTestFunctionValue("${stdFunctionName}VectorizeDenormOfast" ${stdFunctionName} vectorize denorm -Ofast "${DENORM_DEF}" "${VECTORIZED_OPTION}" "${CONFIG_FUNCTION}" ${FUNCTION_VECTORIZE_SRC}) multiplePerfTestFunctionValue("${stdFunctionName}BaseDenormDazOfast" ${stdFunctionName} base denormDaz -Ofast "${DENORM_DEF}" "${DENORM_DAZ_OPTION}" "${CONFIG_FUNCTION}" ${FUNCTION_BASE_SRC}) multiplePerfTestFunctionValue("${stdFunctionName}VectorizeDenormDazOfast" ${stdFunctionName} vectorize denormDaz -Ofast "${DENORM_DEF}" "${VECTORIZED_OPTION} ${DENORM_DAZ_OPTION}" "${CONFIG_FUNCTION}" ${FUNCTION_VECTORIZE_SRC}) multiplePerfTestFunctionValue("${stdFunctionName}BaseMakeDenormOfast" ${stdFunctionName} base make_denorm -Ofast "${MIN_TO_DENORM_DEF}" "" "${CONFIG_FUNCTION}" ${FUNCTION_BASE_SRC}) multiplePerfTestFunctionValue("${stdFunctionName}VectorizeMakeDenormOfast" ${stdFunctionName} vectorize make_denorm -Ofast "${MIN_TO_DENORM_DEF}" "${VECTORIZED_OPTION}" "${CONFIG_FUNCTION}" ${FUNCTION_VECTORIZE_SRC}) endfunction(allTestFunction)