|
@@ -47,10 +47,7 @@ bool GSATThreadMPI::solve() {
|
|
|
mpiSync.join();
|
|
|
//Si c'est le proc qui à trouvé
|
|
|
if(find) {
|
|
|
- //Affiche resultat
|
|
|
- sleep(1); //Attend la fin des autres processus
|
|
|
- printf("-----------------------------------------------------------------------------------------------------------------\n");
|
|
|
- this->printResult();
|
|
|
+ this->mpiSendResult(DISPLAY_RANK);
|
|
|
}
|
|
|
return find;
|
|
|
}
|
|
@@ -81,7 +78,8 @@ void GSATThreadMPI::printResult() {
|
|
|
fflush(stdout);
|
|
|
}
|
|
|
|
|
|
-void GSATThreadMPI::setResult(int pid, int rank, int thread, double time, unsigned int nbIte, unsigned int heuriFill, unsigned int heuriSolve, unsigned int statisfFill, unsigned int satisfSolve) {
|
|
|
+void GSATThreadMPI::setResult(bool isFind, int pid, int rank, int thread, double time, unsigned int nbIte, unsigned int heuriFill, unsigned int heuriSolve, unsigned int satisfFill, unsigned int satisfSolve) {
|
|
|
+ find = isFind;
|
|
|
result.pid = pid;
|
|
|
result.rank = rank;
|
|
|
result.threadId = thread;
|
|
@@ -89,8 +87,8 @@ void GSATThreadMPI::setResult(int pid, int rank, int thread, double time, unsign
|
|
|
result.nbIteration = nbIte;
|
|
|
result.heuristicFill = heuriFill;
|
|
|
result.heuristicSolve = heuriSolve;
|
|
|
- result.nbSatisfiedClausesFill = statisfFill;
|
|
|
- result.nbSatisfiedClausesSolve = statisfFill;
|
|
|
+ result.nbSatisfiedClausesFill = satisfFill;
|
|
|
+ result.nbSatisfiedClausesSolve = satisfSolve;
|
|
|
}
|
|
|
|
|
|
/* --- Private --- */
|
|
@@ -128,6 +126,7 @@ void GSATThreadMPI::solverThread(int id) {
|
|
|
this->end(true);
|
|
|
find = true;
|
|
|
this->setResult(
|
|
|
+ true,
|
|
|
getpid(),
|
|
|
world_rank,
|
|
|
id, gsat[id]->realTime() - startTime,
|
|
@@ -154,3 +153,17 @@ void GSATThreadMPI::mpiNotify(int rank) {
|
|
|
MPI_Isend(&rank, 1, MPI_INT, i, 0, MPI_COMM_WORLD, &request);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+void GSATThreadMPI::mpiSendResult(int rankTo) {
|
|
|
+ MPI_Request request;
|
|
|
+ //Envoi des infos au rank determiné
|
|
|
+ MPI_Isend(&result.pid, 1, MPI_INT, rankTo, 0, MPI_COMM_WORLD, &request);
|
|
|
+ MPI_Isend(&result.rank, 1, MPI_INT, rankTo, 0, MPI_COMM_WORLD, &request);
|
|
|
+ MPI_Isend(&result.threadId, 1, MPI_INT, rankTo, 0, MPI_COMM_WORLD, &request);
|
|
|
+ MPI_Isend(&result.calcTime, 1, MPI_DOUBLE, rankTo, 0, MPI_COMM_WORLD, &request);
|
|
|
+ MPI_Isend(&result.nbIteration, 1, MPI_UNSIGNED, rankTo, 0, MPI_COMM_WORLD, &request);
|
|
|
+ MPI_Isend(&result.heuristicFill, 1, MPI_UNSIGNED, rankTo, 0, MPI_COMM_WORLD, &request);
|
|
|
+ MPI_Isend(&result.heuristicSolve, 1, MPI_UNSIGNED, rankTo, 0, MPI_COMM_WORLD, &request);
|
|
|
+ MPI_Isend(&result.nbSatisfiedClausesFill, 1, MPI_UNSIGNED, rankTo, 0, MPI_COMM_WORLD, &request);
|
|
|
+ MPI_Isend(&result.nbSatisfiedClausesSolve, 1, MPI_UNSIGNED, rankTo, 0, MPI_COMM_WORLD, &request);
|
|
|
+}
|