#ifndef GSATTHREADMPI_HPP #define GSATTHREADMPI_HPP /* --- Include --- */ #include #include #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; std::vector threads; std::thread mpiSync; GSATResult result; void solverThread(int); void mpiWait(GSATThreadMPI*); void mpiNotify(int); }; #endif