Skip to content
Snippets Groups Projects
Commit 29421c31 authored by timeo's avatar timeo
Browse files

Version de test de vitesse de OpenMP

parent 3aadc6e2
No related branches found
No related tags found
No related merge requests found
......@@ -212,9 +212,10 @@ uint64_t nbAdditifWithSommeOpenMp(int nb){
int nbAdditive = 0;
//#pragma omp parallel for num_threads(nb)
for (int tailleBloc = 1; tailleBloc <= fichier.size() / 3; tailleBloc++) //Test pour chaque taille de bloc possible
{
#pragma omp parallel for
for (int i = 0; i <= fichier.size() - tailleBloc * 3; i++) // Permet de créer les 3 blocs succéssifs
{
int additionbloc1 = valeurBloc(i+0, i+tailleBloc-1);
......@@ -277,7 +278,7 @@ void nbAdditifsAvecSansOpenMP(){
std::cout << "Durée :" << time_span.count() << " secondes avec OpenMp" << std::endl;
#endif
std::cout << std::endl << nbAdditifWithSomme() << std::endl;
nbAdditifWithSomme();
#ifdef CHRONO
......@@ -318,11 +319,113 @@ void ecrireSommeCentre(){
}
int main(){
parseFile("testfiles/ACF_70880000_over_0123.txt");
sommeAdditive();
//parseFile("testfiles/100000fromCorrect.txt");
/*sommeAdditive();
nbAdditifsAvecSansOpenMP();*/
ofstream flux("tempsExecInterne.csv");
for (int i = 0; i < 6; i++){
std::cout << "Tir " << i << std::endl;
parseFile("testfiles/5000fromCorrect.txt");
sommeAdditive();
#ifdef CHRONO
high_resolution_clock::time_point t1 = high_resolution_clock::now();
#endif
//std::cout << std::endl << nbAdditif() << std::endl;
std::cout << "5 000 char" << std::endl;
std::cout << nbAdditifWithSommeOpenMp(8) << std::endl;
#ifdef CHRONO
high_resolution_clock::time_point t2 = high_resolution_clock::now();
duration<double> time_span = duration_cast<duration<double>>(t2 - t1);
flux << "5000," << time_span.count() << std::endl;
std::cout << "Durée :" << time_span.count() << " secondes" << std::endl << std::endl;
#endif
parseFile("testfiles/10000fromCorrect.txt");
sommeAdditive();
#ifdef CHRONO
t1 = high_resolution_clock::now();
#endif
//std::cout << std::endl << nbAdditif() << std::endl;
std::cout << "10 000 char" << std::endl;
std::cout << nbAdditifWithSommeOpenMp(8) << std::endl;
#ifdef CHRONO
t2 = high_resolution_clock::now();
time_span = duration_cast<duration<double>>(t2 - t1);
flux << "10000," << time_span.count() << std::endl;
std::cout << "Durée :" << time_span.count() << " secondes" << std::endl << std::endl;
#endif
parseFile("testfiles/50000fromCorrect.txt");
sommeAdditive();
#ifdef CHRONO
t1 = high_resolution_clock::now();
#endif
//std::cout << std::endl << nbAdditif() << std::endl;
std::cout << "50 000 char" << std::endl;
std::cout << nbAdditifWithSommeOpenMp(8) << std::endl;
#ifdef CHRONO
t2 = high_resolution_clock::now();
time_span = duration_cast<duration<double>>(t2 - t1);
flux << "50000," << time_span.count() << std::endl;
std::cout << "Durée :" << time_span.count() << " secondes" << std::endl << std::endl;
#endif
parseFile("testfiles/100000fromCorrect.txt");
sommeAdditive();
#ifdef CHRONO
t1 = high_resolution_clock::now();
#endif
//std::cout << std::endl << nbAdditif() << std::endl;
std::cout << "100 000 char" << std::endl;
std::cout << nbAdditifWithSommeOpenMp(8) << std::endl;
#ifdef CHRONO
t2 = high_resolution_clock::now();
time_span = duration_cast<duration<double>>(t2 - t1);
flux << "100000," << time_span.count() << std::endl;
std::cout << "Durée :" << time_span.count() << " secondes" << std::endl << std::endl;
#endif
parseFile("testfiles/500000fromCorrect.txt");
sommeAdditive();
#ifdef CHRONO
t1 = high_resolution_clock::now();
#endif
//std::cout << std::endl << nbAdditif() << std::endl;
std::cout << "500 000 char" << std::endl;
std::cout << nbAdditifWithSommeOpenMp(8) << std::endl;
#ifdef CHRONO
t2 = high_resolution_clock::now();
time_span = duration_cast<duration<double>>(t2 - t1);
flux << "500000," << time_span.count() << std::endl;
std::cout << "Durée :" << time_span.count() << " secondes" << std::endl << std::endl;
#endif
parseFile("testfiles/1000000fromCorrect.txt");
sommeAdditive();
#ifdef CHRONO
t1 = high_resolution_clock::now();
#endif
//std::cout << std::endl << nbAdditif() << std::endl;
std::cout << " 1 000 000 char" << std::endl;
std::cout << nbAdditifWithSommeOpenMp(8) << std::endl;
#ifdef CHRONO
t2 = high_resolution_clock::now();
time_span = duration_cast<duration<double>>(t2 - t1);
flux << "1000000," << time_span.count() << std::endl;
std::cout << "Durée :" << time_span.count() << " secondes" << std::endl << std::endl;
#endif
}
// ecrireSommeCentre();
int32_t* T = new int32_t[fichier.size() + 1];
/*int32_t* T = new int32_t[fichier.size() + 1];
for (int i = 0; i < fichier.size() + 2; i++){
T[i] = sommeAdditiveArray[i];
}
......@@ -331,7 +434,7 @@ int main(){
int32_t k = maxi - mini;
std::cout << "k : " << k << " maxi : " << maxi << " mini : " << mini << std::endl;
std::cout << libsais_int(T, SA, 70880000, k, fs) << std::endl;
// std::cout << libsais_int(T, SA, 70880000, k, fs) << std::endl;*/
// free(T);
// free(SA);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment