12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #ifndef GSATTHREADMPI_HPP
- #define GSATTHREADMPI_HPP
- /* --- Include --- */
- #include <vector>
- #include <thread>
- #include "GSAT/GSAT.hpp"
- /* --- Constante --- */
- #define DEFAULT_NB_THREAD 4
- /* --- Structure --- */
- typedef struct {
- int threadId;
- double calcTime;
- unsigned int nbIteration;
- unsigned int heuristicFill;
- unsigned int heuristicSolve;
- unsigned int nbSatisfiedClausesFill;
- unsigned int nbSatisfiedClausesSolve;
- }GSATResult;
- class GSATThreadMPI {
- public:
- GSATThreadMPI(int, int, char**);
- ~GSATThreadMPI();
- bool solve();
- void end();
- void end(bool);
- void printResult();
- /* --- Getter --- */
- inline unsigned int getNbVariables() {return gsat[0]->getNbVariables();}
- inline unsigned int getNbClauses() {return gsat[0]->getNbClauses();}
- private:
- bool bEnd;
- bool find;
- int nbThread;
- std::vector<GSAT*> gsat;
- std::vector<std::thread> threads;
- std::thread mpiSync;
- GSATResult result;
- void solverThread(int);
- void mpiWait(GSATThreadMPI*);
- void mpiNotify(int);
- };
- #endif
|