4.2.2.1.4 : Le fichier complet


Le fichier main_vectorized.cpp 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
/***************************************
	Auteur : Pierre Aubert
	Mail : pierre.aubert@lapp.in2p3.fr
	Licence : CeCILL-C
****************************************/
#include "micro_benchmark.h"
#include "temporary_alloc.h"
#include "vectorized_propagation.h"

///Get the number of nanoseconds per elements
/**	@param nbElement : number of elements of the tables
*/
void evaluateGrayScott(size_t nbElement){
	size_t nbRow(nbElement*PLIB_VECTOR_SIZE_FLOAT);
	size_t nbCol(nbElement*PLIB_VECTOR_SIZE_FLOAT*2lu);
	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};
	micro_benchmarkAutoNsPrint("evaluate GrayScott reaction, vectorized", nbElement, grayscott_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, evaluateGrayScott);
}


Vous pouvez le télécharger ici.