Previous The runPythonExample function |
Parent Several useful CMake functions |
Outline | Next Summary |
This function has to create a Gnuplot file to make plots with the different input target we want to compare. This will ensure us to compare the performances we want.
Two plots are relevant in our case :
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 |
function(plotPerf baseOutputPng) set(GNUPLOT_FILE "${OUTPUT_PERF_DIR}/${baseOutputPng}.gnuplot") file(WRITE ${GNUPLOT_FILE} "set terminal png notransparent crop enhanced size 800,600 font \"arial,14\"\n") file(APPEND ${GNUPLOT_FILE} "set grid xtics ytics mytics\n") file(APPEND ${GNUPLOT_FILE} "set key bottom right\n") file(APPEND ${GNUPLOT_FILE} "set logscale y\n") file(APPEND ${GNUPLOT_FILE} "set xlabel \"nb elements\"\n") file(APPEND ${GNUPLOT_FILE} "set ylabel \"elapsed time per element [cy/el]\"\n") file(APPEND ${GNUPLOT_FILE} "set output \"${baseOutputPng}ElapsedTimeCyEl.png\"\n") file(APPEND ${GNUPLOT_FILE} "plot ") set(listDepend) foreach(inputTarget ${ARGN}) string(REPLACE "_" " " legendStr ${inputTarget}) file(APPEND ${GNUPLOT_FILE} "\"${inputTarget}.txt\" using 1:2 title \"${legendStr}\" with lines lw 2,") list(APPEND listDepend "${OUTPUT_PERF_DIR}/${inputTarget}.txt") endforeach(inputTarget) file(APPEND ${GNUPLOT_FILE} "\n") file(APPEND ${GNUPLOT_FILE} "set xlabel \"nb elements\"\n") file(APPEND ${GNUPLOT_FILE} "set ylabel \"elapsed time [cy]\"\n") file(APPEND ${GNUPLOT_FILE} "set output \"${baseOutputPng}ElapsedTime.png\"\n") file(APPEND ${GNUPLOT_FILE} "plot ") foreach(inputTarget ${ARGN}) string(REPLACE "_" " " legendStr ${inputTarget}) file(APPEND ${GNUPLOT_FILE} "\"${inputTarget}.txt\" using 1:3 title \"${legendStr}\" with lines lw 2,") endforeach(inputTarget) file(APPEND ${GNUPLOT_FILE} "\n") add_custom_command(OUTPUT ${OUTPUT_PERF_DIR}/${baseOutputPng}ElapsedTimeCyEl.png ${OUTPUT_PERF_DIR}/${baseOutputPng}ElapsedTime.png COMMAND gnuplot ${GNUPLOT_FILE} WORKING_DIRECTORY "${OUTPUT_PERF_DIR}" COMMENT "Call gnuplot ${baseOutputPng}" DEPENDS ${listDepend} ) add_custom_target("plot_${baseOutputPng}" DEPENDS ${OUTPUT_PERF_DIR}/${baseOutputPng}ElapsedTimeCyEl.png ${OUTPUT_PERF_DIR}/${baseOutputPng}ElapsedTime.png) foreach(inputTarget ${ARGN}) add_dependencies("plot_${baseOutputPng}" "run_${inputTarget}") endforeach(inputTarget) add_dependencies(plot_all "plot_${baseOutputPng}") endfunction(plotPerf) |
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 |
function(plotPerfProba baseOutputPng) set(GNUPLOT_FILE "${OUTPUT_PERF_DIR}/${baseOutputPng}.gnuplot") file(WRITE ${GNUPLOT_FILE} "set terminal png notransparent crop enhanced size 800,600 font \"arial,14\"\n") file(APPEND ${GNUPLOT_FILE} "set grid xtics ytics mytics\n") file(APPEND ${GNUPLOT_FILE} "set key bottom right\n") file(APPEND ${GNUPLOT_FILE} "set logscale y\n") file(APPEND ${GNUPLOT_FILE} "set xlabel \"proba\"\n") file(APPEND ${GNUPLOT_FILE} "set ylabel \"elapsed time per element [cy/el]\"\n") file(APPEND ${GNUPLOT_FILE} "set output \"${baseOutputPng}ElapsedTimeCyEl.png\"\n") file(APPEND ${GNUPLOT_FILE} "plot ") set(listDepend) foreach(inputTarget ${ARGN}) string(REPLACE "_" " " legendStr ${inputTarget}) file(APPEND ${GNUPLOT_FILE} "\"${inputTarget}.txt\" using 1:2 title \"${legendStr}\" with lines lw 2,") list(APPEND listDepend "${OUTPUT_PERF_DIR}/${inputTarget}.txt") endforeach(inputTarget) file(APPEND ${GNUPLOT_FILE} "\n") file(APPEND ${GNUPLOT_FILE} "set xlabel \"proba\"\n") file(APPEND ${GNUPLOT_FILE} "set ylabel \"elapsed time [cy]\"\n") file(APPEND ${GNUPLOT_FILE} "set output \"${baseOutputPng}ElapsedTime.png\"\n") file(APPEND ${GNUPLOT_FILE} "plot ") foreach(inputTarget ${ARGN}) string(REPLACE "_" " " legendStr ${inputTarget}) file(APPEND ${GNUPLOT_FILE} "\"${inputTarget}.txt\" using 1:3 title \"${legendStr}\" with lines lw 2,") endforeach(inputTarget) file(APPEND ${GNUPLOT_FILE} "\n") add_custom_command(OUTPUT ${OUTPUT_PERF_DIR}/${baseOutputPng}ElapsedTimeCyEl.png ${OUTPUT_PERF_DIR}/${baseOutputPng}ElapsedTime.png COMMAND gnuplot ${GNUPLOT_FILE} WORKING_DIRECTORY "${OUTPUT_PERF_DIR}" COMMENT "Call gnuplot ${baseOutputPng}" DEPENDS ${listDepend} ) add_custom_target("plot_${baseOutputPng}" DEPENDS ${OUTPUT_PERF_DIR}/${baseOutputPng}ElapsedTimeCyEl.png ${OUTPUT_PERF_DIR}/${baseOutputPng}ElapsedTime.png) foreach(inputTarget ${ARGN}) add_dependencies("plot_${baseOutputPng}" "run_${inputTarget}") endforeach(inputTarget) add_dependencies(plot_all "plot_${baseOutputPng}") endfunction(plotPerfProba) |
Previous The runPythonExample function |
Parent Several useful CMake functions |
Outline | Next Summary |