|
@@ -36,10 +36,13 @@ bool GSATThreadMPI::solve() {
|
|
for(int i = 0; i < nbThread; i++) {
|
|
for(int i = 0; i < nbThread; i++) {
|
|
threads[i] = std::thread(&GSATThreadMPI::solverThread, this, i);
|
|
threads[i] = std::thread(&GSATThreadMPI::solverThread, this, i);
|
|
}
|
|
}
|
|
|
|
+ //Lance thread de synchronisation MPI
|
|
|
|
+ mpiSync = std::thread(mpiWait, this);
|
|
//Attend resultat
|
|
//Attend resultat
|
|
for(int i = 0; i < nbThread; i++){
|
|
for(int i = 0; i < nbThread; i++){
|
|
threads[i].join();
|
|
threads[i].join();
|
|
}
|
|
}
|
|
|
|
+ mpiSync.join();
|
|
//Si c'est le proc qui à trouvé
|
|
//Si c'est le proc qui à trouvé
|
|
if(find) {
|
|
if(find) {
|
|
sleep(1); //Laisse le temps aux autres de se couper
|
|
sleep(1); //Laisse le temps aux autres de se couper
|
|
@@ -94,12 +97,10 @@ void GSATThreadMPI::solverThread(int id) {
|
|
printf(RESET);
|
|
printf(RESET);
|
|
}
|
|
}
|
|
cpt++;
|
|
cpt++;
|
|
- if(id == 0) {
|
|
|
|
- mpiSync(this, end || solve);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
//Si 1er arreter
|
|
//Si 1er arreter
|
|
if(!end && solve) {
|
|
if(!end && solve) {
|
|
|
|
+ mpiNotify(world_rank);
|
|
end = true;
|
|
end = true;
|
|
find = true;
|
|
find = true;
|
|
result.threadId = id;
|
|
result.threadId = id;
|