Painless
A framework to ease parallelization of sequential CDCL SAT solvers
Loading...
Searching...
No Matches
MpiUtils.hpp
1#pragma once
2
3#include "ErrorCodes.hpp"
4#include "containers/ClauseUtils.hpp"
5#include <vector>
6
7#define MY_MPI_END 2012
8#define MYMPI_CLAUSES 1
9#define MYMPI_BITSET 1
10#define MYMPI_OK 2
11#define MYMPI_NOTOK 3
12#define MYMPI_MODEL 4
13
14#define COLOR_YES 10
15
16#define TESTRUNMPI(func) \
17 do { \
18 int result = (func); \
19 if (dist && result != MPI_SUCCESS) { \
20 LOGERROR("MPI ERROR: %d in function %s", result, #func); \
21 exit(PERR_MPI); \
22 } \
23 } while (0)
24
26extern int mpi_rank;
27
29extern int mpi_world_size;
30
32extern int mpi_winner;
33
36namespace mpiutils {
37
43bool
44sendFormula(std::vector<simpleClause>& clauses, unsigned int* varCount, int rootRank);
45
51bool
52serializeClauses(const std::vector<simpleClause>& clauses, std::vector<int>& serializedClauses);
53
58bool
59deserializeClauses(const std::vector<int>& serializedClauses, std::vector<simpleClause>& clauses);
60
62void
64
65}
A set of helper functions for distributed solver initialization and finalization using MPI.
Definition MpiUtils.hpp:36
bool sendFormula(std::vector< simpleClause > &clauses, unsigned int *varCount, int rootRank)
Sends a formula represented by clauses and variable count over MPI.
bool deserializeClauses(const std::vector< int > &serializedClauses, std::vector< simpleClause > &clauses)
Deserializes a vector of characters into a vector of simpleClause objects.
bool serializeClauses(const std::vector< simpleClause > &clauses, std::vector< int > &serializedClauses)
Serializes a vector of Clauses into a vector of integers.
void sendModelToRoot()
The winner determined by the root will send the model if the answer was SATISFIABLE.