[SCIP] SCIP Multi thread assert in SCIPfree()

Corentin Le Molgat corentinl at google.com
Tue Jul 20 18:47:02 CEST 2021


Hi,

## Context
We are currently trying to enable multi thread support of SCIP inside
Google OR-Tools (master branch) and thus enable it in one of our our sample
to test it.
see:
https://github.com/google/or-tools/blob/master/ortools/linear_solver/samples/integer_programming_example.cc#L74

This will basically use:
```cpp
SCIPsetIntParam(scip_, "parallel/maxnthreads", 8);
SCIPsolveConcurrent(scip_);
```
I've noticed some assert failure at SCIP destruction coming from the SCIP
code itself,  the call to SCIPfree() at the end of our sample (when our
scip wrapper is destroy) will fail.
we got this trace:
```sh
integer_programming_example: build/_deps/scip-src/src/scip/primal.c:182:
SCIPprimalFree: Assertion `(*primal)->nexistingsols == 0' failed.
zsh: abort (core dumped) ./build/bin/integer_programming_example
```

# Protocol
I manage to reproduce the issue in a pure cmake project without using
or-tools framework i.e. directly calling the SCIP API without using the
scip_interface.cpp or gscip.cpp from ortools.
note: You can get the project at https://github.com/Mizux/scip-multithread

To reproduce the error:
```sh
git clone https://github.com/Mizux/scip-multithread.git

cmake -S. -Bbuild

cmake --build build

./build/bin/Foo

 ...

 Assertion failed: ((*primal)->nexistingsols == 0), function
SCIPprimalFree, file build/_deps/scip-src/src/scip/primal.c, line 182.

 zsh: abort      ./build/bin/Foo
```
note: CMake is configured to build in "RelWithDebInfo" by default thus
assert are enabled...
note2: SCIP is integrated to the build using the CMake FetchContent
built-in module
note3: I had to patch the source ->
https://github.com/Mizux/scip-multithread/blob/main/cmake/deps/scip-7.0.1.patch
(this is the same patch we apply in google/or-tools)

## Observed
The assert error is issued when reaching this line
https://github.com/Mizux/scip-multithread/blob/9b6eaa09109c7005bb521f72968b7707c5ec6d2b/Foo/src/main.cpp#L215

## Expected
no assertion raise, i.e. the destruction of scip pass...

## Side Note
If we use `SCIPsolve(scip_);` instead aka single thread solve, the program
will terminate without issuing any error...
ref:
https://github.com/Mizux/scip-multithread/blob/9b6eaa09109c7005bb521f72968b7707c5ec6d2b/Foo/src/main.cpp#L120

* Do you have some canonical examples/samples so we can try to fix our SCIP
integration ourselves ?
* Could you help us to fix it ?

If you need more information/support to reproduce the issue using my simple
project, don't hesitate !

Sincerely,
Corentin "Mizux" Le Molgat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.zib.de/pipermail/scip/attachments/20210720/44210d2e/attachment.html>


More information about the Scip mailing list