Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iterative partitioning #134

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
253e736
docker: only copy relevant files
conp-solutions Apr 27, 2023
614205e
docker: use default Dockerfile, and customize
conp-solutions Apr 27, 2023
4d88d2f
parallel: count actual syncs
conp-solutions Apr 10, 2022
07d559c
partition: add tree type
conp-solutions Apr 7, 2022
4ce6988
parallel,tree: implement basics
conp-solutions Apr 10, 2022
84c65a4
parallel: assign tasks after delay
conp-solutions Apr 10, 2022
52d6d22
parallel: fail hard on unimplemented methods
conp-solutions Apr 10, 2022
0e23bb0
parallel: partition nodes stubs
conp-solutions Apr 10, 2022
bdf446e
parallel,partition: stub unsat partition handling
conp-solutions Apr 11, 2022
8a57f18
partition,tree: only create nodes via tree
conp-solutions Apr 11, 2022
8d40d32
partition,tree: create node signature
conp-solutions Apr 11, 2022
d723786
partition,node: load path assumptions for a node
conp-solutions Apr 11, 2022
5207d52
parallel,partition: partition assigned node
conp-solutions Apr 11, 2022
a4d7cf6
WIP, parallel: start using partitions during search
conp-solutions Apr 11, 2022
aa1500d
parallel,partition: add tracking to tree
conp-solutions Jan 2, 2023
c2cc593
parallel: add partition handling
conp-solutions Jan 2, 2023
5479559
ci,configs: test parittioning
conp-solutions Apr 11, 2023
bf61f07
partition,evaluate: do not process empty tree
conp-solutions Apr 14, 2023
5a63d58
parallel,sync: handle UNSAT after partitioning
conp-solutions Apr 20, 2023
8fb9a67
parttionTree: allow to retrieve position
conp-solutions Apr 24, 2023
5f7ccee
partitionTree: print tree properly
conp-solutions Apr 24, 2023
5e0af39
partitionTree: formatting
conp-solutions Apr 24, 2023
6a63cf5
partition,reset: also clear status and assumptions
conp-solutions Apr 24, 2023
7433b97
parallel,conflict: check for incremental mode
conp-solutions Apr 24, 2023
25d49a8
parallel,status: override independently on previous status
conp-solutions Apr 24, 2023
a7ea54c
partitioning,evaluation: fix implementation
conp-solutions Apr 24, 2023
5c36bc7
parallel,sync: always sync on unsat node
conp-solutions Apr 24, 2023
7a1e10d
parallel,unassign: backtrack to level 0
conp-solutions Apr 24, 2023
55edb29
parallel,incremental: make conflict available
conp-solutions Apr 24, 2023
7af363f
tests,parallel: add simple inc unit test
conp-solutions Apr 24, 2023
a2fb163
parallel,partitioning: allow to fully disable
conp-solutions Apr 24, 2023
dfa0b9c
parallel,partitioning: do not use elimination
conp-solutions Apr 24, 2023
3ed35dd
parallel,stats: print cpu efficiency
conp-solutions Apr 25, 2023
a1bdfe9
parallel,stats: only print tree on verb
conp-solutions Apr 25, 2023
0b4f38c
parallel,UNSAT: assign from global to thread status
conp-solutions Apr 25, 2023
e6e996b
solver,solve: always start on level 0
conp-solutions Apr 27, 2023
601b967
parallel: signal detected only-childs
conp-solutions Apr 27, 2023
09caf03
throw: use macro with location
conp-solutions Apr 27, 2023
077d618
tree,stats: print simple stats
conp-solutions Apr 27, 2023
9534f3d
parallel,partitioning: disable by default
conp-solutions Apr 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* add AWS docker infrastructure
* add gate detection for portfolio configurations
* allow to use partitioning in parallel solving

## [4.0-rc3]

Expand Down
1 change: 1 addition & 0 deletions minisat/core/Solver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3693,6 +3693,7 @@ void Solver::enableDISTANCEheuristic()
// NOTE: assumptions passed in member-variable 'assumptions'.
lbool Solver::solve_()
{
assert(decisionLevel() == 0);
model.clear();
conflict.clear();
if (!ok) {
Expand Down
2 changes: 1 addition & 1 deletion minisat/parallel/JobQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class JobQueue
_threadState = nullptr;
if (_threads) delete[] _threads;
_threads = nullptr;
throw "Failed to allocate jobqueue structs";
throw("Failed to allocate jobqueue structs");
}

_workState = 0;
Expand Down
426 changes: 389 additions & 37 deletions minisat/parallel/ParSolver.cc

Large diffs are not rendered by default.

41 changes: 40 additions & 1 deletion minisat/parallel/ParSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "mtl/Queue.h"
#include "simp/SimpSolver.h"

#include "parallel/PartitionTree.h"
#include "parallel/Sharing.h"

#include <atomic>
Expand Down Expand Up @@ -58,6 +59,7 @@ class ParSolver : protected SimpSolver
lbool _status = l_Undef; // status of the associated SAT solver
double _idle_s = 0; // seconds this thread idled while waiting
uint64_t _attempted_to_sync = 0; // number of attempts to enter a sync
uint64_t _syncs = 0; // number of performed syncs
uint64_t _next_sync_counter_limit = 0; // indicate when to actually sync next
uint64_t _next_sync_current_accesses = 0; // stores number of accesses when entring successful sync
uint64_t _next_sync_previous_limit = 0; // stores the previous limit we have seen in a given sync
Expand All @@ -69,6 +71,12 @@ class ParSolver : protected SimpSolver
ClausePool pool; // store for learned clauses that are shared by this thread
uint64_t received_clauses = 0; // number of clauses a thread received

int partitionID = PartitionTree::INVALID_ID; // index to node in partition tree slot that stores node
// assigned to this thread
int newPartitionID = PartitionTree::INVALID_ID; // ID of the parititon to be solved next
vec<Lit> partitionClauses; // if non-empty, these clause partition to currently assigned node
vec<Lit> partitionAssumptions; // assumptions used by the solver when working on a node

vec<TaskType> tasks; // task to be executed before next sync test

SolverData(ParSolver *parent, int threadnr) : _parent(parent), _threadnr(threadnr) {}
Expand All @@ -91,6 +99,20 @@ class ParSolver : protected SimpSolver
_blocked_by_barrier = 0;
received_clauses = 0;
}

/// tell whether this node solves the original formula or a partition
bool solvesPartition() const { return partitionID != PartitionTree::INVALID_ID; }

/// unassign current partition, and reset status of solver
void resetPartitioningState()
{
assert(solvesPartition() && "only reset in case a partition is active");
_status = l_Undef;
partitionID = PartitionTree::INVALID_ID;
partitionAssumptions.clear();
partitionClauses.clear();
_status = l_Undef;
}
};

public:
Expand Down Expand Up @@ -150,6 +172,7 @@ class ParSolver : protected SimpSolver

// Mode of operation:
//
using SimpSolver::conflict;
using SimpSolver::parsing;
void set_parsing(bool is_parsing = true);
void set_verbosity(int verb);
Expand Down Expand Up @@ -209,6 +232,11 @@ class ParSolver : protected SimpSolver
uint64_t base_sync_increase; // how much to bump number of accesses before next sync
SYNC_UPDATE_METHOD sync_step_update_mode; // how to update step limits for next sync

PartitionTree partitionTree; // store structure of partitions
int32_t partitioningDelaySyncs; // number of syncs before starting/continuing partitioning
uint32_t partitionsPerNode; // split a formula into this amount of new partitions
std::atomic<bool> notifyEvaluatePartitions; // if set, partitions are found to be unsatisfiable, so that we need to evaluate

std::atomic<int> solved_current_call; // indicate that the current solving task has been solved (10 or 20), if not 0
std::atomic<bool> sync_by_primary; // false, if true, search will be non-deterministic
size_t synced_clauses; // store number of clauses in primary solver after last sync (after solving)
Expand Down Expand Up @@ -255,12 +283,23 @@ class ParSolver : protected SimpSolver
bool sharingReceiveFilterAccept(const Clause &c, size_t threadnr);

/// assign (new) extra tasks, return false on UNSAT
bool assignExtraTask(size_t threadnr);
bool assignPartitionAndTasks(size_t threadnr);
/// evaluate the results of the previously assigned tasks, return false on UNSAT
bool evaluateExtraTask(size_t threadnr);
/// check, and execute, pending task for a given extra thread, return false on UNSAT
bool runAssignedExtraTask(size_t threadnr);

/// handle assigning a nodeID to a thread
void assignNewThreadPartition(size_t threadnr, int partitionID);
/// process solver status wrt assumptions, e.g. impact of returned conflict clause to reset partition of the node
void evaluateSolverStatus(size_t threadnr);
/// Handle partitioning related tasks during synchronization
void handlePartitionsDuringSync(size_t threadnr);
/// set a thread to partition the node that is currently assigned
bool partitionAssignedNode(size_t threadnr);
/// check status of partition tree, return false on UNSAT
bool evaluatePartitionTree();

/// return new limit to be set next
uint64_t get_next_sync_limit(size_t threadnr) const;
/// return additional increment for steps until next sync
Expand Down
Loading