Parallelism in SAT Solvers Vadim Ryvchin Parallel vs

  • Slides: 58
Download presentation
Parallelism in SAT Solvers Vadim Ryvchin

Parallelism in SAT Solvers Vadim Ryvchin

Parallel vs. One threaded (SAT’ 16 Competition)

Parallel vs. One threaded (SAT’ 16 Competition)

Low Level Parallelization BCP Parallelization Cuda Cores Simplification Parallelization How to Cube? Cube and

Low Level Parallelization BCP Parallelization Cuda Cores Simplification Parallelization How to Cube? Cube and Conquer What to share? Same solver different strategies Portfolio Different Solvers Cooperative portfolio

Low Level Parallelization BCP Parallelization Cuda Cores Simplification Parallelization How to Cube? Cube and

Low Level Parallelization BCP Parallelization Cuda Cores Simplification Parallelization How to Cube? Cube and Conquer What to share? Same solver different strategies Portfolio Different Solvers With and without sharing

Low Level Parallelization BCP Parallelization Cuda Cores Simplification Parallelization How to Cube? Cube and

Low Level Parallelization BCP Parallelization Cuda Cores Simplification Parallelization How to Cube? Cube and Conquer What to share? Same solver different strategies Portfolio Different Solvers Cooperative portfolio

Concurrent Clause Strengthening • Concurrent Clause Strengthening, SAT’ 13: • Siert Wieringa and Keijo

Concurrent Clause Strengthening • Concurrent Clause Strengthening, SAT’ 13: • Siert Wieringa and Keijo Heljanko

Reminder – Conflict Clause @2 @2 @5 @5 X @5 @5 @3 @3 @5

Reminder – Conflict Clause @2 @2 @5 @5 X @5 @5 @3 @3 @5 @3

Reminder – Conflict Clause Simplification @2 @2 @5 @5 X @5 @5 @3 @3

Reminder – Conflict Clause Simplification @2 @2 @5 @5 X @5 @5 @3 @3 @5 @3

Concurrent Clause Strengthening • Two threads: • Solver - solves the SAT problem •

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 Work Set Solver Reducer Result Queue

Concurrent Clause Strengthening Work Set Solver Reducer Result Queue

Concurrent Clause Strengthening Work Set Solver Shared Memory Result Queue Reducer

Concurrent Clause Strengthening Work Set Solver Shared Memory Result Queue Reducer

Concurrent Clause Strengthening Copy Learned Clause Work Set Solver Reducer Result Queue

Concurrent Clause Strengthening Copy Learned Clause Work Set Solver Reducer Result Queue

Concurrent Clause Strengthening Work Set Solver Clause Strengthening Reducer Result Queue

Concurrent Clause Strengthening Work Set Solver Clause Strengthening Reducer Result Queue

Concurrent Clause Strengthening Work Set Solver Reducer Result Queue Reduced Clause

Concurrent Clause Strengthening Work Set Solver Reducer Result Queue Reduced Clause

Concurrent Clause Strengthening Work Set Solver Reducer Result Queue Solver Picks Reduced Clauses

Concurrent Clause Strengthening Work Set Solver Reducer Result Queue Solver Picks Reduced Clauses

Concurrent Clause Strengthening Work Set Solver Reducer Result Queue Conflict as result of reduced

Concurrent Clause Strengthening Work Set Solver Reducer Result Queue Conflict as result of reduced clause

Concurrent Clause Strengthening • If reduced clause creates a conflict: • Backtrack to conflict

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

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 Reducer

The Work Set • The reducer thread process conflicts slower than new clauses provided

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

Result Queue • Unlimited FIFO

Unsatisfiable Benchmarks

Unsatisfiable Benchmarks

Satisfiable Benchmarks

Satisfiable Benchmarks

Low Level Parallelization BCP Parallelization Cuda Cores Simplification Parallelization How to Cube? Cube and

Low Level Parallelization BCP Parallelization Cuda Cores Simplification Parallelization How to Cube? Cube and Conquer What to share? Same solver different strategies Portfolio Different Solvers With and without sharing

Cube and Conquer (CC) • Cube and Conquer: Guiding CDCL SAT Solvers by Lookahead,

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: • Split the search space to cubes • Combined

Cube and Conquer • Motivation: • Split the search space to cubes • Combined cubes easier to solver than the original formula • Main Problems: • Cutoff Heuristic • Splitting Heuristic

Cube and Conquer

Cube and Conquer

Look Ahead Solvers in a Nutshell • Given CNF formula F a lookahead on

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

Creating Cubes Input Formula

Creating Cubes Input Formula

Creating Cubes Discovered Till now

Creating Cubes Discovered Till now

Creating Cubes Conflict Clauses

Creating Cubes Conflict Clauses

Creating Cubes Decision Literals (Current Cube)

Creating Cubes Decision Literals (Current Cube)

Creating Cubes Implied Literals (In Current Cube)

Creating Cubes Implied Literals (In Current Cube)

Creating Cubes Run BCP and Simplification

Creating Cubes Run BCP and Simplification

Creating Cubes In case of conflict

Creating Cubes In case of conflict

Creating Cubes Perform Cutoff

Creating Cubes Perform Cutoff

Creating Cubes Choose new variable l

Creating Cubes Choose new variable l

Creating Cubes 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 Both replaced by:

After Creating Cubes • Reduce CNF C by applying self-subsumption resolution Both replaced by: • Reduce cubes in DNF A by using CNF C clauses.

Cutoff Heuristic • Good Heuristic: 1. The runtimes to solve each of the subproblems

Cutoff Heuristic • Good Heuristic: 1. The runtimes to solve each of the subproblems are comparable 2. The sum of runtimes does not exceed the runtime of solving the original formula • Suggestion: 1. Achieved by fraction of the variables which are assigned 2. After k decisions 3. Combination of both

Cutoff Heuristic – Cube and Conquer • Use product 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

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,

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,

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,

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,

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,

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

Sequential Solver

Problems with Cube-and-Conquer (CC) • Splitting to cubes should help CDCL solver • Refute

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 Lookahead Assumptions Unsat Core SAT

Lookahead and CDCL in Parallel New Splitting Literal CDCL Lookahead Assumptions Unsat Core SAT

Lookahead and CDCL in Parallel • No need for cutoff heuristic as we wait

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 5 sec), then stop the Lookahead

Improvements • If CDCL faster than Lookahead (after 5 sec), then stop the Lookahead and let CDCL work • Additional heuristic to cutoff to enable parallel cube solution: • Just leave the CDCL thread working