Skip to content

Commit 49a3af2

Browse files
authored
Merge pull request #2983 from tautschnig/ipasir-cleanup
Fix instructions and Makefiles for IPASIR-based SAT solvers
2 parents b372675 + 3f4a896 commit 49a3af2

File tree

6 files changed

+36
-46
lines changed

6 files changed

+36
-46
lines changed

COMPILING.md

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,10 @@ We assume that you have a Debian/Ubuntu or Red Hat-like distribution.
5555
make -C src minisat2-download
5656
make -C src
5757
```
58+
See doc/architectural/compilation-and-development.md for instructions on how
59+
to use a SAT solver other than MiniSat 2.
5860

59-
4. Linking against an IPASIR SAT solver
60-
61-
Get an IPASIR package and build picosat by default
62-
```
63-
make -C src ipasir-build
64-
```
65-
66-
Build CBMC with IPASIR and link against the ipasir solver library
67-
Note: the LIBSOLVER variable could be pointed towards other solvers
68-
```
69-
make -C src IPASIR=../../ipasir LIBSOLVER=$(pwd)/ipasir/libipasir.a
70-
```
71-
72-
5. To compile JBMC, do
61+
4. To compile JBMC, do
7362
```
7463
make -C jbmc/src setup-submodules
7564
make -C jbmc/src

doc/architectural/compilation-and-development.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,35 @@ For more information on the structure of `unit/` and how to tag tests, see
143143
repository](https://github.com/diffblue/cbmc/blob/develop/CODING_STANDARD.md#unit-tests)
144144

145145

146+
\subsection compilation-and-development-subsection-sat-solver Using a different SAT solver
147+
148+
By default, CBMC will assume MiniSat 2 as the SAT back-end. Several other
149+
solvers are supported (see also
150+
[config.inc](compilation-and-development-subsubsection-config-inc) above). As a
151+
more general option, which is not limited to a single SAT solver, you may use
152+
the IPASIR interface. For example, to use the SAT solver RISS, proceed as
153+
follows:
154+
155+
1) Build RISS (in particular its IPASIR configuration):
156+
157+
git clone https://github.com/conp-solutions/riss riss.git
158+
cd riss.git
159+
mkdir build
160+
cd build
161+
cmake ..
162+
make riss-coprocessor-lib-static
163+
cd ../..
164+
165+
2) Build CBMC while enabling the IPASIR back-end:
166+
make -C src IPASIR=../../riss.git/riss \
167+
LIBS="../../riss.git/build/lib/libriss-coprocessor.a -lpthread"
168+
169+
3) Run CBMC - note that RISS is highly configurable via the RISSCONFIG
170+
environment variable:
171+
export RISSCONFIG=VERBOSE:BMC1
172+
... run CBMC ...
173+
174+
146175
\section compilation-and-development-section-documentation Documentation
147176

148177
Apart from the (user-orientated) CBMC user manual and this document, most

src/Makefile

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,6 @@ glucose-download:
105105
@(cd ../glucose-syrup; patch -p1 < ../scripts/glucose-syrup-patch)
106106
@rm glucose-syrup.tgz
107107

108-
ipasir-download:
109-
# get the 2016 version of the ipasir package, which contains a few solvers
110-
@echo "Download ipasir 2016 package"
111-
@(lwp-download http://baldur.iti.kit.edu/sat-competition-2016/downloads/ipasir.zip ../ipasir.zip)
112-
@(cd ..; unzip -u ipasir.zip)
113-
114-
ipasir-build: ipasir-download
115-
# build libpicosat, and create a libipasir.a in ipasir directory
116-
# make sure that the ipasir.h file is located there as well (ships with 2016 package)
117-
@echo "Build Picosat 961 from ipasir 2016 package"
118-
$(MAKE) -C ../ipasir/sat/picosat961 libipasirpicosat961.a
119-
@(cd ../ipasir; ln -sf sat/picosat961/libipasirpicosat961.a libipasir.a)
120-
121108
cadical_release = rel-06w
122109
cadical-download:
123110
@echo "Downloading CaDiCaL $(cadical_release)"

src/config.inc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ endif
2626
#GLUCOSE = ../../glucose-syrup
2727
#CADICAL = ../../cadical
2828

29-
# Extra library for SAT solver. This should link to the archive file to be used
30-
# when linking against an IPASIR solver.
31-
LIBSOLVER =
32-
3329
# select default solver to be minisat2 if no other is specified
3430
ifeq ($(BOOLEFORCE)$(CHAFF)$(GLUCOSE)$(IPASIR)$(LINGELING)$(MINISAT)$(MINISAT2)$(PICOSAT)$(CADICAL),)
3531
MINISAT2 = ../../minisat-2.2.1

src/solvers/Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ endif
2525
ifneq ($(IPASIR),)
2626
IPASIR_SRC=sat/satcheck_ipasir.cpp
2727
IPASIR_INCLUDE=-I $(IPASIR)
28-
IPASIR_LIB=$(IPASIR)/ipasir.a
2928
CP_CXXFLAGS += -DHAVE_IPASIR -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
3029
override CXXFLAGS := $(filter-out -pedantic, $(CXXFLAGS))
3130
endif
@@ -224,10 +223,10 @@ endif
224223
###############################################################################
225224

226225
solvers$(LIBEXT): $(OBJ) $(SOLVER_LIB)
227-
$(LINKLIB) $(LIBSOLVER)
226+
$(LINKLIB)
228227

229228
-include $(smt2/smt2_solver$(DEPEXT))
230229

231230
smt2_solver$(EXEEXT): $(OBJ) smt2/smt2_solver$(OBJEXT) \
232231
../util/util$(LIBEXT) ../langapi/langapi$(LIBEXT) ../big-int/big-int$(LIBEXT) $(SOLVER_LIB)
233-
$(LINKBIN) $(LIBSOLVER)
232+
$(LINKBIN)

src/solvers/sat/satcheck_ipasir.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,8 @@
44
55
Author: Norbert Manthey, [email protected]
66
7-
Sample compilation command:
8-
(to be executed from base directory of project)
9-
10-
make clean
11-
make ipasir-build
12-
CXXFLAGS=-g IPASIR=../../ipasir LIBSOLVER=$(pwd)/ipasir/libipasir.a \
13-
CFLAGS="-Wall -O2 -DSATCHECK_IPSAIR" LINKFLAGS="-static" \
14-
make -j 7 -C $(pwd)/src/;
15-
16-
Note: Make sure, the LIBSOLVER variable is set in the environment!
17-
The variable should point to the solver you actually want to
18-
link against.
7+
See \ref compilation-and-development-subsection-sat-solver for build
8+
instructions.
199
2010
\*******************************************************************/
2111

0 commit comments

Comments
 (0)