marcogario / ipasir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mixed up funtions, testing fails when using Riss

nmanthey opened this issue · comments

Dear Marco,

I just tested your wrapper against Riss. Testing failed, because your assume function uses the "ipasir_add" method instead of "ipasir_assume". I wonder whether your test case worked for your PicoSAT, as it always failed for Riss until I fixed this in a local copy.

The fix should be fairly straight forward:
on line 95, change self._lib.ipasir_add(solver, lit) -> self._lib.ipasir_assume(solver, lit)

Furthermore, my test dies (segfault) during the last call to solve. Did this work for you? Any insights are welcome.

Best,
Norbert

Hi Norbert!

You are right, I pushed an updated version. Note that I had some pending changes in my local copy.

This was more than a year ago, so I might be remembering incorrectly. This simple example worked, but I had problems using other solvers. This is why we did not integrate this into pySMT (pysmt/pysmt#236). Integration in pySMT would be nice, because we could leverage all the test-cases there to make sure that everything works. If you are working on this and manage to get riss working, please let me know.

I just checked out a fresh copy and this seems to work for the simple test that I have in ipasir_cffi.py

I am not sure what you mean by "If you are working on this and manage to get riss working, please let me know.", but I am willing to help (modulo available time) getting your python wrapper up and running for IPASIR SAT solvers.

Your update seems to work with Riss, except the set_terminate function. Somewhere (might even be in Riss) things go wild, and when the solver finally wants to call that function it fails.

For testing, I (1) added some output to your python script, and (2) allowed to read the solver library to load from sys.argv[1], so that I can choose which IPASIR solver to pick.

Output from my main python script
<cdata 'void *' 0xb7ab60>
<cdata 'void *' 0xa8acc0>
(True, True)
Now run final solver1.solve() after terminate function has been set

Program received signal SIGILL, Illegal instruction.
0x00007ffff7ff5fc4 in ?? ()

Partial stack trace:
gdb r --args python -v -i riss_ipasir_cffi.py ipasirgithub/sat/riss_7/libriss-coprocessor.so

#0 0x00007ffff7ff5fc4 in ?? ()
#1 0x00007ffff54d20e4 in Riss::Solver::search(int) () from ipasirgithub/sat/riss_7/libriss-coprocessor.so
#2 0x00007ffff54d4615 in Riss::Solver::solve_(Riss::Solver::SolveCallType) () from ipasirgithub/sat/riss_7/libriss-coprocessor.so
#3 0x00007ffff54c7e48 in riss_sat_limited () from ipasirgithub/sat/riss_7/libriss-coprocessor.so
...
#18 0x00000000004c24a9 in PyEval_EvalCode (co=, globals=, locals=) at ../Python/ceval.c:669
#19 0x00000000004f19ef in run_mod.lto_priv () at ../Python/pythonrun.c:1376
#20 0x00000000004ec372 in PyRun_FileExFlags () at ../Python/pythonrun.c:1362
#21 0x00000000004eaaf1 in PyRun_SimpleFileExFlags () at ../Python/pythonrun.c:948
#22 0x000000000049e208 in Py_Main () at ../Modules/main.c:640
#23 0x00007ffff7810830 in __libc_start_main (main=0x49db30

, argc=5, argv=0x7fffffffdcb8, init=, fini=, rtld_fini=,
stack_end=0x7fffffffdca8) at ../csu/libc-start.c:291