mirror of
https://github.com/Z3Prover/z3
synced 2025-07-19 19:02:02 +00:00
adding parallel threads
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
962979b09c
commit
37ee4c95c3
13 changed files with 250 additions and 18 deletions
45
src/sat/sat_par.cpp
Normal file
45
src/sat/sat_par.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*++
|
||||
Copyright (c) 2017 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
sat_par.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Utilities for parallel SAT solving.
|
||||
|
||||
Author:
|
||||
|
||||
Nikolaj Bjorner (nbjorner) 2017-1-29.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#include "sat_par.h"
|
||||
|
||||
|
||||
namespace sat {
|
||||
|
||||
par::par() {}
|
||||
|
||||
void par::exchange(literal_vector const& in, unsigned& limit, literal_vector& out) {
|
||||
#pragma omp critical (par_solver)
|
||||
{
|
||||
if (limit < m_units.size()) {
|
||||
// this might repeat some literals.
|
||||
out.append(m_units.size() - limit, m_units.c_ptr() + limit);
|
||||
}
|
||||
for (unsigned i = 0; i < in.size(); ++i) {
|
||||
literal lit = in[i];
|
||||
if (!m_unit_set.contains(lit.index())) {
|
||||
m_unit_set.insert(lit.index());
|
||||
m_units.push_back(lit);
|
||||
}
|
||||
}
|
||||
limit = m_units.size();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue