Hi,
I'm having some (random) errors with the AngleRestraint function.
I get a Segmentation fault (core dumped) error when applying an AngleRestraint restraint like:
i = 0 while (i <= particles-3): p1 = ps.get_particle(i) p2 = ps.get_particle(i+2) p3 = ps.get_particle(i+3) ar = IMP.core.AngleRestraint(IMP.core.Harmonic(0, 1), p1, p2, p3) m.add_restraint(ar) i += 3
The error is not persistent, meaning that if I run the code severe times, the error disappear and the code ends normally.
Is there any specify reason for such an error?
Thanks! Davide
Hmmm, that code looks fine. Can you get a stack trace for a core dump? When does the core dump occur, in that loop?
BTW, you can pull the Harmonic out of the loop and share one harmonic between many angle restraints.
On Fri, Jan 10, 2014 at 3:52 AM, Davide Baù davide.bau@gmail.com wrote:
> Hi, > > I'm having some (random) errors with the AngleRestraint function. > > I get a Segmentation fault (core dumped) error when applying an > AngleRestraint restraint like: > > i = 0 > while (i <= particles-3): > p1 = ps.get_particle(i) > p2 = ps.get_particle(i+2) > p3 = ps.get_particle(i+3) > ar = IMP.core.AngleRestraint(IMP.core.Harmonic(0, 1), p1, p2, p3) > m.add_restraint(ar) > i += 3 > > The error is not persistent, meaning that if I run the code severe times, > the error disappear and the code ends normally. > > Is there any specify reason for such an error? > > Thanks! > Davide > > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev >
Yes,
it occurs inside the loop. The loop is run inside a function:
def setup_angles(m, ps, particles): i = 0 while (i <= particles-3): p1 = ps.get_particle(i) p2 = ps.get_particle(i+2) p3 = ps.get_particle(i+3) ar = IMP.core.AngleRestraint(IMP.core.Harmonic(0, 1), p1, p2, p3) m.add_restraint(ar) i += 3
As for the stack trace, I'm not totally sure about how to do it. I've done the following:
$ gdb python (gdb) run model.py Starting program: /usr/bin/python model.py [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault. 0x00007ffff5dd5eb0 in IMP::kernel::Particle::get_index() const () from /usr/src/imp/imp-r2.1.1/lib/libimp_kernel.so (gdb)
Davide
On Jan 10, 2014, at 1:12 PM, Daniel Russel wrote: > Hmmm, that code looks fine. Can you get a stack trace for a core dump? When does the core dump occur, in that loop? > > BTW, you can pull the Harmonic out of the loop and share one harmonic between many angle restraints. > > > On Fri, Jan 10, 2014 at 3:52 AM, Davide Baù davide.bau@gmail.com wrote: > Hi, > > I'm having some (random) errors with the AngleRestraint function. > > I get a Segmentation fault (core dumped) error when applying an AngleRestraint restraint like: > > i = 0 > while (i <= particles-3): > p1 = ps.get_particle(i) > p2 = ps.get_particle(i+2) > p3 = ps.get_particle(i+3) > ar = IMP.core.AngleRestraint(IMP.core.Harmonic(0, 1), p1, p2, p3) > m.add_restraint(ar) > i += 3 > > The error is not persistent, meaning that if I run the code severe times, the error disappear and the code ends normally. > > Is there any specify reason for such an error? > > Thanks! > Davide > > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
Hi Davide,
Could it be that you should used different indexes when retrieving the particles from the container ps? Instead of having
>> p1 = ps.get_particle(i) >> p2 = ps.get_particle(i+2) >> p3 = ps.get_particle(i+3)
This makes much more sense to me
>> p1 = ps.get_particle(i) >> p2 = ps.get_particle(i+1) >> p3 = ps.get_particle(i+2)
Ciao R
Sent from my iPhone
On Jan 10, 2014, at 4:49 AM, Davide Baù davide.bau@gmail.com wrote:
> p1 = ps.get_particle(i) > p2 = ps.get_particle(i+2) > p3 = ps.get_particle(i+3)
Good point :-)
As a key note, always run your code through a build with checks turned on. It probably would have told you immediately that you are walking off the end of an array.
— Sent from Mailbox for iPhone
On Fri, Jan 10, 2014 at 4:49 AM, Davide Baù davide.bau@gmail.com wrote:
> Yes, > it occurs inside the loop. The loop is run inside a function: > def setup_angles(m, ps, particles): > i = 0 > while (i <= particles-3): > p1 = ps.get_particle(i) > p2 = ps.get_particle(i+2) > p3 = ps.get_particle(i+3) > ar = IMP.core.AngleRestraint(IMP.core.Harmonic(0, 1), p1, p2, p3) > m.add_restraint(ar) > i += 3 > As for the stack trace, I'm not totally sure about how to do it. I've done the following: > $ gdb python > (gdb) run model.py > Starting program: /usr/bin/python model.py > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". > Program received signal SIGSEGV, Segmentation fault. > 0x00007ffff5dd5eb0 in IMP::kernel::Particle::get_index() const () from /usr/src/imp/imp-r2.1.1/lib/libimp_kernel.so > (gdb) > Davide > On Jan 10, 2014, at 1:12 PM, Daniel Russel wrote: >> Hmmm, that code looks fine. Can you get a stack trace for a core dump? When does the core dump occur, in that loop? >> >> BTW, you can pull the Harmonic out of the loop and share one harmonic between many angle restraints. >> >> >> On Fri, Jan 10, 2014 at 3:52 AM, Davide Baù davide.bau@gmail.com wrote: >> Hi, >> >> I'm having some (random) errors with the AngleRestraint function. >> >> I get a Segmentation fault (core dumped) error when applying an AngleRestraint restraint like: >> >> i = 0 >> while (i <= particles-3): >> p1 = ps.get_particle(i) >> p2 = ps.get_particle(i+2) >> p3 = ps.get_particle(i+3) >> ar = IMP.core.AngleRestraint(IMP.core.Harmonic(0, 1), p1, p2, p3) >> m.add_restraint(ar) >> i += 3 >> >> The error is not persistent, meaning that if I run the code severe times, the error disappear and the code ends normally. >> >> Is there any specify reason for such an error? >> >> Thanks! >> Davide >> >> >> _______________________________________________ >> IMP-dev mailing list >> IMP-dev@salilab.org >> https://salilab.org/mailman/listinfo/imp-dev >> >> _______________________________________________ >> IMP-dev mailing list >> IMP-dev@salilab.org >> https://salilab.org/mailman/listinfo/imp-dev
Ah! My bad! :-)
Thanks Riccardo and Daniel, that was the point!!!
Davide
On Jan 10, 2014, at 6:38 PM, Daniel Russel wrote:
> Good point :-) > > As a key note, always run your code through a build with checks turned on. It probably would have told you immediately that you are walking off the end of an array. > — > Sent from Mailbox for iPhone > > > On Fri, Jan 10, 2014 at 4:49 AM, Davide Baù davide.bau@gmail.com wrote: > > Yes, > > > it occurs inside the loop. The loop is run inside a function: > > def setup_angles(m, ps, particles): > i = 0 > while (i <= particles-3): > p1 = ps.get_particle(i) > p2 = ps.get_particle(i+2) > p3 = ps.get_particle(i+3) > ar = IMP.core.AngleRestraint(IMP.core.Harmonic(0, 1), p1, p2, p3) > m.add_restraint(ar) > i += 3 > > As for the stack trace, I'm not totally sure about how to do it. I've done the following: > > $ gdb python > (gdb) run model.py > Starting program: /usr/bin/python model.py > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". > > Program received signal SIGSEGV, Segmentation fault. > 0x00007ffff5dd5eb0 in IMP::kernel::Particle::get_index() const () from /usr/src/imp/imp-r2.1.1/lib/libimp_kernel.so > (gdb) > > > Davide > > > On Jan 10, 2014, at 1:12 PM, Daniel Russel wrote: >> Hmmm, that code looks fine. Can you get a stack trace for a core dump? When does the core dump occur, in that loop? >> >> BTW, you can pull the Harmonic out of the loop and share one harmonic between many angle restraints. >> >> >> On Fri, Jan 10, 2014 at 3:52 AM, Davide Baù davide.bau@gmail.com wrote: >> Hi, >> >> I'm having some (random) errors with the AngleRestraint function. >> >> I get a Segmentation fault (core dumped) error when applying an AngleRestraint restraint like: >> >> i = 0 >> while (i <= particles-3): >> p1 = ps.get_particle(i) >> p2 = ps.get_particle(i+2) >> p3 = ps.get_particle(i+3) >> ar = IMP.core.AngleRestraint(IMP.core.Harmonic(0, 1), p1, p2, p3) >> m.add_restraint(ar) >> i += 3 >> >> The error is not persistent, meaning that if I run the code severe times, the error disappear and the code ends normally. >> >> Is there any specify reason for such an error? >> >> Thanks! >> Davide >> >> >> _______________________________________________ >> IMP-dev mailing list >> IMP-dev@salilab.org >> https://salilab.org/mailman/listinfo/imp-dev >> >> _______________________________________________ >> IMP-dev mailing list >> IMP-dev@salilab.org >> https://salilab.org/mailman/listinfo/imp-dev > > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
participants (3)
-
Daniel Russel
-
Davide Baù
-
Riccardo Pellarin