Segfault possibly in new parallel collider

Bug #1314736 reported by Anton Gladky
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Yade
Fix Released
High
Unassigned

Bug Description

I have got segfault, which is probably due to a new parallel collider. It happened on my "local" version, which is not yet merged to the main branch [1] (with ENABLE_LIQCONTROL=ON option), but it is unlikely due to my changes.

Before the crash I have got the following warning several times:
ERROR /home/gladk/dem/yade/trunk/pkg/common/InsertionSortCollider.cpp:132 insertionSortParallel: parallel sort not guaranteed to succeed; in chunk 1 of 2, bound descending past half-chunk. Consider turning ompThreads=1 for thread safety.
....
....
Segmentation fault

I will try to provide the minimal script, which produces such segfault. Bruno, maybe you have an idea, where it crashes?

[1] https://github.com/gladk/trunk

Thanks

Anton

Revision history for this message
Anton Gladky (gladky-anton) wrote : Re: [Bug 1314736] [NEW] Segfault possibly in new parallel collider

Some short info, if I set -j1, then there is not crash any more.

Anton

Revision history for this message
Bruno Chareyre (bruno-chareyre) wrote :

> if I set -j1, then there is not crash any more.

At least, it is consistent with the error message "Consider turning ompThreads=1 for thread safety".
I think you don't have to use -j1, setting collider.ompThreads=1 should be enough (the the other engines can still run parallel).

I guess you have a small number of particles or a very peculiar geometry, and also fast moving objects. Correct? In such case the parallel collider can fail in the sort phase. This situation is detected already (hence the error message).
The fix I can imagine is to turn collider.ompThreads=1 automatically instead of sending error messages.

Bruno

Revision history for this message
Anton Gladky (gladky-anton) wrote : Re: [Bug 1314736] Re: Segfault possibly in new parallel collider

You are right, there was a numerical instability and
"explosion". But anyway, the collider should not crash.

Anton

2014-05-02 16:37 GMT+02:00 Bruno Chareyre <email address hidden>:

> > if I set -j1, then there is not crash any more.
>
> At least, it is consistent with the error message "Consider turning
> ompThreads=1 for thread safety".
> I think you don't have to use -j1, setting collider.ompThreads=1 should be
> enough (the the other engines can still run parallel).
>
> I guess you have a small number of particles or a very peculiar geometry,
> and also fast moving objects. Correct? In such case the parallel collider
> can fail in the sort phase. This situation is detected already (hence the
> error message).
> The fix I can imagine is to turn collider.ompThreads=1 automatically
> instead of sending error messages.
>
> Bruno
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1314736
>
> Title:
> Segfault possibly in new parallel collider
>
> Status in Yet Another Dynamic Engine:
> New
>
> Bug description:
> I have got segfault, which is probably due to a new parallel collider.
> It happened on my "local" version, which is not yet merged to the main
> branch [1] (with ENABLE_LIQCONTROL=ON option), but it is unlikely due
> to my changes.
>
> Before the crash I have got the following warning several times:
> ERROR
> /home/gladk/dem/yade/trunk/pkg/common/InsertionSortCollider.cpp:132
> insertionSortParallel: parallel sort not guaranteed to succeed; in chunk 1
> of 2, bound descending past half-chunk. Consider turning ompThreads=1 for
> thread safety.
> ....
> ....
> Segmentation fault
>
> I will try to provide the minimal script, which produces such
> segfault. Bruno, maybe you have an idea, where it crashes?
>
> [1] https://github.com/gladk/trunk
>
> Thanks
>
>
> Anton
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/yade/+bug/1314736/+subscriptions
>

Revision history for this message
matthias (matthias-frank) wrote : Re: [Yade-dev] [Bug 1314736] Re: Segfault possibly in new parallel collider

This error comes also up in the bulldozer.py example.
I tried this with dt=2*PWaveStep and dt =1e-06

but in both cases, this error comes up.

Matthias

Am Fr 02 Mai 2014 17:04:43 CEST schrieb Anton Gladky:
> You are right, there was a numerical instability and
> "explosion". But anyway, the collider should not crash.
>
> Anton
>
>
> 2014-05-02 16:37 GMT+02:00 Bruno Chareyre <email address hidden>:
>
>>> if I set -j1, then there is not crash any more.
>>
>> At least, it is consistent with the error message "Consider turning
>> ompThreads=1 for thread safety".
>> I think you don't have to use -j1, setting collider.ompThreads=1 should be
>> enough (the the other engines can still run parallel).
>>
>> I guess you have a small number of particles or a very peculiar geometry,
>> and also fast moving objects. Correct? In such case the parallel collider
>> can fail in the sort phase. This situation is detected already (hence the
>> error message).
>> The fix I can imagine is to turn collider.ompThreads=1 automatically
>> instead of sending error messages.
>>
>> Bruno
>>
>> --
>> You received this bug notification because you are subscribed to the bug
>> report.
>> https://bugs.launchpad.net/bugs/1314736
>>
>> Title:
>> Segfault possibly in new parallel collider
>>
>> Status in Yet Another Dynamic Engine:
>> New
>>
>> Bug description:
>> I have got segfault, which is probably due to a new parallel collider.
>> It happened on my "local" version, which is not yet merged to the main
>> branch [1] (with ENABLE_LIQCONTROL=ON option), but it is unlikely due
>> to my changes.
>>
>> Before the crash I have got the following warning several times:
>> ERROR
>> /home/gladk/dem/yade/trunk/pkg/common/InsertionSortCollider.cpp:132
>> insertionSortParallel: parallel sort not guaranteed to succeed; in chunk 1
>> of 2, bound descending past half-chunk. Consider turning ompThreads=1 for
>> thread safety.
>> ....
>> ....
>> Segmentation fault
>>
>> I will try to provide the minimal script, which produces such
>> segfault. Bruno, maybe you have an idea, where it crashes?
>>
>> [1] https://github.com/gladk/trunk
>>
>> Thanks
>>
>>
>> Anton
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/yade/+bug/1314736/+subscriptions
>>
>

--
----------------------------
Dipl.-Inf. Matthias Frank
wissenschaftlicher Mitarbeiter

Technische Universität Dresden
Fakultät Maschinenwesen
Institut für Verarbeitungsmaschinen und mobile Arbeitsmaschinen
Professur für Verarbeitungsmaschinen und Verarbeitungstechnik

01062 Dresden

Tel.: +49 351 463 36124
E-Mail: <email address hidden>
www.vat.tu-dresden.de

Revision history for this message
Anton Gladky (gladky-anton) wrote : Re: [Bug 1314736] Re: Segfault possibly in new parallel collider

Maybe it is better to set the collider in non-parallel mode,
if such situation occurs during simulation?

Anton

Revision history for this message
Bruno Chareyre (bruno-chareyre) wrote :

It was my suggestion in #2 Anton. Define the number of threads explicitely for the collider (in your script):
collider.ompThreads=1

It will switch to 1-thread variant of the sort. Could you please confirm that it avoids the crash?
If so, I will just make the switch automatic, so nobody has to worry about that.

Revision history for this message
Anton Gladky (gladky-anton) wrote :

2014-05-07 19:47 GMT+02:00 Bruno Chareyre <email address hidden>:
> It was my suggestion in #2 Anton. Define the number of threads explicitely for the collider (in your script):
> collider.ompThreads=1

Yes, I confirm that.

> It will switch to 1-thread variant of the sort. Could you please confirm that it avoids the crash?
> If so, I will just make the switch automatic, so nobody has to worry about that.

That would be fine!

Anton

Revision history for this message
Bruno Chareyre (bruno-chareyre) wrote :

I pushed a fix (3b09fb5) but I could not test it. Can you confirm?

Revision history for this message
Anton Gladky (gladky-anton) wrote :

Thanks for the fix. It seems, all is OK now.

Closing the bug.

Anton

Changed in yade:
status: New → Fix Released
importance: Undecided → High
Revision history for this message
Anton Gladky (gladky-anton) wrote :

Bruno, may I add bool sortParallel=True (by default) parameter into
insertionsortcollider to have an opportunity to switch it off, if
the simulation gives warning?

Thanks

Anton

2014-05-18 17:03 GMT+02:00 Anton Gladky <email address hidden>:
> Thanks for the fix. It seems, all is OK now.
>
> Closing the bug.
>
> Anton
>
> ** Changed in: yade
> Status: New => Fix Released
>
> ** Changed in: yade
> Importance: Undecided => High
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1314736
>
> Title:
> Segfault possibly in new parallel collider
>
> Status in Yet Another Dynamic Engine:
> Fix Released
>
> Bug description:
> I have got segfault, which is probably due to a new parallel collider.
> It happened on my "local" version, which is not yet merged to the main
> branch [1] (with ENABLE_LIQCONTROL=ON option), but it is unlikely due
> to my changes.
>
> Before the crash I have got the following warning several times:
> ERROR /home/gladk/dem/yade/trunk/pkg/common/InsertionSortCollider.cpp:132 insertionSortParallel: parallel sort not guaranteed to succeed; in chunk 1 of 2, bound descending past half-chunk. Consider turning ompThreads=1 for thread safety.
> ....
> ....
> Segmentation fault
>
> I will try to provide the minimal script, which produces such
> segfault. Bruno, maybe you have an idea, where it crashes?
>
> [1] https://github.com/gladk/trunk
>
> Thanks
>
>
> Anton
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/yade/+bug/1314736/+subscriptions

Revision history for this message
Bruno Chareyre (bruno-chareyre) wrote : Re: [Yade-dev] [Bug 1314736] Re: Segfault possibly in new parallel collider

There is no need Anton. Set collider.ompThreads=1, it will have the same
effect.
Bruno

Revision history for this message
Anton Gladky (gladky-anton) wrote :

Thanks Bruno! It is useful to read warning messages sometimes!!

Anton

2014-05-21 14:59 GMT+02:00 Bruno Chareyre <email address hidden>:
> There is no need Anton. Set collider.ompThreads=1, it will have the same
> effect.

Revision history for this message
Bruno Chareyre (bruno-chareyre) wrote :

:)
Maybe the warning should be "consider turning collider.ompThreads=1" instead of "consider turning ompThreads=1"?

Revision history for this message
Anton Gladky (gladky-anton) wrote : Re: [Bug 1314736] Re: Segfault possibly in new parallel collider

2014-05-21 15:29 GMT+02:00 Bruno Chareyre <email address hidden>:
> :)
> Maybe the warning should be "consider turning collider.ompThreads=1" instead of "consider turning ompThreads=1"?

Yes, you are right. Because it looks like to switch off parallel mode
for the whole simulation.

Anton

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.