Commit 3b6f8b38 authored by Charron Maxime's avatar Charron Maxime
Browse files

Ajout version task

parent e481b3bc
==============================================================================
RUN
==============================================================================
Loaded : image ./img/beach.png: 259x195
Done in 0.010582 seconds
Loaded : image ./img/goat.png: 68x80
Done in 0.001782 seconds
============================================
CPU
============================================
Convert input to grey
Done in 0.000484 seconds
Convert search to grey
Done in 0.000054 seconds
Calculate difference
Done in 0 minutes 4.267830 seconds
Best compatibily find at x=22 and y=93 (24109) with a difference of 21
Done in 0.000059 seconds
Save picture with red box
Done in 0.000062 seconds
Picture saved : img/output/final_cpu.png
======================================================
The CPU took 0 minutes 4.372355 seconds to execute
============================================
OPEN MP (version simple)
============================================
Convert input to grey
Done in 0.000374 seconds
Convert search to grey
Done in 0.000018 seconds
Calculate difference
Done in 0 minutes 1.182693 seconds
Best compatibily find at x=22 and y=93
Done in 0.000075 seconds
Save picture with red box
Done in 0.000039 seconds
Picture saved : img/output/final_gpu_simple.png
======================================================
The OPEN MP part took 0 minutes 1.218996 seconds to execute
============================================
OPEN MP (version tableau)
============================================
Convert input to grey
Done in 0.000235 seconds
Convert search to grey
Done in 0.000052 seconds
Done in 0 minutes 1.200606 seconds
Save picture with red box
Done in 0.000018 seconds
Picture saved : img/output/final_gpu_tableau.png
======================================================
The OPEN MP part took 0 minutes 1.244739 seconds to execute
============================================
OPEN MP (version task)
============================================
Convert input to grey
Done in 0.000149 seconds
Convert search to grey
Done in 0.000024 seconds
Calculate difference
Done in 0 minutes 1.073664 seconds
Best compatibily find at x=22 and y=93
Done in 0.000061 seconds
Save picture with red box
Done in 0.000019 seconds
Picture saved : img/output/final_gpu_task.png
======================================================
The OPEN MP part took 0 minutes 1.115708 seconds to execute
The program took 0 minutes 7.951892 seconds to execute
Good bye!
==============================================================================
RUN
==============================================================================
Loaded : image ./img/jungle.png: 820x532
Done in 0.066179 seconds
Loaded : image ./img/goat.png: 68x80
Done in 0.001231 seconds
============================================
CPU
============================================
Convert input to grey
Done in 0.001900 seconds
Convert search to grey
Done in 0.000032 seconds
Calculate difference
Done in 1 minutes 6.243179 seconds
Best compatibily find at x=664 and y=81 (67084) with a difference of 9
Done in 0.001133 seconds
Save picture with red box
Done in 0.000614 seconds
Picture saved : img/output/final_cpu.png
======================================================
The CPU took 1 minutes 6.632339 seconds to execute
============================================
OPEN MP (version simple)
============================================
Convert input to grey
Done in 0.001328 seconds
Convert search to grey
Done in 0.000055 seconds
Calculate difference
Done in 0 minutes 17.738583 seconds
Best compatibily find at x=664 and y=81
Done in 0.000902 seconds
Save picture with red box
Done in 0.000136 seconds
Picture saved : img/output/final_gpu_v1.png
======================================================
The OPEN MP part took 0 minutes 18.025145 seconds to execute
============================================
OPEN MP (version tableau)
============================================
Convert input to grey
Done in 0.000734 seconds
Convert search to grey
Done in 0.000014 seconds
Done in 0 minutes 17.811575 seconds
Save picture with red box
Done in 0.000143 seconds
Picture saved : img/output/final_gpu_tableau.png
======================================================
The OPEN MP part took 0 minutes 18.137064 seconds to execute
============================================
OPEN MP (version task)
============================================
Convert input to grey
Done in 0.001272 seconds
Convert search to grey
Done in 0.000056 seconds
Calculate difference
Done in 0 minutes 16.846222 seconds
Best compatibily find at x=664 and y=81
Done in 0.000911 seconds
Save picture with red box
Done in 0.000170 seconds
Picture saved : img/output/final_gpu_task.png
======================================================
The OPEN MP part took 0 minutes 17.129631 seconds to execute
The program took 1 minutes 59.924240 seconds to execute
Good bye!
==============================================================================
RUN
==============================================================================
Loaded : image ./img/space.png: 2048x1365
Done in 0.201985 seconds
Loaded : image ./img/goat.png: 68x80
Done in 0.001176 seconds
============================================
CPU
============================================
Convert input to grey
Done in 0.014353 seconds
Convert search to grey
Done in 0.000025 seconds
Calculate difference
Done in 7 minutes 55.937408 seconds
Best compatibily find at x=987 and y=1121 (2296795) with a difference of 4
Done in 0.006674 seconds
Save picture with red box
Done in 0.002891 seconds
Picture saved : img/output/final_cpu.png
======================================================
The CPU took 7 minutes 57.555115 seconds to execute
============================================
OPEN MP (version simple)
============================================
Convert input to grey
Done in 0.006699 seconds
Convert search to grey
Done in 0.000010 seconds
Calculate difference
Done in 2 minutes 14.416687 seconds
Best compatibily find at x=987 and y=1121
Done in 0.006623 seconds
Save picture with red box
Done in 0.000667 seconds
Picture saved : img/output/final_gpu_v1.png
======================================================
The OPEN MP part took 2 minutes 15.843521 seconds to execute
============================================
OPEN MP (version tableau)
============================================
Convert input to grey
Done in 0.006529 seconds
Convert search to grey
Done in 0.000031 seconds
Done in 2 minutes 15.983414 seconds
Save picture with red box
Done in 0.000684 seconds
Picture saved : img/output/final_gpu_tableau.png
======================================================
The OPEN MP part took 2 minutes 17.402908 seconds to execute
============================================
OPEN MP (version task)
============================================
Convert input to grey
Done in 0.004372 seconds
Convert search to grey
Done in 0.000046 seconds
Calculate difference
Done in 2 minutes 3.480515 seconds
Best compatibily find at x=987 and y=1121
Done in 0.006714 seconds
Save picture with red box
Done in 0.005398 seconds
Picture saved : img/output/final_gpu_task.png
======================================================
The OPEN MP part took 2 minutes 4.869232 seconds to execute
The program took 14 minutes 35.670837 seconds to execute
Good bye!
......@@ -82,6 +82,8 @@ unsigned char* GPU_SIMPLE_calculateDiff(unsigned char* input, unsigned char* sea
//if ( methode_one ) {
// Methode 1
// rapporter la somme entre 0 et 255 ( 255^2 * largeur_goat * hauteur_goat / 255)
// TODO : ne marche pas h24 comme l'a dis HUGO
double som_moy = sum / 1387200;
diff[y * (inputImgWidth - searchImgWidth) + x] = round(som_moy);
......
......@@ -120,50 +120,50 @@ int main (int argc, char *argv[])
printf("\n\n============================================\n");
printf("\tOPEN MP (version simple)\n");
printf("============================================\n");
double gpu_v1_time = omp_get_wtime();
double gpu_simple_time = omp_get_wtime();
// ==================================== Convert input image to grey scale
printf("Convert input to grey\n");
double gpu_v1_input_to_grey_time = omp_get_wtime();
double gpu_simple_input_to_grey_time = omp_get_wtime();
inputGrey = GPU_SIMPLE_rgb2grey(inputImg, inputImgWidth, inputImgHeight);
//saveGreyPicture(inputImgHeight, inputImgWidth, inputGrey, "input");
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_v1_input_to_grey_time);
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_simple_input_to_grey_time);
// ==================================== Convert search image to grey scale
printf("Convert search to grey\n");
double gpu_v1_search_to_grey_time = omp_get_wtime();
double gpu_simple_search_to_grey_time = omp_get_wtime();
searchGrey = GPU_SIMPLE_rgb2grey(searchImg, searchImgWidth, searchImgHeight);
//saveGreyPicture(inputImgHeight, inputImgWidth, inputGrey, "search");
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_v1_search_to_grey_time);
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_simple_search_to_grey_time);
// ==================================== Calculate compability
printf("Calculate difference\n");
// time execution managed in the function
double gpu_v1_compute_diff_time = omp_get_wtime();
double gpu_simple_compute_diff_time = omp_get_wtime();
diff = GPU_SIMPLE_calculateDiff(inputGrey,searchGrey, inputImgWidth, inputImgHeight, searchImgWidth, searchImgHeight);
//saveGreyPicture(inputImgHeight-searchImgHeight, inputImgWidth-searchImgWidth, diff, (char*)"debug_m1");
time = convert((float) (omp_get_wtime() - gpu_v1_compute_diff_time));
time = convert((float) (omp_get_wtime() - gpu_simple_compute_diff_time));
fflush(stdout);
printf("\rDone in \033[0;32m %d minutes %f seconds \033[0m\n",(int) time[0], time[1]);
// ==================================== Search max compability
double gpu_v1_find_compa_time = omp_get_wtime();
double gpu_simple_find_compa_time = omp_get_wtime();
coord = GPU_SIMPLE_findBestCompability(diff, inputImgWidth, inputImgHeight, searchImgWidth, searchImgHeight);
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_v1_find_compa_time);
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_simple_find_compa_time);
free(diff);
// ==================================== Save a copy of 'inputImg' with the red box
printf("Save picture with red box\n");
double gpu_v1_box_time = omp_get_wtime();
double gpu_simple_box_time = omp_get_wtime();
final_m1 = GPU_SIMPLE_generateRedBox(coord[0], coord[1], inputImg, inputImgWidth, inputImgHeight, searchImgWidth, searchImgHeight);
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_v1_box_time);
savePicture(final_m1, (char*)"final_gpu_v1", inputImgWidth, inputImgHeight);
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_simple_box_time);
savePicture(final_m1, (char*)"final_gpu_simple", inputImgWidth, inputImgHeight);
free(final_m1);
printf("======================================================\n");
time = convert((float)(omp_get_wtime() - gpu_v1_time));
time = convert((float)(omp_get_wtime() - gpu_simple_time));
printf("The OPEN MP part took \033[0;32m %d minutes %f seconds \033[0m to execute\n",(int) time[0], time[1]);
......@@ -178,46 +178,45 @@ int main (int argc, char *argv[])
// ============================================================================================================
printf("\n\n============================================\n");
printf("OPEN MP (version légérement plus performante)\n");
printf("\tOPEN MP (version tableau)\n");
printf("============================================\n");
double gpu_v2_time = omp_get_wtime();
double gpu_tableau_time = omp_get_wtime();
// ==================================== Convert input image to grey scale
printf("Convert input to grey\n");
double gpu_v2_input_to_grey_time = omp_get_wtime();
double gpu_tableau_input_to_grey_time = omp_get_wtime();
inputGrey = GPU_SIMPLE_rgb2grey(inputImg, inputImgWidth, inputImgHeight);
//saveGreyPicture(inputImgHeight, inputImgWidth, inputGrey, "input");
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_v2_input_to_grey_time);
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_tableau_input_to_grey_time);
// ==================================== Convert search image to grey scale
printf("Convert search to grey\n");
double gpu_v2_search_to_grey_time = omp_get_wtime();
double gpu_tableau_search_to_grey_time = omp_get_wtime();
searchGrey = GPU_SIMPLE_rgb2grey(searchImg, searchImgWidth, searchImgHeight);
//saveGreyPicture(inputImgHeight, inputImgWidth, inputGrey, "search");
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_v2_search_to_grey_time);
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_tableau_search_to_grey_time);
// ==================================== Calculate difference and search max compability
double gpu_v2_find_compa_time = omp_get_wtime();
double gpu_tableau_find_compa_time = omp_get_wtime();
int index = GPU_v2_calculateIndex(inputGrey,searchGrey, inputImgWidth, inputImgHeight, searchImgWidth, searchImgHeight);
time = convert((float) (omp_get_wtime() - gpu_v2_find_compa_time));
time = convert((float) (omp_get_wtime() - gpu_tableau_find_compa_time));
fflush(stdout);
printf("\rDone in \033[0;32m %d minutes %f seconds \033[0m\n",(int) time[0], time[1]);
printf("Best compatibily find at x=%d and y=%d (index : %d)\n", index%inputImgWidth,(int)index/inputImgWidth, index);
// ==================================== Save a copy of 'inputImg' with the red box
printf("Save picture with red box\n");
double gpu_v2_box_time = omp_get_wtime();
double gpu_tableau_box_time = omp_get_wtime();
final_m1 = GPU_SIMPLE_generateRedBox(index%inputImgWidth, (int)index/inputImgWidth, inputImg, inputImgWidth, inputImgHeight, searchImgWidth, searchImgHeight);
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_v2_box_time);
savePicture(final_m1, (char*)"final_gpu_v2", inputImgWidth, inputImgHeight);
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_tableau_box_time);
savePicture(final_m1, (char*)"final_gpu_tableau", inputImgWidth, inputImgHeight);
free(final_m1);
printf("======================================================\n");
time = convert((float)(omp_get_wtime() - gpu_v2_time));
time = convert((float)(omp_get_wtime() - gpu_tableau_time));
printf("The OPEN MP part took \033[0;32m %d minutes %f seconds \033[0m to execute\n", (int)time[0], time[1]);
......@@ -226,9 +225,67 @@ int main (int argc, char *argv[])
// ============================================================================================================
printf("\n\n============================================\n");
printf("\tOPEN MP (version task)\n");
printf("============================================\n");
double gpu_task_time = omp_get_wtime();
// ==================================== Convert input image to grey scale
printf("Convert input to grey\n");
double gpu_task_input_to_grey_time = omp_get_wtime();
inputGrey = GPU_SIMPLE_rgb2grey(inputImg, inputImgWidth, inputImgHeight);
//saveGreyPicture(inputImgHeight, inputImgWidth, inputGrey, "input");
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_task_input_to_grey_time);
// ==================================== Convert search image to grey scale
printf("Convert search to grey\n");
double gpu_task_search_to_grey_time = omp_get_wtime();
searchGrey = GPU_SIMPLE_rgb2grey(searchImg, searchImgWidth, searchImgHeight);
//saveGreyPicture(inputImgHeight, inputImgWidth, inputGrey, "search");
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_task_search_to_grey_time);
// ==================================== Calculate compability
printf("Calculate difference\n");
// time execution managed in the function
double gpu_task_compute_diff_time = omp_get_wtime();
diff = GPU_task_calculateDiff(inputGrey,searchGrey, inputImgWidth, inputImgHeight, searchImgWidth, searchImgHeight);
//saveGreyPicture(inputImgHeight-searchImgHeight, inputImgWidth-searchImgWidth, diff, (char*)"debug_m1");
time = convert((float) (omp_get_wtime() - gpu_task_compute_diff_time));
fflush(stdout);
printf("\rDone in \033[0;32m %d minutes %f seconds \033[0m\n",(int) time[0], time[1]);
// ==================================== Search max compability
double gpu_task_find_compa_time = omp_get_wtime();
coord = GPU_SIMPLE_findBestCompability(diff, inputImgWidth, inputImgHeight, searchImgWidth, searchImgHeight);
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_task_find_compa_time);
free(diff);
// ==================================== Save a copy of 'inputImg' with the red box
printf("Save picture with red box\n");
double gpu_task_box_time = omp_get_wtime();
final_m1 = GPU_SIMPLE_generateRedBox(coord[0], coord[1], inputImg, inputImgWidth, inputImgHeight, searchImgWidth, searchImgHeight);
printf("Done in \033[0;32m %f \033[0m seconds\n",omp_get_wtime() - gpu_task_box_time);
savePicture(final_m1, (char*)"final_gpu_task", inputImgWidth, inputImgHeight);
free(final_m1);
printf("======================================================\n");
time = convert((float)(omp_get_wtime() - gpu_task_time));
printf("The OPEN MP part took \033[0;32m %d minutes %f seconds \033[0m to execute\n", (int)time[0], time[1]);
free_img(inputImg);
free_img(searchImg);
time = convert((float)(omp_get_wtime() - gpu_v2_time));
time = convert((float)(omp_get_wtime() - init_time));
printf("\n\nThe program took \033[0;32m %d minutes %f seconds \033[0m to execute\n",(int) time[0], time[1]);
printf("Good bye!\n");
......
No preview for this file type
Supports Markdown
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