Parallelism in SAT Solvers Vadim Ryvchin
Parallel vs. One threaded (SAT’16 Competition)
Low Level Parallelization BCP Parallelization Cuda Cores Simplification Parallelization Cube and Conquer How to Cube? What to share? Portfolio Same solver different strategies Different Solvers Cooperative portfolio
Low Level Parallelization BCP Parallelization Cuda Cores Simplification Parallelization Cube and Conquer How to Cube? What to share? Portfolio Same solver different strategies Different Solvers With and without sharing
Low Level Parallelization BCP Parallelization Cuda Cores Simplification Parallelization Cube and Conquer How to Cube? What to share? Portfolio Same solver different strategies Different Solvers Cooperative portfolio
Concurrent Clause Strengthening Concurrent Clause Strengthening, SAT’13: Siert Wieringa and Keijo Heljanko
Reminder – Conflict Clause @2 @2 @2 @5 @5 @5 @5 @5 @5 @5 X @5 @5 @5 @3 @3 @3
Reminder – Conflict Clause Simplification @2 @2 @2 @5 @5 @5 @5 @5 @5 @5 X @5 @5 @5 @3 @3 @3
Concurrent Clause Strengthening Two threads: Solver - solves the SAT problem Reducer - reduces the learned clauses The main solver can disable any type of conflict clause minimization
Concurrent Clause Strengthening Solver Work Set Reducer Result Queue
Concurrent Clause Strengthening Shared Memory Solver Work Set Reducer Result Queue
Concurrent Clause Strengthening Copy Learned Clause Solver Work Set Reducer Result Queue
Concurrent Clause Strengthening Solver Work Set Reducer Clause Strengthening Result Queue
Concurrent Clause Strengthening Solver Work Set Reducer Result Queue Reduced Clause
Concurrent Clause Strengthening Solver Work Set Reducer Result Queue Solver Picks Reduced Clauses
Concurrent Clause Strengthening Solver Work Set Reducer Result Queue Conflict as result of reduced clause
Concurrent Clause Strengthening If reduced clause creates a conflict: Backtrack to conflict level Perform a regular conflict analyzes Notice: Original clause ᴄ and reduced clause ᴄ’: ᴄ’ < ᴄ Two runs are on the same problem are none-deterministic
The Reducer SAT Solver with all the original clauses Keeps all newly added and later reduced clauses The Reduction Algorithm: For input clause c: For every literal l of c assign ~l If conflict: analyze and learn a new clause (reduced size) If no conflict: Remove implied literals from c
The Reducer
The Work Set The reducer thread process conflicts slower than new clauses provided FIFO – old clauses reduced first, but less relevant to the solver LIFO – newest clauses reduced first, but “misses” good old ones By Clause “Quality” – length or LBD – too expensive to keep ordered Solution: Limited size ordered by “quality” queue. Oldest clause removed if new inserted
Result Queue Unlimited FIFO
Unsatisfiable Benchmarks
Satisfiable Benchmarks
Low Level Parallelization BCP Parallelization Cuda Cores Simplification Parallelization Cube and Conquer How to Cube? What to share? Portfolio Same solver different strategies Different Solvers With and without sharing
Cube and Conquer (CC) Cube and Conquer: Guiding CDCL SAT Solvers by Lookahead, HVC’11: Marijn J.H. Heule , Oliver Kullmann , Siert Wieringa and Armin Biere Concurrent Cube-and-Conquer, Pragmatics of SAT’12: Peter van der Tak , Marijn J.H. Heule and Armin Biere Combination of Lookahead solvers with CDCL solvers
Cube and Conquer Motivation: Main Problems: Split the search space to cubes Combined cubes easier to solver than the original formula Main Problems: Cutoff Heuristic Splitting Heuristic
Cube and Conquer
Look Ahead Solvers in a Nutshell Given CNF formula F a lookahead on literal x: x assigned to T Run BCP() In case no conflict, F’ created (~x removed from the clauses, clauses containing x removed) F’/F is weighted Reverse F’ to F For every decision choose literal with largest weight If x analyzed without decisions and conflict occurs then x is failed literal Local Learning – mostly unary and binary clauses, example: hyper binary resolution
Creating Cubes
Creating Cubes Input Formula
Cubes Discovered Till now Creating Cubes Cubes Discovered Till now
Creating Cubes Conflict Clauses
Decision Literals (Current Cube) Creating Cubes Decision Literals (Current Cube)
Creating Cubes Implied Literals (In Current Cube)
Run BCP and Simplification Creating Cubes Run BCP and Simplification
Creating Cubes In case of conflict
Creating Cubes Perform Cutoff
Creating Cubes Choose new variable l
Call recursively for l and ~l Creating Cubes Call recursively for l and ~l
After Creating Cubes Reduce CNF C by applying self-subsumption resolution Reduce cubes in DNF A by using CNF C clauses. Both replaced by:
Cutoff Heuristic Good Heuristic: The runtimes to solve each of the subproblems are comparable The sum of runtimes does not exceed the runtime of solving the original formula Suggestion: Achieved by fraction of the variables which are assigned After k decisions Combination of both
Cutoff Heuristic – Cube and Conquer Use product of both: ≤
Cutoff Heuristic – Cube and Conquer
Cutoff Heuristic – Cube and Conquer
Cutoff Heuristic – Cube and Conquer
Cutoff Heuristic – Cube and Conquer
Splitting Heuristic Use of Lookahead heuristic: evalcls(xi) – sum of the reduced, not satisfied clauses evalvar(xi) – number of assigned variables
Splitting Heuristic Use of Lookahead heuristic: evalcls(xi) – sum of the reduced, not satisfied clauses evalvar(xi) – number of assigned variables
Splitting Heuristic Use of Lookahead heuristic: evalcls(xi) – sum of the reduced, not satisfied clauses evalvar(xi) – number of assigned variables
Splitting Heuristic Use of Lookahead heuristic: evalcls(xi) – sum of the reduced, not satisfied clauses evalvar(xi) – number of assigned variables
Splitting Heuristic Choose the variable with the highest: In case of tie, broke by: - more effective on instances with few binary clauses, usually in crafter and random instances - more effective on industrial instances, faster and easier for implementation
Sequential Solver
Problems with Cube-and-Conquer (CC) Splitting to cubes should help CDCL solver Refute cubes which are easy to CDCL and not to refute the hard ones In reality there are cases where: Huge number of easy cubes (thousands of millions) Several cubes as difficult as the original formula (1-2 usually)
Lookahead and CDCL in Parallel New Splitting Literal CDCL SAT Assumptions Unsat Core
Lookahead and CDCL in Parallel No need for cutoff heuristic as we wait till CDCL solver is done Cannot be parallelized on cubes In case CDCL much faster than Lookahead, CDCL stuck
Improvements If CDCL faster than Lookahead (after 5sec), then stop the Lookahead and let CDCL work Additional heuristic to cutoff to enable parallel cube solution: Just leave the CDCL thread working