|  | @@ -6,6 +6,8 @@
 | 
											
												
													
														|  |  #include <mpi.h>
 |  |  #include <mpi.h>
 | 
											
												
													
														|  |  #include "color.h"
 |  |  #include "color.h"
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +#define DISPLAY_RANK 0
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  using namespace std;
 |  |  using namespace std;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  void help(char* prog) {
 |  |  void help(char* prog) {
 | 
											
										
											
												
													
														|  | @@ -88,42 +90,49 @@ int main(int argc, char* argv[]) {
 | 
											
												
													
														|  |                  MPI_Isend(&world_rank, 1, MPI_INT, i, 0, MPI_COMM_WORLD, &finish);
 |  |                  MPI_Isend(&world_rank, 1, MPI_INT, i, 0, MPI_COMM_WORLD, &finish);
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |              //Envoi les infos de resolution au processus de rank 0
 |  |              //Envoi les infos de resolution au processus de rank 0
 | 
											
												
													
														|  | -            int pid, nbIte, heuriFill, heuriSolve, satisfFill, satisfSolve;
 |  | 
 | 
											
												
													
														|  | 
 |  | +            int pid;
 | 
											
												
													
														|  | 
 |  | +            double time;
 | 
											
												
													
														|  | 
 |  | +            unsigned int nbIte, heuriFill, heuriSolve, satisfFill, satisfSolve;
 | 
											
												
													
														|  |              pid = getpid();
 |  |              pid = getpid();
 | 
											
												
													
														|  | -            MPI_Isend(&pid, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &finish);
 |  | 
 | 
											
												
													
														|  | -            MPI_Isend(&world_rank, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &finish);
 |  | 
 | 
											
												
													
														|  | 
 |  | +            MPI_Isend(&pid, 1, MPI_INT, DISPLAY_RANK, 0, MPI_COMM_WORLD, &finish);
 | 
											
												
													
														|  | 
 |  | +            MPI_Isend(&world_rank, 1, MPI_INT, DISPLAY_RANK, 0, MPI_COMM_WORLD, &finish);
 | 
											
												
													
														|  | 
 |  | +            time = gsat->realTime() - startTime;
 | 
											
												
													
														|  | 
 |  | +            MPI_Isend(&time, 1, MPI_DOUBLE, DISPLAY_RANK, 0, MPI_COMM_WORLD, &finish);
 | 
											
												
													
														|  |              nbIte = gsat->getNbIterations();
 |  |              nbIte = gsat->getNbIterations();
 | 
											
												
													
														|  | -            MPI_Isend(&nbIte, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &finish);
 |  | 
 | 
											
												
													
														|  | 
 |  | +            MPI_Isend(&nbIte, 1, MPI_UNSIGNED, DISPLAY_RANK, 0, MPI_COMM_WORLD, &finish);
 | 
											
												
													
														|  |              heuriFill = gsat->getHeuristicFill();
 |  |              heuriFill = gsat->getHeuristicFill();
 | 
											
												
													
														|  | -            MPI_Isend(&heuriFill, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &finish);
 |  | 
 | 
											
												
													
														|  | 
 |  | +            MPI_Isend(&heuriFill, 1, MPI_UNSIGNED, DISPLAY_RANK, 0, MPI_COMM_WORLD, &finish);
 | 
											
												
													
														|  |              heuriSolve = gsat->getHeuristicSolve();
 |  |              heuriSolve = gsat->getHeuristicSolve();
 | 
											
												
													
														|  | -            MPI_Isend(&heuriSolve, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &finish);
 |  | 
 | 
											
												
													
														|  | 
 |  | +            MPI_Isend(&heuriSolve, 1, MPI_UNSIGNED, DISPLAY_RANK, 0, MPI_COMM_WORLD, &finish);
 | 
											
												
													
														|  |              satisfFill = gsat->getNbSatisfiedClausesFill();
 |  |              satisfFill = gsat->getNbSatisfiedClausesFill();
 | 
											
												
													
														|  | -            MPI_Isend(&satisfFill, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &finish);
 |  | 
 | 
											
												
													
														|  | 
 |  | +            MPI_Isend(&satisfFill, 1, MPI_UNSIGNED, DISPLAY_RANK, 0, MPI_COMM_WORLD, &finish);
 | 
											
												
													
														|  |              satisfSolve = gsat->getNbSatisfiedClausesSolve();
 |  |              satisfSolve = gsat->getNbSatisfiedClausesSolve();
 | 
											
												
													
														|  | -            MPI_Isend(&satisfSolve, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &finish);
 |  | 
 | 
											
												
													
														|  | 
 |  | +            MPI_Isend(&satisfSolve, 1, MPI_UNSIGNED, DISPLAY_RANK, 0, MPI_COMM_WORLD, &finish);
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    //L'affichage est fait par le processus de rank 0
 |  | 
 | 
											
												
													
														|  | -    if(world_rank == 0) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    //L'affichage est fait par le processus un seul processus
 | 
											
												
													
														|  | 
 |  | +    if(world_rank == DISPLAY_RANK) {
 | 
											
												
													
														|  |          //Attend las infos venants de processus qui à trouvé
 |  |          //Attend las infos venants de processus qui à trouvé
 | 
											
												
													
														|  | -        int pid, rank, nbIte, heuriFill, heuriSolve, satisfFill, satisfSolve;
 |  | 
 | 
											
												
													
														|  | 
 |  | +        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(&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(&rank, 1, MPI_INT, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
 | 
											
												
													
														|  | -        MPI_Recv(&nbIte, 1, MPI_INT, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
 |  | 
 | 
											
												
													
														|  | -        MPI_Recv(&heuriFill, 1, MPI_INT, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
 |  | 
 | 
											
												
													
														|  | -        MPI_Recv(&heuriSolve, 1, MPI_INT, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
 |  | 
 | 
											
												
													
														|  | -        MPI_Recv(&satisfFill, 1, MPI_INT, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
 |  | 
 | 
											
												
													
														|  | -        MPI_Recv(&satisfSolve, 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
 |  |          //Attend pour que tous les autres porcessus se termine
 | 
											
												
													
														|  |          sleep(1);
 |  |          sleep(1);
 | 
											
												
													
														|  |          //Affiche le resultat
 |  |          //Affiche le resultat
 | 
											
												
													
														|  |          printf("------------------------------------------------------------------------------------------------------\n");
 |  |          printf("------------------------------------------------------------------------------------------------------\n");
 | 
											
												
													
														|  |          printf(GREEN);
 |  |          printf(GREEN);
 | 
											
												
													
														|  | -        printf("s %s\n",end?"SATISFIABLE":"NOT FOUND");
 |  | 
 | 
											
												
													
														|  | 
 |  | +        printf("s SATISFIABLE\n");
 | 
											
												
													
														|  |          printf(YELLOW);
 |  |          printf(YELLOW);
 | 
											
												
													
														|  | -        printf("c real time : %.4f seconds\n", gsat->realTime() - startTime);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        printf("c real time : %.4f seconds\n", time);
 | 
											
												
													
														|  |          printf("c [pid:%6d][process:%2d][iteration:%4d][fill:%d][heuristic:%d]Satisfied clauses (begin: %d)(end:%d)\n",
 |  |          printf("c [pid:%6d][process:%2d][iteration:%4d][fill:%d][heuristic:%d]Satisfied clauses (begin: %d)(end:%d)\n",
 | 
											
												
													
														|  |              pid,
 |  |              pid,
 | 
											
												
													
														|  |              rank,
 |  |              rank,
 |