|
@@ -87,26 +87,54 @@ int main(int argc, char* argv[]) {
|
|
|
for(int i = 0; i < world_size; i++) {
|
|
|
MPI_Isend(&world_rank, 1, MPI_INT, i, 0, MPI_COMM_WORLD, &finish);
|
|
|
}
|
|
|
- //Attend que tous les processus finissent
|
|
|
- sleep(1);
|
|
|
- //Affiche le resultat
|
|
|
- printf("------------------------------------------------------------------------------------------------------\n");
|
|
|
- printf(GREEN);
|
|
|
- printf("s %s\n",end?"SATISFIABLE":"NOT FOUND");
|
|
|
- printf(YELLOW);
|
|
|
- printf("c real time : %.4f seconds\n", gsat->realTime() - startTime);
|
|
|
- printf("c [pid:%6d][process:%2d][iteration:%4d][fill:%d][heuristic:%d]Satisfied clauses (begin: %d)(end:%d)\n",
|
|
|
- getpid(),
|
|
|
- world_rank,
|
|
|
- gsat->getNbIterations(),
|
|
|
- gsat->getHeuristicFill(),
|
|
|
- gsat->getHeuristicSolve(),
|
|
|
- gsat->getNbSatisfiedClausesFill(),
|
|
|
- gsat->getNbSatisfiedClausesSolve());
|
|
|
- printf(RESET);
|
|
|
+ //Envoi les infos de resolution au processus de rank 0
|
|
|
+ int pid, nbIte, heuriFill, heuriSolve, satisfFill, satisfSolve;
|
|
|
+ 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);
|
|
|
+ nbIte = gsat->getNbIterations();
|
|
|
+ MPI_Isend(&nbIte, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &finish);
|
|
|
+ heuriFill = gsat->getHeuristicFill();
|
|
|
+ MPI_Isend(&heuriFill, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &finish);
|
|
|
+ heuriSolve = gsat->getHeuristicSolve();
|
|
|
+ MPI_Isend(&heuriSolve, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &finish);
|
|
|
+ satisfFill = gsat->getNbSatisfiedClausesFill();
|
|
|
+ MPI_Isend(&satisfFill, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &finish);
|
|
|
+ satisfSolve = gsat->getNbSatisfiedClausesSolve();
|
|
|
+ MPI_Isend(&satisfSolve, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &finish);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //L'affichage est fait par le processus de rank 0
|
|
|
+ if(world_rank == 0) {
|
|
|
+ //Attend las infos venants de processus qui à trouvé
|
|
|
+ int pid, rank, 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(&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);
|
|
|
+ //Attend pour que tous les autres porcessus se termine
|
|
|
+ sleep(1);
|
|
|
+ //Affiche le resultat
|
|
|
+ printf("------------------------------------------------------------------------------------------------------\n");
|
|
|
+ printf(GREEN);
|
|
|
+ printf("s %s\n",end?"SATISFIABLE":"NOT FOUND");
|
|
|
+ printf(YELLOW);
|
|
|
+ printf("c real time : %.4f seconds\n", gsat->realTime() - startTime);
|
|
|
+ printf("c [pid:%6d][process:%2d][iteration:%4d][fill:%d][heuristic:%d]Satisfied clauses (begin: %d)(end:%d)\n",
|
|
|
+ pid,
|
|
|
+ rank,
|
|
|
+ nbIte,
|
|
|
+ heuriFill,
|
|
|
+ heuriSolve,
|
|
|
+ satisfFill,
|
|
|
+ satisfSolve);
|
|
|
+ printf(RESET);
|
|
|
+ }
|
|
|
+
|
|
|
MPI_Finalize();
|
|
|
|
|
|
}
|