Commit c410632c authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Add micro benchmark for Gray Scott and performances results for naive implementation

parent f092e2af
set terminal png notransparent crop enhanced size 800,600 font "arial,14"
set grid xtics ytics mytics
set key out vert center top
set logscale y
set xlabel "nb elements"
set ylabel "elapsed time per element [ns/el]"
set output "grayscott_seqBaseElapsedTimeCyEl.png"
plot "perf_grayscott_seq_O0.txt" using 1:2:($2-$4):($2+$4) title "perf grayscott seq O0" with yerrorlines lw 2,"perf_grayscott_seq_O1.txt" using 1:2:($2-$4):($2+$4) title "perf grayscott seq O1" with yerrorlines lw 2,"perf_grayscott_seq_O2.txt" using 1:2:($2-$4):($2+$4) title "perf grayscott seq O2" with yerrorlines lw 2,"perf_grayscott_seq_O3.txt" using 1:2:($2-$4):($2+$4) title "perf grayscott seq O3" with yerrorlines lw 2,"perf_grayscott_seq_Ofast.txt" using 1:2:($2-$4):($2+$4) title "perf grayscott seq Ofast" with yerrorlines lw 2,
set xlabel "nb elements"
set ylabel "elapsed time [ns]"
set output "grayscott_seqBaseElapsedTime.png"
plot "perf_grayscott_seq_O0.txt" using 1:3:($3-$5):($3+$5) title "perf grayscott seq O0" with yerrorlines lw 2,"perf_grayscott_seq_O1.txt" using 1:3:($3-$5):($3+$5) title "perf grayscott seq O1" with yerrorlines lw 2,"perf_grayscott_seq_O2.txt" using 1:3:($3-$5):($3+$5) title "perf grayscott seq O2" with yerrorlines lw 2,"perf_grayscott_seq_O3.txt" using 1:3:($3-$5):($3+$5) title "perf grayscott seq O3" with yerrorlines lw 2,"perf_grayscott_seq_Ofast.txt" using 1:3:($3-$5):($3+$5) title "perf grayscott seq Ofast" with yerrorlines lw 2,
10000 280.253 2.80253e+06 1.87232 18723.2
19881 280.279 5.57224e+06 0.904744 17987.2
29929 280.809 8.40433e+06 0.939354 28113.9
40000 279.961 1.11984e+07 0.12486 4994.42
49952 280.013 1.39872e+07 0.0874973 4370.67
59780 280.223 1.67517e+07 0.0719084 4298.69
79806 280.345 2.23733e+07 0.0666207 5316.73
99856 280.361 2.79958e+07 0.111362 11120.1
10000 58.8121 588121 0.0325404 325.404
19881 58.9338 1.17166e+06 0.0479499 953.292
29929 58.8915 1.76256e+06 0.0594857 1780.35
40000 63.5375 2.5415e+06 0.11531 4612.41
49952 64.3564 3.21473e+06 0.131207 6554.04
59780 64.2164 3.83886e+06 0.146368 8749.88
79806 65.3826 5.21793e+06 0.407471 32518.6
99856 64.2422 6.41497e+06 0.339414 33892.6
10000 67.671 676710 0.114283 1142.83
19881 67.7738 1.34741e+06 0.138649 2756.48
29929 67.8428 2.03047e+06 0.128562 3847.72
40000 67.851 2.71404e+06 0.114795 4591.79
49952 67.8763 3.39056e+06 0.136845 6835.66
59780 68.206 4.07735e+06 0.137007 8190.29
79806 68.2266 5.44489e+06 0.106861 8528.17
99856 68.5053 6.84066e+06 0.0950207 9488.39
10000 69.4764 694764 0.118886 1188.86
19881 69.4911 1.38155e+06 0.103792 2063.48
29929 69.8087 2.08931e+06 0.112344 3362.33
40000 74.1114 2.96446e+06 0.158891 6355.66
49952 74.207 3.70679e+06 0.149167 7451.21
59780 74.5348 4.45569e+06 0.151431 9052.53
79806 74.6056 5.95397e+06 0.135057 10778.3
99856 74.7433 7.46356e+06 0.09617 9603.15
10000 78.9048 789048 0.0155251 155.251
19881 79.0238 1.57107e+06 0.0167515 333.036
29929 79.0712 2.36652e+06 0.0109453 327.583
40000 79.1734 3.16694e+06 0.0076706 306.824
49952 79.19 3.9557e+06 0.0144822 723.417
59780 79.2477 4.73743e+06 0.012699 759.149
79806 79.3151 6.32982e+06 0.10674 8518.49
99856 79.546 7.94315e+06 0.339948 33945.8
......@@ -15,7 +15,8 @@ function(phoenix_base_project programName programVersion programDescritpion prog
set(LIBRARY_DIRECTORY "lib" CACHE STRING "define the library directory (especially for Fedora with the wtf lib64)" FORCE)
set(DOC_MODE no CACHE BOOL "Doc mode")
set(NO_PERF_REFRESH yes CACHE BOOL "True to avoid rerun of perf target when they are updated")
set(SELF_TESTS_MODE yes CACHE BOOL "Self test mode")
message(STATUS "SELF_TESTS_MODE = ${SELF_TESTS_MODE}")
......
project(Phoenix)
cmake_minimum_required(VERSION 2.8)
set(CONFIG_GRAYSCOTT "10000, 20000, 30000, 40000, 50000, 60000, 80000, 100000")
set(EXTRA_DEPENDENCIES gray_scott_data_format tensor_alloc data_stream TBB::tbb)
set(progNaiveSrc ${CMAKE_CURRENT_SOURCE_DIR}/../Naive/naive_propagation.cpp main.cpp)
phoenix_compileAndRunExample(perf_grayscott_seq_O0 "-O0" "${CONFIG_GRAYSCOTT}" ${progNaiveSrc})
phoenix_compileAndRunExample(perf_grayscott_seq_O1 "-O1" "${CONFIG_GRAYSCOTT}" ${progNaiveSrc})
phoenix_compileAndRunExample(perf_grayscott_seq_O2 "-O2" "${CONFIG_GRAYSCOTT}" ${progNaiveSrc})
phoenix_compileAndRunExample(perf_grayscott_seq_O3 "-O3" "${CONFIG_GRAYSCOTT}" ${progNaiveSrc})
phoenix_compileAndRunExample(perf_grayscott_seq_Ofast "-Ofast" "${CONFIG_GRAYSCOTT}" ${progNaiveSrc})
# phoenix_compileAndRunExample(perf_grayscott_seq_vectorize_O3 "-O3 -ftree-vectorize -march=native -mtune=native -mavx2" "${CONFIG_GRAYSCOTT}" ${progSrc})
# phoenix_compileAndRunExample(perf_grayscott_seq_vectorize_Ofast "-Ofast -ftree-vectorize -march=native -mtune=native -mavx2" "${CONFIG_GRAYSCOTT}" ${progSrc})
phoenix_plotPerf("grayscott_seqBase" perf_grayscott_seq_O0 perf_grayscott_seq_O1 perf_grayscott_seq_O2 perf_grayscott_seq_O3 perf_grayscott_seq_Ofast)
# phoenix_plotPerf("grayscott_seqVectorize" perf_saxpy_seq_O3 perf_saxpy_seq_vectorize_O3 perf_saxpy_seq_vectorize_Ofast)
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
#include <cmath>
#include "micro_benchmark.h"
#include "temporary_alloc.h"
#include "naive_propagation.h"
///Get the number of nanoseconds per elements
/** @param nbElement : number of elements of the tables
*/
void evaluateSaxpy(size_t nbElement){
size_t nbRow(std::sqrt(nbElement));
size_t nbCol(nbElement/nbRow);
nbElement = nbRow*nbCol;
PTensor<float> tmpInU, tmpInV, tmpOutU, tmpOutV;
float *tmpU1 = NULL, *tmpU2 = NULL, *tmpV1 = NULL, *tmpV2 = NULL;
allocate_temporary(tmpU1, tmpU2, tmpV1, tmpV2, tmpInU, tmpInV, tmpOutU, tmpOutV, nbRow, nbCol);
float diffudionRateU(0.1f), diffusionRateV(0.05f);
float killRate(0.054f), feedRate(0.014f), dt(1.0f);
long nbStencilRow(3l), nbStencilCol(3l);
float matDeltaSquare[] = {1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f};
naive_propagation(tmpU2, tmpV2, tmpU1, tmpV1, nbRow, nbCol,
matDeltaSquare, nbStencilRow, nbStencilCol,
diffudionRateU, diffusionRateV, feedRate, killRate, dt);
micro_benchmarkAutoNsPrint("evaluate GrayScott reaction", nbElement, naive_propagation,
tmpU2, tmpV2, tmpU1, tmpV1, nbRow, nbCol,
matDeltaSquare, nbStencilRow, nbStencilCol,
diffudionRateU, diffusionRateV, feedRate, killRate, dt);
}
int main(int argc, char** argv){
return micro_benchmarkParseArg(argc, argv, evaluateSaxpy);
}
......@@ -7,5 +7,6 @@ add_subdirectory(Naive)
add_subdirectory(GrayScottDataFormat)
add_subdirectory(Program)
add_subdirectory(GrayScott2Pic)
add_subdirectory(Benchmark)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment