<div dir="ltr">Hi,<div><div><br></div><div>## Context</div><div>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.<br></div><div>see: <a href="https://github.com/google/or-tools/blob/master/ortools/linear_solver/samples/integer_programming_example.cc#L74">https://github.com/google/or-tools/blob/master/ortools/linear_solver/samples/integer_programming_example.cc#L74</a><br><br></div><div>This will basically use:</div><div>```cpp</div><div>SCIPsetIntParam(scip_, "parallel/maxnthreads", 8);<br>SCIPsolveConcurrent(scip_);<br></div><div>```</div><div><span style="color:rgb(32,33,36);font-family:Roboto,Arial,sans-serif;font-size:13px;letter-spacing:0.185714px">I've noticed some assert failure at SCIP destruction coming from the SCIP code itself,  the call to</span> SCIPfree() at the end of our sample (when our scip wrapper is destroy) will fail.</div><div>we got this trace:</div><div>```sh</div><div><span style="font-family:WorkAroundWebKitAndMozilla,monospace;color:rgb(32,33,36);font-size:13px;letter-spacing:0.185714px">integer_programming_example: build/_deps/scip-src/src/scip/primal.c:182: SCIPprimalFree: Assertion `(*primal)->nexistingsols == 0' failed.</span></div><div><span style="font-family:WorkAroundWebKitAndMozilla,monospace;color:rgb(32,33,36);font-size:13px;letter-spacing:0.185714px">zsh: abort (core dumped)  ./build/bin/integer_programming_example</span></div><div>``` </div><div><br></div><div># Protocol</div><div>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. </div><div>note: You can get the project at <a href="https://github.com/Mizux/scip-multithread">https://github.com/Mizux/scip-multithread</a>  </div><div><br></div><div>To reproduce the error:</div><div>```sh</div><div>git clone <a href="https://github.com/Mizux/scip-multithread.git">https://github.com/Mizux/scip-multithread.git</a></div><div>





<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">cmake -S. -Bbuild</span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">cmake --build build</span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">





</span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">./build/bin/Foo</span></p><p class="gmail-p1" style="margin:0px;font:11px Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"> ...</span></p><p class="gmail-p1" style="margin:0px;font:11px Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"> Assertion failed: ((*primal)->nexistingsols == 0), function SCIPprimalFree, file build/_deps/scip-src/src/scip/primal.c, line 182.</span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">






</span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"> zsh: abort<span class="gmail-Apple-converted-space">      </span>./build/bin/Foo</span></p></div><div>```</div><div>note: CMake is configured to build in "RelWithDebInfo" by default thus assert are enabled...</div><div>note2: SCIP is integrated to the build using the CMake FetchContent built-in module<br>note3: I had to patch the source -> <a href="https://github.com/Mizux/scip-multithread/blob/main/cmake/deps/scip-7.0.1.patch">https://github.com/Mizux/scip-multithread/blob/main/cmake/deps/scip-7.0.1.patch</a>  (this is the same patch we apply in google/or-tools)</div><div><br></div><div>## Observed</div><div>The assert error is issued when reaching this line <a href="https://github.com/Mizux/scip-multithread/blob/9b6eaa09109c7005bb521f72968b7707c5ec6d2b/Foo/src/main.cpp#L215">https://github.com/Mizux/scip-multithread/blob/9b6eaa09109c7005bb521f72968b7707c5ec6d2b/Foo/src/main.cpp#L215</a><br></div><div><br></div><div>## Expected</div><div>no assertion raise, i.e. the destruction of scip pass...</div><div><br></div><div>## Side Note</div><div>If we use `SCIPsolve(scip_);` instead aka single thread solve, the program will terminate without issuing any error...</div><div>ref: <a href="https://github.com/Mizux/scip-multithread/blob/9b6eaa09109c7005bb521f72968b7707c5ec6d2b/Foo/src/main.cpp#L120">https://github.com/Mizux/scip-multithread/blob/9b6eaa09109c7005bb521f72968b7707c5ec6d2b/Foo/src/main.cpp#L120</a></div><div><br></div><div>* Do you have some canonical examples/samples so we can try to fix our SCIP integration ourselves ?</div><div>* Could you help us to fix it ?</div><div><br></div><div>If you need more information/support to reproduce the issue using my simple project, don't hesitate !</div><div><br></div><div>Sincerely,</div><div>Corentin "Mizux" Le Molgat</div><div><br></div></div></div>