|
@@ -77,7 +77,7 @@ int main(int argc, char* argv[]) {
|
|
|
fflush(stdout);
|
|
|
|
|
|
//Si on est le processus qui à trouvé
|
|
|
- if(end) {
|
|
|
+ if(end && world_rank != DISPLAY_RANK) {
|
|
|
//Reverifie si quelqu'un d'autre a trouver avant
|
|
|
int flag;
|
|
|
MPI_Test(&sync, &flag, MPI_STATUS_IGNORE);
|
|
@@ -113,18 +113,29 @@ int main(int argc, char* argv[]) {
|
|
|
|
|
|
//L'affichage est fait par le processus un seul processus
|
|
|
if(world_rank == DISPLAY_RANK) {
|
|
|
- //Attend las infos venants de processus qui à trouvé
|
|
|
int pid, rank;
|
|
|
double time;
|
|
|
unsigned int nbIte, heuriFill, heuriSolve, satisfFill, satisfSolve;
|
|
|
- MPI_Recv(&pid, 1, MPI_INT, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
- MPI_Recv(&rank, 1, MPI_INT, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
- MPI_Recv(&time, 1, MPI_DOUBLE, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
- MPI_Recv(&nbIte, 1, MPI_UNSIGNED, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
- MPI_Recv(&heuriFill, 1, MPI_UNSIGNED, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
- MPI_Recv(&heuriSolve, 1, MPI_UNSIGNED, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
- MPI_Recv(&satisfFill, 1, MPI_UNSIGNED, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
- MPI_Recv(&satisfSolve, 1, MPI_UNSIGNED, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
+ if(end) {
|
|
|
+ pid = getpid();
|
|
|
+ rank = world_rank;
|
|
|
+ time = gsat->realTime() - startTime;
|
|
|
+ nbIte = gsat->getNbIterations();
|
|
|
+ heuriFill = gsat->getHeuristicFill();
|
|
|
+ heuriSolve = gsat->getHeuristicSolve();
|
|
|
+ satisfFill = gsat->getNbSatisfiedClausesFill();
|
|
|
+ satisfSolve = gsat->getNbSatisfiedClausesSolve();
|
|
|
+ } else {
|
|
|
+ //Attend las infos venants de processus qui à trouvé
|
|
|
+ MPI_Recv(&pid, 1, MPI_INT, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
+ MPI_Recv(&rank, 1, MPI_INT, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
+ MPI_Recv(&time, 1, MPI_DOUBLE, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
+ MPI_Recv(&nbIte, 1, MPI_UNSIGNED, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
+ MPI_Recv(&heuriFill, 1, MPI_UNSIGNED, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
+ MPI_Recv(&heuriSolve, 1, MPI_UNSIGNED, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
+ MPI_Recv(&satisfFill, 1, MPI_UNSIGNED, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
+ MPI_Recv(&satisfSolve, 1, MPI_UNSIGNED, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
+ }
|
|
|
//Attend pour que tous les autres porcessus se termine
|
|
|
sleep(1);
|
|
|
//Affiche le resultat
|